sipxtacklib  Version 3.3
Public Member Functions | Protected Member Functions | Static Protected Member Functions | Friends | List of all members
SipDialogMonitor Class Reference

A SipDialogMonitor object monitors the on/off hook status of all the SIP user agents for a set of URIs by subscribing to dialog events for the URIs and processing the resulting dialog events. More...

#include <SipDialogMonitor.h>

Public Member Functions

 SipDialogMonitor (SipUserAgent *userAgent, UtlString &domainName, int hostPort, int refreshTimeout, bool toBePublished)
 option to publish for other subscriptions More...
 
virtual ~SipDialogMonitor ()
 
bool addExtension (UtlString &groupName, Url &contactUrl)
 URIs are added and deleted from groups, which are identified by names. More...
 
bool removeExtension (UtlString &groupName, Url &contactUrl)
 Remove a URI from a group to be monitored. More...
 
void addStateChangeNotifier (const char *listUri, StateChangeNotifier *notifier)
 Register a StateChangeNotifier. More...
 
void removeStateChangeNotifier (const char *listUri)
 Unregister a StateChangeNotifier. More...
 

Protected Member Functions

void addDialogEvent (UtlString &contact, SipDialogEvent *dialogEvent, const char *earlyDialogHandle, const char *dialogHandle)
 Add 'dialogEvent' as the last dialog event for AOR 'contact'. More...
 
void publishContent (UtlString &contact, SipDialogEvent *dialogEvent)
 Publish the dialog event package to the resource list. More...
 
void notifyStateChange (UtlString &contact, StateChangeNotifier::Status)
 Send the state change to the notifier. More...
 
void handleNotifyMessage (const SipMessage *notifyMessage, const char *earlyDialogHandle, const char *dialogHandle)
 Non-static callback to handle incoming NOTIFYs. More...
 
StateChangeNotifier::Status mergeEventInformation (SipDialogEvent *dialogEvent, const char *earlyDialogHandle, const char *dialogHandle)
 Merge information from a dialogEvent into mDialogState. More...
 
void createDialogState (UtlString *earlyDialogHandle)
 Create the dialog event state record for the SUBSCRIBE earlyDialogHandle. More...
 
void destroyDialogState (UtlString *earlyDialogHandle)
 Delete the dialog event state record for the SUBSCRIBE earlyDialogHandle. More...
 

Static Protected Member Functions

static void subscriptionStateCallback (SipSubscribeClient::SubscriptionState newState, const char *earlyDialogHandle, const char *dialogHandle, void *applicationData, int responseCode, const char *responseText, long expiration, const SipMessage *subscribeResponse)
 Callback to handle notification of changes in the states of subscriptions. More...
 
static void notifyEventCallback (const char *earlyDialogHandle, const char *dialogHandle, void *applicationData, const SipMessage *notifyRequest)
 Callback to handle incoming NOTIFYs. More...
 

Friends

class SipDialogMonitorTest
 

Detailed Description

A SipDialogMonitor object monitors the on/off hook status of all the SIP user agents for a set of URIs by subscribing to dialog events for the URIs and processing the resulting dialog events.

The URI is considered to be off-hook if there are any active dialogs (dialogs with state != 'terminated') on any of the UAs that send NOTIFYs in response to a SUBSCRIBE to the URI.

When status is updated, the information will be reported to all the notifiers that have been registered using addStateChangeNotifier.

Also, if toBePublished (mToBePublished) is set, the dialog status of any groups of URIs containing the URI that has changed will be published to any subscribers via a SipPublishContentMgr. (This is not completely implemented.)

Constructor & Destructor Documentation

SipDialogMonitor ( SipUserAgent userAgent,
UtlString &  domainName,
int  hostPort,
int  refreshTimeout,
bool  toBePublished 
)

option to publish for other subscriptions

Parameters
userAgentSip user agent for sending out SUBSCRIBEs and receiving NOTIFYs
domainNamesipX domain name
hostPortHost port
refreshTimeoutrefresh timeout for SUBSCRIBEs
~SipDialogMonitor ( )
virtual

Member Function Documentation

bool addExtension ( UtlString &  groupName,
Url contactUrl 
)

URIs are added and deleted from groups, which are identified by names.

Each group has independent membership, and they may overlap (which results in multiple subscriptions to that URI). Groups are not evident in the events presented to notifiers (except that a URI in multiple groups will be reported to a notifier multiply), but they are central to published status, as the groups are the "resource lists" which this object will be a subscription server for.

Note: Groups should not overlap, as mDialogHandleList is indexed by AOR only, and not group-and-AOR.Add a URI to a group to be monitored

bool removeExtension ( UtlString &  groupName,
Url contactUrl 
)

Remove a URI from a group to be monitored.

void addStateChangeNotifier ( const char *  listUri,
StateChangeNotifier notifier 
)

Register a StateChangeNotifier.

void removeStateChangeNotifier ( const char *  listUri)

Unregister a StateChangeNotifier.

void addDialogEvent ( UtlString &  contact,
SipDialogEvent dialogEvent,
const char *  earlyDialogHandle,
const char *  dialogHandle 
)
protected

Add 'dialogEvent' as the last dialog event for AOR 'contact'.

void publishContent ( UtlString &  contact,
SipDialogEvent dialogEvent 
)
protected

Publish the dialog event package to the resource list.

void notifyStateChange ( UtlString &  contact,
StateChangeNotifier::Status  status 
)
protected

Send the state change to the notifier.

void subscriptionStateCallback ( SipSubscribeClient::SubscriptionState  newState,
const char *  earlyDialogHandle,
const char *  dialogHandle,
void *  applicationData,
int  responseCode,
const char *  responseText,
long  expiration,
const SipMessage subscribeResponse 
)
staticprotected

Callback to handle notification of changes in the states of subscriptions.

void notifyEventCallback ( const char *  earlyDialogHandle,
const char *  dialogHandle,
void *  applicationData,
const SipMessage notifyRequest 
)
staticprotected

Callback to handle incoming NOTIFYs.

void handleNotifyMessage ( const SipMessage notifyMessage,
const char *  earlyDialogHandle,
const char *  dialogHandle 
)
protected

Non-static callback to handle incoming NOTIFYs.

StateChangeNotifier::Status mergeEventInformation ( SipDialogEvent dialogEvent,
const char *  earlyDialogHandle,
const char *  dialogHandle 
)
protected

Merge information from a dialogEvent into mDialogState.

void createDialogState ( UtlString *  earlyDialogHandle)
protected

Create the dialog event state record for the SUBSCRIBE earlyDialogHandle.

void destroyDialogState ( UtlString *  earlyDialogHandle)
protected

Delete the dialog event state record for the SUBSCRIBE earlyDialogHandle.

Friends And Related Function Documentation

friend class SipDialogMonitorTest
friend

sipXtackLib home page