sipxtacklib  Version 3.3
Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | List of all members
SipRefreshMgr Class Reference

#include <SipRefreshMgr.h>

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

Public Member Functions

UtlBoolean init (SipUserAgent *ptrToMyAgent, int sipTcpPort=SIP_PORT, int sipUdpPort=SIP_PORT, const char *defaultUser=NULL, const char *publicAddress=NULL, const char *defaultSipAddress=NULL, const char *sipDirectoryServers=NULL, const char *sipRegistryServers=NULL, int defaultRegistryTimeout=3600, int defaultSubscribeTimeout=60 *60 *24, int restartCount=1, const char *macAddress=NULL)
 
void StartRefreshMgr ()
 
void setRegistryPeriod (const int periodInSeconds)
 Mutator for the mDefaultRegistryPeriodMember. More...
 
void setSubscribeTimeout (const int periodInSeconds)
 Mutator for the mDefaultSubscribePeriodMember. More...
 
const int getSubscribeTimeout ()
 Accessor for the mDefaultSubscribePeriodMember. More...
 
void addMessageConsumer (OsServerTask *messageEventListener)
 
void addMessageObserver (OsMsgQ &messageQueue, const char *sipMethod=NULL, UtlBoolean wantRequests=TRUE, UtlBoolean wantResponses=TRUE, UtlBoolean wantIncoming=TRUE, UtlBoolean wantOutGoing=FALSE, const char *eventName=NULL, void *observerData=NULL)
 
UtlBoolean newRegisterMsg (const Url &fromUrl, const UtlString &lineId, int registryPeriodSeconds=-1, Url *pPreferredContactUri=NULL)
 param: messageQueue - the queue on which an SipMessageEvent is dispatched param: sipMethod - the specific method type of the requests or responses to be observed. NULL or a null string indicates all methods. param: wantRequests - want to observe SIP requests param: wantResponses - want to observe SIP responses param: wantIncoming - want to observe SIP messages originating from the network. param: wantOutGoing - want to observe SIP messages originating from locally. param: eventName - want to observer SUBSCRIBE or NOTIFY requests having the given event type param: observerData - data to be attached to SIP messages queued on the observer More...
 
void reRegisterAll ()
 
void reRegister (const Url &fromUrl)
 
void unRegisterUser (const Url &fromUrl, const UtlBoolean &onStartup=FALSE, const UtlString &lineid="")
 
void reSubscribeAll ()
 
void unSubscribeAll ()
 
void setLineMgr (SipLineMgr *const lineMgr)
 
SipLineMgr *const getLineMgr () const
 
UtlBoolean newSubscribeMsg (SipMessage &message)
 
 SipRefreshMgr ()
 
void dumpMessageLists (UtlString &results)
 
virtual ~SipRefreshMgr ()
 
virtual UtlBoolean handleMessage (OsMsg &eventMessage)
 
UtlBoolean getNatMappedAddress (UtlString *pIpAddress, int *pPort)
 
void generateCallId (const UtlString &lineId, const UtlString &method, UtlString &callid, UtlBoolean onStartup=FALSE)
 

Protected Types

enum  RefreshMsgTypes {
  UNSPECIFIED = 0,
  START_REFRESH_MGR
}
 

Protected Member Functions

UtlBoolean isUAStarted ()
 
void waitForUA ()
 
void queueMessageToObservers (SipMessageEvent &event, const char *method)
 
void getFromAddress (UtlString *address, int *port, UtlString *protocol)
 
void rescheduleAfterTime (SipMessage *message, int percentage=DEFAULT_PERCENTAGE_TIMEOUT)
 
void sendToObservers (const OsMsg &eventMessage, SipMessage *registerRequest)
 
OsStatus sendRequest (SipMessage &registerRequest, const char *method)
 
void rescheduleRequest (SipMessage *registerRequest, int secondsFromNow, const char *method, int percentage=DEFAULT_PERCENTAGE_TIMEOUT, UtlBoolean sendImmediate=FALSE)
 
void processOKResponse (SipMessage *registerResponse, SipMessage *registerRequest)
 
void parseContactFields (SipMessage *message, SipMessage *sipRequest, int &expireVal)
 
void processResponse (const OsMsg &eventMessage, SipMessage *registerRequest)
 
void createTagNameValuePair (UtlString &tagNamevaluePair)
 
void registerUrl (const char *registerFromAddress, const char *registerToAddress, const char *registerUri, const char *contactUrl, const UtlString &registerCallId, int registerPeriod=-1)
 
UtlBoolean isDuplicateRegister (const Url &url, SipMessage &oldMessage)
 
UtlBoolean isDuplicateRegister (const Url &url)
 
void addToRegisterList (SipMessage *message)
 
UtlBoolean removeFromRegisterList (SipMessage *message)
 
