|
reSIProcate
SIP stack, Dialog Usage Manager and related libraries
|
This class is one of two main classes of concern to an application using the UserAgent library. More...
#include <UserAgent.hxx>
Public Types | |
| enum | LoggingSubsystem { SubsystemAll , SubsystemContents , SubsystemDns , SubsystemDum , SubsystemSdp , SubsystemSip , SubsystemTransaction , SubsystemTransport , SubsystemStats , SubsystemRecon , SubsystemFlowManager , SubsystemReTurn } |
Public Member Functions | |
| UserAgent (ConversationManager *conversationManager, std::shared_ptr< UserAgentMasterProfile > masterProfile, resip::AfterSocketCreationFuncPtr socketFunc=0) | |
| Constructor. | |
| virtual | ~UserAgent () |
| void | startup () |
| Starts the SIP stack thread. | |
| virtual void | process (int timeoutMs) |
| This should be called in a loop to give process cycles to the UserAgent. | |
| void | shutdown () |
| Used to initiate a shutdown of the useragent. | |
| void | logDnsCache () |
| Used to initiate a snapshot of the existing DNS entries in the cache to the logging subsystem. | |
| void | clearDnsCache () |
| Used to clear the existing DNS entries in the cache. | |
| ConversationManager * | getConversationManager () |
| Retrieves the ConversationManager passed in the constructor. | |
| ConversationProfileHandle | addConversationProfile (std::shared_ptr< ConversationProfile > conversationProfile, bool defaultOutgoing=true) |
| Adds a Conversation Profile to be managed, by the user agent. | |
| void | setDefaultOutgoingConversationProfile (ConversationProfileHandle handle) |
| Sets an existing Conversation Profile to the default profile to use for outbound calls. | |
| void | destroyConversationProfile (ConversationProfileHandle handle) |
| Destroys an existing Conversation Profile. | |
| virtual void | startApplicationTimer (unsigned int timerId, std::chrono::duration< double > duration, unsigned int seqNumber) |
| Used by an application to start a timer that is managed by the useragent. | |
| SubscriptionHandle | createSubscription (const resip::Data &eventType, const resip::NameAddr &target, unsigned int subscriptionTime, const resip::Mime &mimeType) |
| Requests that the user agent create and manage an event subscription. | |
| void | destroySubscription (SubscriptionHandle handle) |
| Destroys an existing subscriptions. | |
| PublicationHandle | createPublication (const resip::Data &eventType, const resip::NameAddr &target, const resip::Data &status, unsigned int publicationTime, const resip::Mime &mimeType) |
| void | destroyPublication (PublicationHandle handle) |
| virtual void | onApplicationTimer (unsigned int timerId, std::chrono::duration< double > duration, unsigned int seqNumber) |
| Callback used when an application timer expires. | |
| virtual void | onSubscriptionNotify (SubscriptionHandle handle, const resip::Data ¬ifyData) |
| Callback used when a subscription has received an event notification from the server. | |
| virtual void | onSubscriptionTerminated (SubscriptionHandle handle, unsigned int statusCode) |
| Callback used when a subscription is terminated. | |
| const char * | sendMessage (const resip::NameAddr &destination, const resip::Data &msg, const resip::Mime &mimeType) |
| Used to send a MESSAGE SIP message. | |
| std::shared_ptr< UserAgentMasterProfile > | getUserAgentMasterProfile () const noexcept |
Public Member Functions inherited from resip::ClientRegistrationHandler | |
| virtual | ~ClientRegistrationHandler () |
| virtual void | onFlowTerminated (ClientRegistrationHandle) |
| Called when a TCP or TLS flow to the server has terminated. | |
| virtual bool | onRefreshRequired (ClientRegistrationHandle, const SipMessage &lastRequest) |
| Called before attempting to refresh a registration Return true if the refresh should go ahead or false otherwise Default implementation always returns true. | |
Public Member Functions inherited from resip::ClientSubscriptionHandler | |
| virtual | ~ClientSubscriptionHandler () |
| virtual void | onReadyToSend (ClientSubscriptionHandle, SipMessage &msg) |
| called to allow app to adorn a message. | |
| virtual void | onNotifyNotReceived (ClientSubscriptionHandle) |
| virtual void | onFlowTerminated (ClientSubscriptionHandle) |
| Called when a TCP or TLS flow to the server has terminated. | |
Public Member Functions inherited from resip::ClientPublicationHandler | |
| virtual | ~ClientPublicationHandler () |
| virtual void | onStaleUpdate (ClientPublicationHandle, const SipMessage &) |
Public Member Functions inherited from resip::DumShutdownHandler | |
| virtual | ~DumShutdownHandler () |
Public Member Functions inherited from resip::Postable | |
| virtual | ~Postable () |
Static Public Member Functions | |
| static void | setLogLevel (resip::Log::Level level, LoggingSubsystem subsystem=SubsystemAll) |
| Static method that sets the logging level for a particular subsystem, or all subsystems. | |
Protected Types | |
| typedef std::map< SubscriptionHandle, UserAgentClientSubscription * > | SubscriptionMap |
| typedef std::map< PublicationHandle, UserAgentClientPublication * > | PublicationMap |
| typedef std::map< ConversationProfileHandle, std::shared_ptr< ConversationProfile > > | ConversationProfileMap |
| typedef std::map< ConversationProfileHandle, UserAgentRegistration * > | RegistrationMap |
This class is one of two main classes of concern to an application using the UserAgent library.
This class should be subclassed by the application and the UserAgent handlers should be implemented by it.
This class is responsible for handling tasks that are not directly related to managing the Conversations themselves. All conversation management is done via the ConversationManager class.
This class handles tasks such as:
Author: Scott Godin (sgodin AT SipSpectrum DOT com)
Definition at line 51 of file UserAgent.hxx.
|
protected |
Definition at line 371 of file UserAgent.hxx.
|
protected |
Definition at line 362 of file UserAgent.hxx.
|
protected |
Definition at line 379 of file UserAgent.hxx.
|
protected |
Definition at line 352 of file UserAgent.hxx.
| Enumerator | |
|---|---|
| SubsystemAll | |
| SubsystemContents | |
| SubsystemDns | |
| SubsystemDum | |
| SubsystemSdp | |
| SubsystemSip | |
| SubsystemTransaction | |
| SubsystemTransport | |
| SubsystemStats | |
| SubsystemRecon | |
| SubsystemFlowManager | |
| SubsystemReTurn | |
Definition at line 129 of file UserAgent.hxx.
| UserAgent::UserAgent | ( | ConversationManager * | conversationManager, |
| std::shared_ptr< UserAgentMasterProfile > | masterProfile, | ||
| resip::AfterSocketCreationFuncPtr | socketFunc = 0 |
||
| ) |
Constructor.
| conversationManager | Application subclassed Conversation Manager |
| masterProfile | Object containing useragent settings |
| socketFunc | A pointer to a function that will be called after a socket in the DNS or SIP transport layers of the stack has been created. This callback can be used to control low level socket options, such as Quality-of-Service/DSCP. Note: For SIP TCP sockets there is one call for the listen socket, and one (or two) calls for each connection created afterwards. For each inbound TCP connection the first callback is called immediately before the socket is connected, and if configured it is called again after the connect call has completed and before the first data is sent out. On some OS's you cannot set QOS until the socket is successfully connected. To enable this behavior call: Connection::setEnablePostConnectSocketFuncCall(); |
Definition at line 53 of file UserAgent.cxx.
|
virtual |
Definition at line 136 of file UserAgent.cxx.
| ConversationProfileHandle UserAgent::addConversationProfile | ( | std::shared_ptr< ConversationProfile > | conversationProfile, |
| bool | defaultOutgoing = true |
||
| ) |
Adds a Conversation Profile to be managed, by the user agent.
SIP Registration is performed, if required.
| conversationProfile | Profile to add |
| defaultOutgoing | Set to true to set this profile as the default profile to use for outbound calls. |
Definition at line 307 of file UserAgent.cxx.
|
protected |
Definition at line 622 of file UserAgent.cxx.
|
protected |
Definition at line 502 of file UserAgent.cxx.
| void UserAgent::clearDnsCache | ( | ) |
Used to clear the existing DNS entries in the cache.
Definition at line 244 of file UserAgent.cxx.
| PublicationHandle UserAgent::createPublication | ( | const resip::Data & | eventType, |
| const resip::NameAddr & | target, | ||
| const resip::Data & | status, | ||
| unsigned int | publicationTime, | ||
| const resip::Mime & | mimeType | ||
| ) |
Definition at line 346 of file UserAgent.cxx.
|
protected |
Definition at line 715 of file UserAgent.cxx.
| SubscriptionHandle UserAgent::createSubscription | ( | const resip::Data & | eventType, |
| const resip::NameAddr & | target, | ||
| unsigned int | subscriptionTime, | ||
| const resip::Mime & | mimeType | ||
| ) |
Requests that the user agent create and manage an event subscription.
When an subscribed event is received the onSubscriptionNotify callback is used. If the subscription is terminated by the server, the application or due to network failure the onSubscriptionTerminated callback is used.
Applications should override this UserAgent class and callbacks in order to use subscriptions.
| eventType | Event type we are subscribing to |
| target | A URI representing the location of the subscription server |
| subscriptionTime | Requested time that the subscription should stay active, before sending a refresh request is required. |
| mimeType | The mime type of event body expected |
Definition at line 330 of file UserAgent.cxx.
|
protected |
Definition at line 687 of file UserAgent.cxx.
| void UserAgent::destroyConversationProfile | ( | ConversationProfileHandle | handle | ) |
Destroys an existing Conversation Profile.
SIP un-registration is performed, if required.
| handle | ConversationProfile handle to use |
Definition at line 323 of file UserAgent.cxx.
|
protected |
Definition at line 659 of file UserAgent.cxx.
| void UserAgent::destroyPublication | ( | PublicationHandle | handle | ) |
Definition at line 356 of file UserAgent.cxx.
|
protected |
Definition at line 774 of file UserAgent.cxx.
| void UserAgent::destroySubscription | ( | SubscriptionHandle | handle | ) |
Destroys an existing subscriptions.
Unsubscribe request is sent, if required.
| handle | Subscription handle to destroy |
Definition at line 339 of file UserAgent.cxx.
|
protected |
Definition at line 705 of file UserAgent.cxx.
| ConversationManager * UserAgent::getConversationManager | ( | ) |
Retrieves the ConversationManager passed in the constructor.
Definition at line 466 of file UserAgent.cxx.
|
protected |
Definition at line 378 of file UserAgent.cxx.
|
protected |
Definition at line 363 of file UserAgent.cxx.
|
protected |
Definition at line 460 of file UserAgent.cxx.
|
protectedvirtual |
Definition at line 395 of file UserAgent.cxx.
|
protected |
Definition at line 186 of file UserAgent.cxx.
|
protected |
Definition at line 167 of file UserAgent.cxx.
|
protected |
Definition at line 148 of file UserAgent.cxx.
|
inlineprotected |
Definition at line 280 of file UserAgent.hxx.
|
noexcept |
Definition at line 454 of file UserAgent.cxx.
| void UserAgent::logDnsCache | ( | ) |
Used to initiate a snapshot of the existing DNS entries in the cache to the logging subsystem.
Definition at line 238 of file UserAgent.cxx.
|
virtual |
Callback used when an application timer expires.
| timerId | Id representing the timers purpose |
| duration | the duration of the timer in ms |
| seqNumber | Can be used by the application to differentiate "active" from "non-active" timers, since timers cannot be stopped |
Reimplemented in mohparkserver::MyUserAgent.
Definition at line 577 of file UserAgent.cxx.
|
protectedvirtual |
Implements resip::DumShutdownHandler.
Definition at line 472 of file UserAgent.cxx.
|
protectedvirtual |
Implements resip::ClientPublicationHandler.
Definition at line 871 of file UserAgent.cxx.
|
protectedvirtual |
Called if registration fails, usage will be destroyed (unless a Registration retry interval is enabled in the Profile)
Implements resip::ClientRegistrationHandler.
Definition at line 793 of file UserAgent.cxx.
|
protectedvirtual |
Implements resip::ClientSubscriptionHandler.
Definition at line 838 of file UserAgent.cxx.
|
protectedvirtual |
Implements resip::ClientPublicationHandler.
Definition at line 859 of file UserAgent.cxx.
|
protectedvirtual |
Implements resip::ClientRegistrationHandler.
Definition at line 799 of file UserAgent.cxx.
|
protectedvirtual |
call on Retry-After failure.
return values: -1 = fail, 0 = retry immediately, N = retry in N seconds
Implements resip::ClientPublicationHandler.
Definition at line 865 of file UserAgent.cxx.
|
protectedvirtual |
call on Retry-After failure.
return values: -1 = fail, 0 = retry immediately, N = retry in N seconds
Implements resip::ClientRegistrationHandler.
Definition at line 805 of file UserAgent.cxx.
|
protectedvirtual |
Implements resip::ClientSubscriptionHandler.
Definition at line 844 of file UserAgent.cxx.
|
virtual |
Callback used when a subscription has received an event notification from the server.
| handle | Subscription handle that event applies to |
| notifyData | Data representation of the event received |
Reimplemented in mohparkserver::MyUserAgent.
Definition at line 589 of file UserAgent.cxx.
|
virtual |
Callback used when a subscription is terminated.
| handle | Subscription handle that terminated |
| statusCode | The status code that caused termination. If application terminated, then statusCode will be 0. |
Reimplemented in mohparkserver::MyUserAgent.
Definition at line 583 of file UserAgent.cxx.
|
protectedvirtual |
Called when the publication succeeds or each time it is successfully refreshed.
Implements resip::ClientPublicationHandler.
Definition at line 853 of file UserAgent.cxx.
|
protectedvirtual |
Called when registration succeeds or each time it is successfully refreshed (manual refreshes only).
Implements resip::ClientRegistrationHandler.
Definition at line 787 of file UserAgent.cxx.
|
protectedvirtual |
Implements resip::ClientSubscriptionHandler.
Definition at line 832 of file UserAgent.cxx.
|
protectedvirtual |
Implements resip::ClientSubscriptionHandler.
Definition at line 820 of file UserAgent.cxx.
|
protectedvirtual |
Implements resip::ClientSubscriptionHandler.
Definition at line 826 of file UserAgent.cxx.
|
protectedvirtual |
Implements resip::ClientSubscriptionHandler.
Definition at line 814 of file UserAgent.cxx.
|
protected |
Definition at line 250 of file UserAgent.cxx.
|
protectedvirtual |
Implements resip::Postable.
Definition at line 479 of file UserAgent.cxx.
This should be called in a loop to give process cycles to the UserAgent.
| timeoutMs | Will return after timeoutMs if nothing to do. Application can do some work, but should call process again ASAP. |
Definition at line 205 of file UserAgent.cxx.
|
protected |
Definition at line 174 of file UserAgent.cxx.
|
protected |
Definition at line 193 of file UserAgent.cxx.
|
protected |
Definition at line 155 of file UserAgent.cxx.
| const char * recon::UserAgent::sendMessage | ( | const resip::NameAddr & | destination, |
| const resip::Data & | msg, | ||
| const resip::Mime & | mimeType | ||
| ) |
Used to send a MESSAGE SIP message.
| void UserAgent::setDefaultOutgoingConversationProfile | ( | ConversationProfileHandle | handle | ) |
Sets an existing Conversation Profile to the default profile to use for outbound calls.
| handle | ConversationProfile handle to use |
Definition at line 316 of file UserAgent.cxx.
|
protected |
Definition at line 653 of file UserAgent.cxx.
|
static |
Static method that sets the logging level for a particular subsystem, or all subsystems.
| level | Logging level to set |
| subsystem | Subsystem to set level on |
Definition at line 263 of file UserAgent.cxx.
| void UserAgent::shutdown | ( | ) |
Used to initiate a shutdown of the useragent.
This function blocks until the shutdown is complete.
Definition at line 212 of file UserAgent.cxx.
|
protected |
Definition at line 595 of file UserAgent.cxx.
|
virtual |
Used by an application to start a timer that is managed by the useragent.
When the timer expires the onApplicationTimer callback will be called.
Applications should override this UserAgent class and callback in order to use application timers.
| timerId | Id representing the timers purpose |
| duration | the duration of the timer in ms |
| seqNumber | Can be used by the application to differentiate "active" from "non-active" timers, since timers cannot be stopped |
Definition at line 570 of file UserAgent.cxx.
| void UserAgent::startup | ( | ) |
Starts the SIP stack thread.
Definition at line 142 of file UserAgent.cxx.
|
protected |
Definition at line 180 of file UserAgent.cxx.
|
protected |
Definition at line 199 of file UserAgent.cxx.
|
protected |
Definition at line 161 of file UserAgent.cxx.
|
friend |
Definition at line 318 of file UserAgent.hxx.
|
friend |
Definition at line 315 of file UserAgent.hxx.
|
friend |
Definition at line 324 of file UserAgent.hxx.
|
friend |
Definition at line 321 of file UserAgent.hxx.
|
friend |
Definition at line 334 of file UserAgent.hxx.
Definition at line 320 of file UserAgent.hxx.
|
friend |
Definition at line 325 of file UserAgent.hxx.
|
friend |
Definition at line 322 of file UserAgent.hxx.
|
friend |
Definition at line 323 of file UserAgent.hxx.
|
friend |
Definition at line 331 of file UserAgent.hxx.
Definition at line 333 of file UserAgent.hxx.
Definition at line 337 of file UserAgent.hxx.
|
friend |
Definition at line 330 of file UserAgent.hxx.
Definition at line 335 of file UserAgent.hxx.
Definition at line 319 of file UserAgent.hxx.
|
friend |
Definition at line 316 of file UserAgent.hxx.
|
friend |
Definition at line 332 of file UserAgent.hxx.
Definition at line 336 of file UserAgent.hxx.
Definition at line 361 of file UserAgent.hxx.
Definition at line 351 of file UserAgent.hxx.
|
friend |
Definition at line 378 of file UserAgent.hxx.
Definition at line 329 of file UserAgent.hxx.
|
friend |
Definition at line 317 of file UserAgent.hxx.
|
protected |
Definition at line 384 of file UserAgent.hxx.
|
protected |
Definition at line 373 of file UserAgent.hxx.
|
protected |
Definition at line 372 of file UserAgent.hxx.
|
protected |
Definition at line 374 of file UserAgent.hxx.
|
protected |
Definition at line 365 of file UserAgent.hxx.
|
protected |
Definition at line 355 of file UserAgent.hxx.
|
protected |
Definition at line 375 of file UserAgent.hxx.
|
protected |
Definition at line 390 of file UserAgent.hxx.
Definition at line 392 of file UserAgent.hxx.
|
protected |
Definition at line 388 of file UserAgent.hxx.
|
protected |
Definition at line 387 of file UserAgent.hxx.
|
protected |
Definition at line 385 of file UserAgent.hxx.
|
protected |
Definition at line 364 of file UserAgent.hxx.
|
protected |
Definition at line 363 of file UserAgent.hxx.
|
protected |
Definition at line 380 of file UserAgent.hxx.
|
protected |
Definition at line 386 of file UserAgent.hxx.
|
protected |
Definition at line 389 of file UserAgent.hxx.
|
protected |
Definition at line 391 of file UserAgent.hxx.
|
protected |
Definition at line 354 of file UserAgent.hxx.
|
protected |
Definition at line 353 of file UserAgent.hxx.
Definition at line 393 of file UserAgent.hxx.