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

Class for containing SIP dialog state information. More...

#include <SipSubscribeClient.h>

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

Public Types

enum  SubscriptionState {
  SUBSCRIPTION_UNKNOWN,
  SUBSCRIPTION_INITIATED,
  SUBSCRIPTION_SETUP,
  SUBSCRIPTION_FAILED,
  SUBSCRIPTION_TERMINATED
}
 
typedef void(* SubscriptionStateCallback) (SipSubscribeClient::SubscriptionState newState, const char *earlyDialogHandle, const char *dialogHandle, void *applicationData, int responseCode, const char *responseText, long expiration, const SipMessage *subscribeResponse)
 
typedef void(* NotifyEventCallback) (const char *earlyDialogHandle, const char *dialogHandle, void *applicationData, const SipMessage *notifyRequest)
 

Public Member Functions

 SipSubscribeClient (SipUserAgent &userAgent, SipDialogMgr &dialogMgr, SipRefreshManager &refreshMgr)
 Default Dialog constructor. More...
 
virtual ~SipSubscribeClient ()
 Destructor. More...
 
UtlBoolean addSubscription (const char *resourceId, const char *eventHeaderValue, const char *acceptHeaderValue, const char *fromFieldValue, const char *toFieldValue, const char *contactFieldValue, int subscriptionPeriodSeconds, void *applicationData, const SubscriptionStateCallback subscriptionStateCallback, const NotifyEventCallback notifyEventsCallback, UtlString &earlyDialogHandle)
 Create a SIP event subscription for the given SUBSCRIBE header information. More...
 
UtlBoolean addSubscription (SipMessage &subscriptionRequest, void *applicationData, const SubscriptionStateCallback subscriptionStateCallback, const NotifyEventCallback notifyEventsCallback, UtlString &earlyDialogHandle)
 Create a SIP event subscription for the given SUBSCRIBE request. More...
 
UtlBoolean endSubscription (const char *dialogHandle)
 End the SIP event subscription indicated by the dialog handle. More...
 
void endAllSubscriptions ()
 End all subscriptions. More...
 
UtlBoolean handleMessage (OsMsg &eventMessage)
 Handler for NOTIFY requests. More...
 
int dumpStates (UtlString &dumpString)
 Create a debug dump of all the client states. More...
 
int countSubscriptions ()
 Get a count of the subscriptions which have been added. More...
 

Static Public Member Functions

static SipSubscribeClientbuildBasicClient (SipUserAgent &userAgent)
 Create a SipDialogMgr, SipRefreshManager and construct a SipSubscribeClient. More...
 
static void getSubscriptionStateEnumString (enum SubscriptionState stateValue, UtlString &stateString)
 Get a string representation of the client state enumeration. More...
 

Detailed Description

Class for containing SIP dialog state information.

In SIP a dialog is defined by the SIP Call-Id header and the tag parameter from the SIP To and From header fields. An early dialog has has only the tag set on one side, the transaction originator side. In the initial transaction the the originator tag in in the From header field. The final destination sets the To header field tag in the initial transaction.

Local and Remote
As the To and From fields get swapped depending upon which side initiates a transaction (i.e. sends a request) local and remote are used in SipDialog to label tags, fields and information. Local and Remote are unabiquous when used in an end point. In a proxy context the SipDialog can still be used. One can visualize the sides of the dialog by thinking Left and Right instead of local and remote.

Member Typedef Documentation

typedef void(* SubscriptionStateCallback) (SipSubscribeClient::SubscriptionState newState, const char *earlyDialogHandle, const char *dialogHandle, void *applicationData, int responseCode, const char *responseText, long expiration, const SipMessage *subscribeResponse)
typedef void(* NotifyEventCallback) (const char *earlyDialogHandle,const char *dialogHandle,void *applicationData, const SipMessage *notifyRequest)

Member Enumeration Documentation

Enumerator
SUBSCRIPTION_UNKNOWN 
SUBSCRIPTION_INITIATED 
SUBSCRIPTION_SETUP 
SUBSCRIPTION_FAILED 
SUBSCRIPTION_TERMINATED 

Constructor & Destructor Documentation

SipSubscribeClient ( SipUserAgent userAgent,
SipDialogMgr dialogMgr,
SipRefreshManager refreshMgr 
)

Default Dialog constructor.

~SipSubscribeClient ( )
virtual

Destructor.

Member Function Documentation

SipSubscribeClient * buildBasicClient ( SipUserAgent userAgent)
static
UtlBoolean addSubscription ( const char *  resourceId,
const char *  eventHeaderValue,
const char *  acceptHeaderValue,
const char *  fromFieldValue,
const char *  toFieldValue,
const char *  contactFieldValue,
int  subscriptionPeriodSeconds,
void *  applicationData,
const SubscriptionStateCallback  subscriptionStateCallback,
const NotifyEventCallback  notifyEventsCallback,
UtlString &  earlyDialogHandle 
)

Create a SIP event subscription for the given SUBSCRIBE header information.

Returns TRUE if the SUBSCRIBE request was sent and the Subscription state proceeded to SUBSCRIPTION_INITIATED. Returns FALSE if the SUBSCRIBE request was not able to be sent, the subscription state is set to SUSCRIPTION_FAILED.

UtlBoolean addSubscription ( SipMessage subscriptionRequest,
void *  applicationData,
const SubscriptionStateCallback  subscriptionStateCallback,
const NotifyEventCallback  notifyEventsCallback,
UtlString &  earlyDialogHandle 
)

Create a SIP event subscription for the given SUBSCRIBE request.

Returns TRUE if the SUBSCRIBE request was sent and the Subscription state proceeded to SUBSCRIPTION_INITIATED. Returns FALSE if the SUBSCRIBE request was not able to be sent, the subscription state is set to SUSCRIPTION_FAILED.

UtlBoolean endSubscription ( const char *  dialogHandle)

End the SIP event 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 subsription dialogs were created as a result of a single subscribe request. The application will get multiple SUBSCRIPTION_SETUP SubscriptionStateCallback 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.

void endAllSubscriptions ( )

End all subscriptions.

UtlBoolean handleMessage ( OsMsg &  eventMessage)

Handler for NOTIFY requests.

int dumpStates ( UtlString &  dumpString)

Create a debug dump of all the client states.

void getSubscriptionStateEnumString ( enum SubscriptionState  stateValue,
UtlString &  stateString 
)
static

Get a string representation of the client state enumeration.

int countSubscriptions ( )

Get a count of the subscriptions which have been added.


sipXtackLib home page