void addToSubscribeList (SipMessage *message)
 
UtlBoolean removeFromSubscribeList (SipMessage *message)
 
UtlBoolean isDuplicateSubscribe (const Url &url)
 
UtlBoolean isDuplicateSubscribe (const Url &fromUrl, SipMessage &oldMsg)
 
void getContactField (const Url &registerToField, UtlString &contact, const UtlString &lineId="", Url *pPreferredContactUri=NULL)
 
void removeAllFromRequestList (SipMessage *response)
 
void removeAllFromRequestList (SipMessage *response, SipMessageList *pRequestList)
 
UtlBoolean isExpiresZero (SipMessage *pRequest)
 
void fireSipXLineEvent (const Url &url, const UtlString &lineId, const SIPX_LINESTATE_EVENT event, const SIPX_LINESTATE_CAUSE cause, const char *bodyBytes=NULL)
 
SIPX_LINESTATE_EVENT getLastLineEvent (const UtlString &lineId)
 
void setLastLineEvent (const UtlString &lineId, const SIPX_LINESTATE_EVENT eMajor)
 

Protected Attributes

SipLineMgrmpLineMgr
 
UtlHashMap * mpLastLineEventMap
 
int mDefaultRegistryPeriod
 
SipMessageList mRegisterList
 
OsRWMutex mRegisterListMutexR
 
OsRWMutex mRegisterListMutexW
 
UtlString mRegistryServer
 
int mDefaultSubscribePeriod
 
SipMessageList mSubscribeList
 
OsRWMutex mSubscribeListMutexR
 
OsRWMutex mSubscribeListMutexW
 
UtlBoolean mIsStarted
 
UtlHashBag mMessageObservers
 
OsRWMutex mObserverMutex
 
OsMutex mUAReadyMutex
 
UtlString mContactAddress
 
UtlString mDefaultSipAddress
 
UtlString mSipIpAddress
 
UtlString mDefaultUser
 
UtlString mMacAddress
 
UtlString mRestartCountStr
 
SipUserAgentmMyUserAgent
 
int mTcpPort
 
int mUdpPort
 
int mRestartCount
 
UtlRandom mRandomNumGenerator
 
UtlHashBag mTimerBag
 

Member Enumeration Documentation

enum RefreshMsgTypes
protected
Enumerator
UNSPECIFIED 
START_REFRESH_MGR 

Constructor & Destructor Documentation

~SipRefreshMgr ( )
virtual

Member Function Documentation

UtlBoolean init ( SipUserAgent ptrToMyAgent,
int  sipTcpPort = SIP_PORT,
int  sipUdpPort = SIP_PORT,
const char *  defaultUser = NULL,
const char *  publicAddress = NULL,
const char *  defaultSipAddress = NULL,
const char *  sipDirectoryServers = NULL,
const char *  sipRegistryServers = NULL,
int  defaultRegistryTimeout = 3600,
int  defaultSubscribeTimeout = 60*60*24,
int  restartCount = 1,
const char *  macAddress = NULL 
)
void StartRefreshMgr ( )
void setRegistryPeriod ( const int  periodInSeconds)

Mutator for the mDefaultRegistryPeriodMember.

void setSubscribeTimeout ( const int  periodInSeconds)

Mutator for the mDefaultSubscribePeriodMember.

const int getSubscribeTimeout ( )

Accessor for the mDefaultSubscribePeriodMember.

void addMessageConsumer ( OsServerTask *  messageEventListener)
void addMessageObserver ( OsMsgQ &  messageQueue,
const char *  sipMethod = NULL,
UtlBoolean  wantRequests = TRUE,
UtlBoolean  wantResponses = TRUE,
UtlBoolean  wantIncoming = TRUE,
UtlBoolean  wantOutGoing = FALSE,
const char *  eventName = NULL,
void *  observerData = NULL 
)
UtlBoolean newRegisterMsg ( const Url fromUrl,
const UtlString &  lineId,
int  registryPeriodSeconds = -1,
Url pPreferredContactUri = NULL 
)

param: messageQueue - the queue on which an SipMessageEvent is dispatched param: sipMethod - the specific method type of the requests or responses to be observed. NULL or a null string indicates all methods. param: wantRequests - want to observe SIP requests param: wantResponses - want to observe SIP responses param: wantIncoming - want to observe SIP messages originating from the network. param: wantOutGoing - want to observe SIP messages originating from locally. param: eventName - want to observer SUBSCRIBE or NOTIFY requests having the given event type param: observerData - data to be attached to SIP messages queued on the observer

