sipxtacklib  Version 3.3
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
SipRefreshManager Class Reference

Class for refreshing SIP subscriptions and registrations. More...

#include <SipRefreshManager.h>

Inheritance diagram for SipRefreshManager:
Inheritance graph
[legend]
Collaboration diagram for SipRefreshManager:
Collaboration graph
[legend]

Public Types

enum  RefreshRequestState {
  REFRESH_REQUEST_UNKNOWN,
  REFRESH_REQUEST_PENDING,
  REFRESH_REQUEST_FAILED,
  REFRESH_REQUEST_SUCCEEDED
}
 
typedef void(* RefreshStateCallback) (SipRefreshManager::RefreshRequestState requestState, const char *earlyDialogHandle, const char *dialogHandle, void *applicationData, int responseCode, const char *responseText, long expiration, const SipMessage *response)
 

Public Member Functions

 SipRefreshManager (SipUserAgent &userAgent, SipDialogMgr &dialogMgr)
 Default Dialog constructor. More...
 
virtual ~SipRefreshManager ()
 Destructor. More...
 
UtlBoolean initiateRefresh (SipMessage &subscribeOrRegisterRequest, void *applicationData, const RefreshStateCallback refreshStateCallback, UtlString &earlyDialogHandle)
 Send message and keep request refreshed (i.e. subscribed or registered) More...
 
UtlBoolean stopRefresh (const char *dialogHandle)
 End the SIP refresh (registration or subscription) indicated by. More...
 
void stopAllRefreshes ()
 Stop refreshing, unregister and unsubscribe all. More...
 
UtlBoolean handleMessage (OsMsg &eventMessage)
 Handler for SUBSCRIBE and REGISTER responses. More...
 
int dumpRefreshStates (UtlString &dumpString)
 Debugging method to get an dump of all refresh states. More...
 
int countRefreshSessions () const
 Get a count of the subscriptions and registration which have been added. More...
 

Static Public Member Functions

static void refreshState2String (RefreshRequestState state, UtlString &stateString)
 Get a string representation of the refresh state enumeration. More...
 

Protected Member Functions

void lock ()
 lock for single thread use More...
 
void unlock ()
 lock for single thread use More...
 

Detailed Description

Class for refreshing SIP subscriptions and registrations.

This is currently verified for SUBSCRIPTIONS ONLY. This class is intended to deprecate the SipRefreshMgr class.

Member Typedef Documentation

typedef void(* RefreshStateCallback) (SipRefreshManager::RefreshRequestState requestState, const char *earlyDialogHandle, const char *dialogHandle, void *applicationData, int responseCode, const char *responseText, long expiration,const SipMessage *response)

Typedef defining the signature of the callback used to inform applications of refresh subscription and registration state changes.

Parameters
requestState- the state of the last SUBSCRIBE or NOTIFY transaction. Note: this is not the same as the dialog state. The dialog state is indicted by the fact that expiration is in the future (i.e. subscribed or registered) or in the past or zero (i.e. expired).
earlyDialogHandle- provided if still an early dialog or if the dialog just changed to an established dialog otherwise NULL
dialogHandle- provided if dialog is established otherwise NULL
applicationData- pass back of application data provided upon adding SUBSCRIBE or REGISTRATION to be refreshed
responseCode- SIP response code 200-299 Success, > 300 failure Has no meaning if subscribeResponse is NULL NOTE: a failure code does not mean that the subscription or registration has expired. The previous SUBSCRIBE or REGISTER may have succeeded and may not have expired yet.
responseText- SIP response text. NULL if subscribeResponse is NULL
expiration- epoch time in seconds when expiration of subscription or registration will occur. A value of zero indicates that a unSUBSCRIBE or unREGISTER occurred and that it has expired and that no further attempts will be made to reSUBSCRIBE or reREGISTER. Usual zero indicates that the application stopped the refresh. A value of -1 indicates that no requests have succeeded yet. A value greater than zero and less than the current epoch time indicates the SUBSCRIBE or REGISTER has expired most likely because of a request failure.
subscribeResponse- SIP SUBSCRIBE or REGISTER response which stimulated the state change. May be NULL.

Member Enumeration Documentation

Enumerator
REFRESH_REQUEST_UNKNOWN 
REFRESH_REQUEST_PENDING 
REFRESH_REQUEST_FAILED 
REFRESH_REQUEST_SUCCEEDED 

Constructor & Destructor Documentation

SipRefreshManager ( SipUserAgent userAgent,
SipDialogMgr dialogMgr 
)

Default Dialog constructor.

~SipRefreshManager ( )
virtual

Destructor.

Member Function Documentation

UtlBoolean initiateRefresh ( SipMessage subscribeOrRegisterRequest,
void *  applicationData,
const RefreshStateCallback  refreshStateCallback,
UtlString &  earlyDialogHandle 
)

Send message and keep request refreshed (i.e. subscribed or registered)

Returns TRUE if the request was sent and the refresh state proceeded to REFRESH_INITIATED. Returns FALSE if the request was not able to be sent, the refresh state is set to REFRESH_FAILED. The caller of this method must explicitly call stopRefresh to clean up the refresh state even if this method fails. This method may fail if the dialog or refresh state already exists or if the request immediately fails to send. The refresh manager will attempt to resend the request to subscribe or register even if it fails the first time while this method is invoked. The theory is that it may have failed due to a provisioning race condition or a temporary network problem.

UtlBoolean stopRefresh ( const char *  dialogHandle)

End the SIP refresh (registration or subscription) indicated by.

the dialog handle. If the given dialogHandle is an early dialog it will end any established or early dialog subscriptions. Typically the application SHOULD use the established dialog handle. This method can also be used to end one of the dialogs if multiple subscription dialogs were created as a result of a single subscribe request. The application will get multiple REFRESH_SETUP RefreshStateCallback events when multiple dialogs are created as a result of a single SUBSCRIBE. To end one of the subscriptions the application should use the setup dialogHandle provided by the SubscriptionStateCallback. Only a single registration can occur as a result of sending a REGISTER request.

void stopAllRefreshes ( )

Stop refreshing, unregister and unsubscribe all.

UtlBoolean handleMessage ( OsMsg &  eventMessage)

Handler for SUBSCRIBE and REGISTER responses.

int dumpRefreshStates ( UtlString &  dumpString)

Debugging method to get an dump of all refresh states.

void refreshState2String ( RefreshRequestState  state,
UtlString &  stateString 
)
static

Get a string representation of the refresh state enumeration.

int countRefreshSessions ( ) const

Get a count of the subscriptions and registration which have been added.

void lock ( )
protected

lock for single thread use

void unlock ( )
protected

lock for single thread use


sipXtackLib home page