void reRegisterAll ( )
void reRegister ( const Url fromUrl)
void unRegisterUser ( const Url fromUrl,
const UtlBoolean &  onStartup = FALSE,
const UtlString &  lineid = "" 
)
void reSubscribeAll ( )
void unSubscribeAll ( )
void setLineMgr ( SipLineMgr *const  lineMgr)
SipLineMgr *const getLineMgr ( ) const
UtlBoolean newSubscribeMsg ( SipMessage message)
void dumpMessageLists ( UtlString &  results)
UtlBoolean handleMessage ( OsMsg &  eventMessage)
virtual
UtlBoolean getNatMappedAddress ( UtlString *  pIpAddress,
int *  pPort 
)
void generateCallId ( const UtlString &  lineId,
const UtlString &  method,
UtlString &  callid,
UtlBoolean  onStartup = FALSE 
)
UtlBoolean isUAStarted ( )
protected
void waitForUA ( )
protected
void queueMessageToObservers ( SipMessageEvent event,
const char *  method 
)
protected
void getFromAddress ( UtlString *  address,
int *  port,
UtlString *  protocol 
)
protected
void rescheduleAfterTime ( SipMessage message,
int  percentage = DEFAULT_PERCENTAGE_TIMEOUT 
)
protected
void sendToObservers ( const OsMsg &  eventMessage,
SipMessage registerRequest 
)
protected
OsStatus sendRequest ( SipMessage registerRequest,
const char *  method 
)
protected
void rescheduleRequest ( SipMessage registerRequest,
int  secondsFromNow,
const char *  method,
int  percentage = DEFAULT_PERCENTAGE_TIMEOUT,
UtlBoolean  sendImmediate = FALSE 
)
protected
void processOKResponse ( SipMessage registerResponse,
SipMessage registerRequest 
)
protected
void parseContactFields ( SipMessage message,
SipMessage sipRequest,
int &  expireVal 
)
protected
void processResponse ( const OsMsg &  eventMessage,
SipMessage registerRequest 
)
protected
void createTagNameValuePair ( UtlString &  tagNamevaluePair)
protected
void registerUrl ( const char *  registerFromAddress,
const char *  registerToAddress,
const char *  registerUri,
const char *  contactUrl,
const UtlString &  registerCallId,
int  registerPeriod = -1 
)
protected
UtlBoolean isDuplicateRegister ( const Url url,
SipMessage oldMessage 
)
protected
UtlBoolean isDuplicateRegister ( const Url url)
protected
void addToRegisterList ( SipMessage message)
protected
UtlBoolean removeFromRegisterList ( SipMessage message)
protected
void addToSubscribeList ( SipMessage message)
protected
UtlBoolean removeFromSubscribeList ( SipMessage message)
protected
UtlBoolean isDuplicateSubscribe ( const Url url)
protected
UtlBoolean isDuplicateSubscribe ( const Url fromUrl,
SipMessage oldMsg 
)
protected
void getContactField ( const Url registerToField,
UtlString &  contact,
const UtlString &  lineId = "",
Url pPreferredContactUri = NULL 
)
protected
void removeAllFromRequestList ( SipMessage response)
protected
void removeAllFromRequestList ( SipMessage response,
SipMessageList pRequestList 
)
protected
UtlBoolean isExpiresZero ( SipMessage pRequest)
protected
void fireSipXLineEvent ( const Url url,
const UtlString &  lineId,
const SIPX_LINESTATE_EVENT  event,
const SIPX_LINESTATE_CAUSE  cause,
const char *  bodyBytes = NULL 
)
protected
SIPX_LINESTATE_EVENT getLastLineEvent ( const UtlString &  lineId)
protected
void setLastLineEvent ( const UtlString &  lineId,
const SIPX_LINESTATE_EVENT  eMajor 
)
protected

Member Data Documentation

SipLineMgr* mpLineMgr
protected
UtlHashMap* mpLastLineEventMap
protected
int mDefaultRegistryPeriod
protected
SipMessageList mRegisterList
protected
OsRWMutex mRegisterListMutexR
protected
OsRWMutex mRegisterListMutexW
protected
UtlString mRegistryServer
protected
int mDefaultSubscribePeriod
protected
SipMessageList mSubscribeList
protected
OsRWMutex mSubscribeListMutexR
protected
OsRWMutex mSubscribeListMutexW
protected
UtlBoolean mIsStarted
protected
UtlHashBag mMessageObservers
protected
OsRWMutex mObserverMutex
protected
OsMutex mUAReadyMutex
protected
UtlString mContactAddress
protected
UtlString mDefaultSipAddress
protected
UtlString mSipIpAddress
protected
UtlString mDefaultUser
protected
UtlString mMacAddress
protected
UtlString mRestartCountStr
protected
SipUserAgent* mMyUserAgent
protected
int mTcpPort
protected
int mUdpPort
protected
int mRestartCount
protected
UtlRandom mRandomNumGenerator
protected
UtlHashBag mTimerBag
protected

sipXtackLib home page