|
reSIProcate/DialogUsageManager
9694
|
#include <basicClientUserAgent.hxx>


Public Member Functions | |
| BasicClientUserAgent (int argc, char **argv) | |
| virtual | ~BasicClientUserAgent () |
| virtual void | startup () |
| virtual void | shutdown () |
| bool | process (int timeoutMs) |
| DialogUsageManager & | getDialogUsageManager () |
| SharedPtr< UserProfile > | getIncomingUserProfile (const SipMessage &msg) |
Protected Member Functions | |
| virtual void | post (Message *) |
| void | onDumCanBeDeleted () |
| virtual void | onSuccess (resip::ClientRegistrationHandle h, const resip::SipMessage &response) |
| Called when registraion succeeds or each time it is sucessfully refreshed. | |
| virtual void | onFailure (resip::ClientRegistrationHandle h, const resip::SipMessage &response) |
| Called if registration fails, usage will be destroyed (unless a Registration retry interval is enabled in the Profile) | |
| virtual void | onRemoved (resip::ClientRegistrationHandle h, const resip::SipMessage &response) |
| virtual int | onRequestRetry (resip::ClientRegistrationHandle h, int retryMinimum, const resip::SipMessage &msg) |
| call on Retry-After failure. | |
| virtual void | onUpdatePending (resip::ClientSubscriptionHandle h, const resip::SipMessage ¬ify, bool outOfOrder) |
| virtual void | onUpdateActive (resip::ClientSubscriptionHandle h, const resip::SipMessage ¬ify, bool outOfOrder) |
| virtual void | onUpdateExtension (resip::ClientSubscriptionHandle, const resip::SipMessage ¬ify, bool outOfOrder) |
| virtual void | onNotifyNotReceived (ClientSubscriptionHandle h) |
| virtual void | onTerminated (resip::ClientSubscriptionHandle h, const resip::SipMessage *notify) |
| virtual void | onNewSubscription (resip::ClientSubscriptionHandle h, const resip::SipMessage ¬ify) |
| virtual int | onRequestRetry (resip::ClientSubscriptionHandle h, int retrySeconds, const resip::SipMessage ¬ify) |
| virtual void | onNewSession (resip::ClientInviteSessionHandle h, resip::InviteSession::OfferAnswerType oat, const resip::SipMessage &msg) |
| called when an initial INVITE or the intial response to an outoing invite | |
| virtual void | onNewSession (resip::ServerInviteSessionHandle h, resip::InviteSession::OfferAnswerType oat, const resip::SipMessage &msg) |
| called when an initial INVITE or the intial response to an outoing invite | |
| virtual void | onFailure (resip::ClientInviteSessionHandle h, const resip::SipMessage &msg) |
| Received a failure response from UAS. | |
| virtual void | onEarlyMedia (resip::ClientInviteSessionHandle, const resip::SipMessage &, const resip::SdpContents &) |
| called when an in-dialog provisional response is received that contains a body | |
| virtual void | onProvisional (resip::ClientInviteSessionHandle, const resip::SipMessage &msg) |
| called when dialog enters the Early state - typically after getting 18x | |
| virtual void | onConnected (resip::ClientInviteSessionHandle h, const resip::SipMessage &msg) |
| called when a dialog initiated as a UAC enters the connected state | |
| virtual void | onConnected (resip::InviteSessionHandle, const resip::SipMessage &msg) |
| called when a dialog initiated as a UAS enters the connected state | |
| virtual void | onStaleCallTimeout (resip::ClientInviteSessionHandle) |
| UAC gets no final response within the stale call timeout (default is 3 minutes). | |
| virtual void | onTerminated (resip::InviteSessionHandle h, resip::InviteSessionHandler::TerminatedReason reason, const resip::SipMessage *msg) |
| virtual void | onRedirected (resip::ClientInviteSessionHandle, const resip::SipMessage &msg) |
| called when a 3xx with valid targets is encountered in an early dialog This is different then getting a 3xx in onTerminated, as another request will be attempted, so the DialogSet will not be destroyed. | |
| virtual void | onAnswer (resip::InviteSessionHandle, const resip::SipMessage &msg, const resip::SdpContents &) |
| called when an answer is received - has nothing to do with user answering the call | |
| virtual void | onOffer (resip::InviteSessionHandle handle, const resip::SipMessage &msg, const resip::SdpContents &offer) |
| called when an offer is received - must send an answer soon after this | |
| virtual void | onOfferRequired (resip::InviteSessionHandle, const resip::SipMessage &msg) |
| called when an Invite w/out offer is sent, or any other context which requires an offer from the user | |
| virtual void | onOfferRejected (resip::InviteSessionHandle, const resip::SipMessage *msg) |
| called if an offer in a UPDATE or re-INVITE was rejected - not real useful. | |
| virtual void | onOfferRequestRejected (resip::InviteSessionHandle, const resip::SipMessage &msg) |
| Called when an error response is received for a reinvite-nobody request (via requestOffer) | |
| virtual void | onRemoteSdpChanged (resip::InviteSessionHandle, const resip::SipMessage &msg, const resip::SdpContents &sdp) |
| called when a modified body is received in a 2xx response to a session-timer reINVITE. | |
| virtual void | onInfo (resip::InviteSessionHandle, const resip::SipMessage &msg) |
| called when INFO message is received | |
| virtual void | onInfoSuccess (resip::InviteSessionHandle, const resip::SipMessage &msg) |
| called when response to INFO message is received | |
| virtual void | onInfoFailure (resip::InviteSessionHandle, const resip::SipMessage &msg) |
| virtual void | onRefer (resip::InviteSessionHandle, resip::ServerSubscriptionHandle, const resip::SipMessage &msg) |
| called when an REFER message is received. | |
| virtual void | onReferAccepted (resip::InviteSessionHandle, resip::ClientSubscriptionHandle, const resip::SipMessage &msg) |
| called when an REFER message receives an accepted response | |
| virtual void | onReferRejected (resip::InviteSessionHandle, const resip::SipMessage &msg) |
| called when an REFER message receives a failure response | |
| virtual void | onReferNoSub (resip::InviteSessionHandle, const resip::SipMessage &msg) |
| virtual void | onMessage (resip::InviteSessionHandle, const resip::SipMessage &msg) |
| called when MESSAGE message is received | |
| virtual void | onMessageSuccess (resip::InviteSessionHandle, const resip::SipMessage &msg) |
| called when response to MESSAGE message is received | |
| virtual void | onMessageFailure (resip::InviteSessionHandle, const resip::SipMessage &msg) |
| virtual void | onForkDestroyed (resip::ClientInviteSessionHandle) |
| called when a fork that was created through a 1xx never receives a 2xx because another fork answered and this fork was canceled by a proxy. | |
| virtual void | onReadyToSend (InviteSessionHandle, SipMessage &msg) |
| called to allow app to adorn a message. default is to send immediately | |
| virtual void | onFlowTerminated (InviteSessionHandle) |
| Called when a TCP or TLS flow to the server has terminated. | |
| virtual void | onTrying (resip::AppDialogSetHandle, const resip::SipMessage &msg) |
| virtual void | onNonDialogCreatingProvisional (resip::AppDialogSetHandle, const resip::SipMessage &msg) |
| virtual void | onNewSubscription (resip::ServerSubscriptionHandle, const resip::SipMessage &sub) |
| virtual void | onNewSubscriptionFromRefer (resip::ServerSubscriptionHandle, const resip::SipMessage &sub) |
| virtual void | onRefresh (resip::ServerSubscriptionHandle, const resip::SipMessage &sub) |
| virtual void | onTerminated (resip::ServerSubscriptionHandle) |
| virtual void | onReadyToSend (resip::ServerSubscriptionHandle, resip::SipMessage &) |
| virtual void | onNotifyRejected (resip::ServerSubscriptionHandle, const resip::SipMessage &msg) |
| virtual void | onError (resip::ServerSubscriptionHandle, const resip::SipMessage &msg) |
| virtual void | onExpiredByClient (resip::ServerSubscriptionHandle, const resip::SipMessage &sub, resip::SipMessage ¬ify) |
| virtual void | onExpired (resip::ServerSubscriptionHandle, resip::SipMessage ¬ify) |
| virtual bool | hasDefaultExpires () const |
| dcm! -- a bit clunky, but really want these objects to not have state | |
| virtual UInt32 | getDefaultExpires () const |
| virtual void | onSuccess (resip::ClientOutOfDialogReqHandle, const resip::SipMessage &response) |
| virtual void | onFailure (resip::ClientOutOfDialogReqHandle, const resip::SipMessage &response) |
| Received a failure response from UAS. | |
| virtual void | onReceivedRequest (resip::ServerOutOfDialogReqHandle, const resip::SipMessage &request) |
| virtual void | onRedirectReceived (resip::AppDialogSetHandle, const resip::SipMessage &response) |
| virtual bool | onTryingNextTarget (resip::AppDialogSetHandle, const resip::SipMessage &request) |
| void | addTransport (TransportType type, int port) |
| void | onNotifyTimeout (unsigned int timerId) |
| void | sendNotify () |
| void | onCallTimeout (BasicClientCall *call) |
| void | registerCall (BasicClientCall *call) |
| void | unregisterCall (BasicClientCall *call) |
| bool | isValidCall (BasicClientCall *call) |
Protected Attributes | |
| SharedPtr< MasterProfile > | mProfile |
| Security * | mSecurity |
| SipStack | mStack |
| DialogUsageManager * | mDum |
| SelectInterruptor | mSelectInterruptor |
| InterruptableStackThread | mStackThread |
| volatile bool | mDumShutdownRequested |
| bool | mDumShutdown |
| ClientRegistrationHandle | mRegHandle |
| ClientSubscriptionHandle | mClientSubscriptionHandle |
| ServerSubscriptionHandle | mServerSubscriptionHandle |
| unsigned int | mRegistrationRetryDelayTime |
| unsigned int | mCurrentNotifyTimerId |
| std::set< BasicClientCall * > | mCallList |
Friends | |
| class | NotifyTimer |
| class | CallTimer |
| class | BasicClientCall |
Definition at line 24 of file basicClientUserAgent.hxx.
| BasicClientUserAgent::BasicClientUserAgent | ( | int | argc, |
| char ** | argv | ||
| ) |
Definition at line 113 of file basicClientUserAgent.cxx.
References resip::DialogUsageManager::addClientSubscriptionHandler(), resip::DialogUsageManager::addOutOfDialogHandler(), resip::DialogUsageManager::addServerSubscriptionHandler(), addTransport(), resip::Symbols::COLON, resip::DTLS, resip::Data::empty(), resip::AresDns::enableHostFileLookupOnlyMode(), resip::MD5Stream::getHex(), resip::DnsUtil::getLocalHostName(), resip::Uri::host(), resip::Log::initialize(), resip::BasicClientCmdLineParser::mAor, resip::BasicClientCmdLineParser::mContact, resip::Data::md5(), resip::BasicClientCmdLineParser::mDtlsPort, mDum, resip::BasicClientCmdLineParser::mHostFileLookupOnlyDnsMode, resip::BasicClientCmdLineParser::mLogLevel, resip::BasicClientCmdLineParser::mLogType, resip::BasicClientCmdLineParser::mOutboundEnabled, resip::BasicClientCmdLineParser::mOutboundProxy, resip::BasicClientCmdLineParser::mPassword, mProfile, resip::BasicClientCmdLineParser::mRegisterDuration, mStack, resip::BasicClientCmdLineParser::mTcpPort, resip::BasicClientCmdLineParser::mTlsPort, resip::BasicClientCmdLineParser::mUdpPort, resip::Symbols::Outbound, resip::Symbols::Path, resip::Data::Preallocate, resip::DialogUsageManager::registerForConnectionTermination(), resip::DialogUsageManager::setAppDialogSetFactory(), resip::DialogUsageManager::setClientAuthManager(), resip::DialogUsageManager::setClientRegistrationHandler(), resip::DialogUsageManager::setDialogSetHandler(), resip::DialogUsageManager::setInviteSessionHandler(), resip::DialogUsageManager::setKeepAliveManager(), resip::DialogUsageManager::setMasterProfile(), resip::DialogUsageManager::setRedirectHandler(), resip::Data::size(), resip::SipStack::statisticsManagerEnabled(), resip::Data::substr(), resip::MasterProfile::Supported, resip::TCP, resip::Symbols::Timer, resip::TLS, resip::UDP, resip::Data::uppercase(), and resip::Uri::user().
: BasicClientCmdLineParser(argc, argv), mProfile(new MasterProfile), #if defined(USE_SSL) mSecurity(new Security(mCertPath)), #else mSecurity(0), #endif mStack(mSecurity, DnsStub::EmptyNameserverList, &mSelectInterruptor), mDum(new DialogUsageManager(mStack)), mStackThread(mStack, mSelectInterruptor), mDumShutdownRequested(false), mDumShutdown(false), mRegistrationRetryDelayTime(0), mCurrentNotifyTimerId(0) { Log::initialize(mLogType, mLogLevel, argv[0]); if(mHostFileLookupOnlyDnsMode) { AresDns::enableHostFileLookupOnlyMode(true); } addTransport(UDP, mUdpPort); addTransport(TCP, mTcpPort); #if defined(USE_SSL) addTransport(TLS, mTlsPort); #endif #if defined(USE_DTLS) addTransport(DTLS, mDtlsPort); #endif // Disable Statistics Manager mStack.statisticsManagerEnabled() = false; // Supported Methods mProfile->clearSupportedMethods(); mProfile->addSupportedMethod(INVITE); mProfile->addSupportedMethod(ACK); mProfile->addSupportedMethod(CANCEL); mProfile->addSupportedMethod(OPTIONS); mProfile->addSupportedMethod(BYE); //mProfile->addSupportedMethod(REFER); mProfile->addSupportedMethod(NOTIFY); mProfile->addSupportedMethod(SUBSCRIBE); //mProfile->addSupportedMethod(UPDATE); mProfile->addSupportedMethod(INFO); mProfile->addSupportedMethod(MESSAGE); //mProfile->addSupportedMethod(PRACK); //mProfile->addSupportedOptionTag(Token(Symbols::C100rel)); // Automatically added when using setUacReliableProvisionalMode mProfile->setUacReliableProvisionalMode(MasterProfile::Supported); //mProfile->setUasReliableProvisionalMode(MasterProfile::Supported); // TODO - needs support in DUM, currently unimplemented // Support Languages mProfile->clearSupportedLanguages(); mProfile->addSupportedLanguage(Token("en")); // Support Mime Types mProfile->clearSupportedMimeTypes(); mProfile->addSupportedMimeType(INVITE, Mime("application", "sdp")); mProfile->addSupportedMimeType(INVITE, Mime("multipart", "mixed")); mProfile->addSupportedMimeType(INVITE, Mime("multipart", "signed")); mProfile->addSupportedMimeType(INVITE, Mime("multipart", "alternative")); mProfile->addSupportedMimeType(OPTIONS,Mime("application", "sdp")); mProfile->addSupportedMimeType(OPTIONS,Mime("multipart", "mixed")); mProfile->addSupportedMimeType(OPTIONS, Mime("multipart", "signed")); mProfile->addSupportedMimeType(OPTIONS, Mime("multipart", "alternative")); mProfile->addSupportedMimeType(PRACK, Mime("application", "sdp")); mProfile->addSupportedMimeType(PRACK, Mime("multipart", "mixed")); mProfile->addSupportedMimeType(PRACK, Mime("multipart", "signed")); mProfile->addSupportedMimeType(PRACK, Mime("multipart", "alternative")); mProfile->addSupportedMimeType(UPDATE, Mime("application", "sdp")); mProfile->addSupportedMimeType(UPDATE, Mime("multipart", "mixed")); mProfile->addSupportedMimeType(UPDATE, Mime("multipart", "signed")); mProfile->addSupportedMimeType(UPDATE, Mime("multipart", "alternative")); mProfile->addSupportedMimeType(MESSAGE, Mime("text","plain")); // Invite session in-dialog routing testing mProfile->addSupportedMimeType(NOTIFY, Mime("text","plain")); // subscription testing //mProfile->addSupportedMimeType(NOTIFY, Mime("message", "sipfrag")); // Supported Options Tags mProfile->clearSupportedOptionTags(); //mMasterProfile->addSupportedOptionTag(Token(Symbols::Replaces)); mProfile->addSupportedOptionTag(Token(Symbols::Timer)); // Enable Session Timers if(mOutboundEnabled) { mProfile->addSupportedOptionTag(Token(Symbols::Outbound)); // RFC 5626 - outbound mProfile->addSupportedOptionTag(Token(Symbols::Path)); // RFC 3327 - path } //mMasterProfile->addSupportedOptionTag(Token(Symbols::NoReferSub)); //mMasterProfile->addSupportedOptionTag(Token(Symbols::TargetDialog)); // Supported Schemes mProfile->clearSupportedSchemes(); mProfile->addSupportedScheme("sip"); #if defined(USE_SSL) mProfile->addSupportedScheme("sips"); #endif // Validation Settings mProfile->validateContentEnabled() = false; mProfile->validateContentLanguageEnabled() = false; mProfile->validateAcceptEnabled() = false; // Have stack add Allow/Supported/Accept headers to INVITE dialog establishment messages mProfile->clearAdvertisedCapabilities(); // Remove Profile Defaults, then add our preferences mProfile->addAdvertisedCapability(Headers::Allow); //mProfile->addAdvertisedCapability(Headers::AcceptEncoding); // This can be misleading - it might specify what is expected in response mProfile->addAdvertisedCapability(Headers::AcceptLanguage); mProfile->addAdvertisedCapability(Headers::Supported); mProfile->setMethodsParamEnabled(true); // Install Sdp Message Decorator SharedPtr<MessageDecorator> outboundDecorator(new SdpMessageDecorator); mProfile->setOutboundDecorator(outboundDecorator); // Other Profile Settings mProfile->setUserAgent("basicClient/1.0"); mProfile->setDefaultRegistrationTime(mRegisterDuration); mProfile->setDefaultRegistrationRetryTime(120); if(!mContact.host().empty()) { mProfile->setOverrideHostAndPort(mContact); } if(!mOutboundProxy.host().empty()) { mProfile->setOutboundProxy(Uri(mOutboundProxy)); //mProfile->setForceOutboundProxyOnAllRequestsEnabled(true); mProfile->setExpressOutboundAsRouteSetEnabled(true); } // UserProfile Settings mProfile->setDefaultFrom(NameAddr(mAor)); #ifdef TEST_PASSING_A1_HASH_FOR_PASSWORD MD5Stream a1; a1 << mAor.user() << Symbols::COLON << mAor.host() << Symbols::COLON << mPassword; mProfile->setDigestCredential(mAor.host(), mAor.user(), a1.getHex(), true); #else mProfile->setDigestCredential(mAor.host(), mAor.user(), mPassword); #endif // Generate InstanceId appropriate for testing only. Should be UUID that persists // across machine re-starts and is unique to this applicaiton instance. The one used // here is only as unique as the hostname of this machine. If someone runs two // instances of this application on the same host for the same Aor, then things will // break. See RFC5626 section 4.1 Data hostname = DnsUtil::getLocalHostName(); Data instanceHash = hostname.md5().uppercase(); assert(instanceHash.size() == 32); Data instanceId(48, Data::Preallocate); instanceId += "<urn:uuid:"; instanceId += instanceHash.substr(0, 8); instanceId += "-"; instanceId += instanceHash.substr(8, 4); instanceId += "-"; instanceId += instanceHash.substr(12, 4); instanceId += "-"; instanceId += instanceHash.substr(16, 4); instanceId += "-"; instanceId += instanceHash.substr(20, 12); instanceId += ">"; mProfile->setInstanceId(instanceId); if(mOutboundEnabled) { mProfile->setRegId(1); mProfile->clientOutboundEnabled() = true; } // Install Managers mDum->setClientAuthManager(std::auto_ptr<ClientAuthManager>(new ClientAuthManager)); mDum->setKeepAliveManager(std::auto_ptr<KeepAliveManager>(new KeepAliveManager)); mProfile->setKeepAliveTimeForDatagram(30); mProfile->setKeepAliveTimeForStream(120); // Install Handlers mDum->setInviteSessionHandler(this); mDum->setDialogSetHandler(this); mDum->addOutOfDialogHandler(OPTIONS, this); //mDum->addOutOfDialogHandler(REFER, this); mDum->setRedirectHandler(this); mDum->setClientRegistrationHandler(this); mDum->addClientSubscriptionHandler("basicClientTest", this); // fabricated test event package mDum->addServerSubscriptionHandler("basicClientTest", this); // Set AppDialogSetFactory auto_ptr<AppDialogSetFactory> dsf(new ClientAppDialogSetFactory(*this)); mDum->setAppDialogSetFactory(dsf); mDum->setMasterProfile(mProfile); mDum->registerForConnectionTermination(this); }

| BasicClientUserAgent::~BasicClientUserAgent | ( | ) | [virtual] |
Definition at line 308 of file basicClientUserAgent.cxx.
References resip::ThreadIf::join(), mDum, mStackThread, and resip::InterruptableStackThread::shutdown().
{
mStackThread.shutdown();
mStackThread.join();
delete mDum;
}

| void BasicClientUserAgent::addTransport | ( | TransportType | type, |
| int | port | ||
| ) | [protected] |
Definition at line 395 of file basicClientUserAgent.cxx.
References resip::SipStack::addTransport(), resip::Data::Empty, InfoLog, resip::BasicClientCmdLineParser::mEnableV6, resip::BasicClientCmdLineParser::mNoV4, mStack, resip::BasicClientCmdLineParser::mTlsDomain, resip::StunEnabled, resip::Tuple::toData(), resip::V4, resip::V6, and WarningLog.
Referenced by BasicClientUserAgent().
{
if(port == 0) return; // Transport disabled
for (int i=0; i < 10; ++i)
{
try
{
if (!mNoV4)
{
mStack.addTransport(type, port+i, V4, StunEnabled, Data::Empty, mTlsDomain);
return;
}
if (mEnableV6)
{
mStack.addTransport(type, port+i, V6, StunEnabled, Data::Empty, mTlsDomain);
return;
}
}
catch (BaseException& e)
{
InfoLog (<< "Caught: " << e);
WarningLog (<< "Failed to add " << Tuple::toData(type) << " transport on " << port);
}
}
throw Transport::Exception("Port already in use", __FILE__, __LINE__);
}

| UInt32 BasicClientUserAgent::getDefaultExpires | ( | ) | const [protected, virtual] |
Reimplemented from resip::ServerSubscriptionHandler.
Definition at line 988 of file basicClientUserAgent.cxx.
{
return 60;
}
| DialogUsageManager& resip::BasicClientUserAgent::getDialogUsageManager | ( | ) | [inline] |
Definition at line 43 of file basicClientUserAgent.hxx.
References mDum.
Referenced by resip::BasicClientCall::initiateCall(), resip::BasicClientCall::onConnected(), resip::BasicClientCall::onFlowTerminated(), and resip::BasicClientCall::timerExpired().
{ return *mDum; }
| SharedPtr<UserProfile> resip::BasicClientUserAgent::getIncomingUserProfile | ( | const SipMessage & | msg | ) | [inline] |
Definition at line 44 of file basicClientUserAgent.hxx.
References mProfile.
Referenced by resip::BasicClientCall::selectUASUserProfile().
{ return mProfile; } // This test program only uses the one global Master Profile - just return it
| bool BasicClientUserAgent::hasDefaultExpires | ( | ) | const [protected, virtual] |
dcm! -- a bit clunky, but really want these objects to not have state
Reimplemented from resip::ServerSubscriptionHandler.
Definition at line 982 of file basicClientUserAgent.cxx.
{
return true;
}
| bool BasicClientUserAgent::isValidCall | ( | BasicClientCall * | call | ) | [protected] |
Definition at line 496 of file basicClientUserAgent.cxx.
References mCallList.
Referenced by onCallTimeout().
| void BasicClientUserAgent::onAnswer | ( | resip::InviteSessionHandle | , |
| const resip::SipMessage & | msg, | ||
| const resip::SdpContents & | |||
| ) | [protected, virtual] |
called when an answer is received - has nothing to do with user answering the call
Implements resip::InviteSessionHandler.
Definition at line 638 of file basicClientUserAgent.cxx.
References resip::Handle< T >::get().
{
dynamic_cast<BasicClientCall *>(h->getAppDialogSet().get())->onAnswer(h, msg, sdp);
}

| void BasicClientUserAgent::onCallTimeout | ( | BasicClientCall * | call | ) | [protected] |
Definition at line 461 of file basicClientUserAgent.cxx.
References BasicClientCall, resip::Data::empty(), resip::Uri::host(), resip::BasicClientCall::initiateCall(), isValidCall(), mCallList, resip::BasicClientCmdLineParser::mCallTarget, mProfile, and resip::BasicClientCall::timerExpired().
{
if(isValidCall(call))
{
call->timerExpired();
}
else // call no longer exists
{
// If there are no more calls, then start a new one
if(mCallList.empty() && !mCallTarget.host().empty())
{
// re-start a new call
BasicClientCall* newCall = new BasicClientCall(*this);
newCall->initiateCall(mCallTarget, mProfile);
}
}
}

| void BasicClientUserAgent::onConnected | ( | resip::ClientInviteSessionHandle | , |
| const resip::SipMessage & | msg | ||
| ) | [protected, virtual] |
called when a dialog initiated as a UAC enters the connected state
Implements resip::InviteSessionHandler.
Definition at line 608 of file basicClientUserAgent.cxx.
References resip::Handle< T >::get().
Referenced by onConnected().
{
dynamic_cast<BasicClientCall *>(h->getAppDialogSet().get())->onConnected(h, msg);
}

| void BasicClientUserAgent::onConnected | ( | resip::InviteSessionHandle | , |
| const resip::SipMessage & | msg | ||
| ) | [protected, virtual] |
called when a dialog initiated as a UAS enters the connected state
Implements resip::InviteSessionHandler.
Definition at line 614 of file basicClientUserAgent.cxx.
References resip::Handle< T >::get(), and onConnected().
{
dynamic_cast<BasicClientCall *>(h->getAppDialogSet().get())->onConnected(h, msg);
}

| void BasicClientUserAgent::onDumCanBeDeleted | ( | ) | [protected, virtual] |
Implements resip::DumShutdownHandler.
Definition at line 507 of file basicClientUserAgent.cxx.
References mDumShutdown.
{
mDumShutdown = true;
}
| void BasicClientUserAgent::onEarlyMedia | ( | resip::ClientInviteSessionHandle | , |
| const resip::SipMessage & | , | ||
| const resip::SdpContents & | |||
| ) | [protected, virtual] |
called when an in-dialog provisional response is received that contains a body
Implements resip::InviteSessionHandler.
Definition at line 596 of file basicClientUserAgent.cxx.
References resip::Handle< T >::get().
{
dynamic_cast<BasicClientCall *>(h->getAppDialogSet().get())->onEarlyMedia(h, msg, sdp);
}

| void BasicClientUserAgent::onError | ( | resip::ServerSubscriptionHandle | , |
| const resip::SipMessage & | msg | ||
| ) | [protected, virtual] |
Reimplemented from resip::ServerSubscriptionHandler.
Definition at line 964 of file basicClientUserAgent.cxx.
References resip::Message::brief(), and WarningLog.
{
WarningLog(<< "onError(ServerSubscriptionHandle): " << msg.brief());
}

| void BasicClientUserAgent::onExpired | ( | resip::ServerSubscriptionHandle | , |
| resip::SipMessage & | notify | ||
| ) | [protected, virtual] |
Reimplemented from resip::ServerSubscriptionHandler.
Definition at line 976 of file basicClientUserAgent.cxx.
References resip::Message::brief(), and InfoLog.
{
InfoLog(<< "onExpired(ServerSubscriptionHandle): " << msg.brief());
}

| void BasicClientUserAgent::onExpiredByClient | ( | resip::ServerSubscriptionHandle | , |
| const resip::SipMessage & | sub, | ||
| resip::SipMessage & | notify | ||
| ) | [protected, virtual] |
Reimplemented from resip::ServerSubscriptionHandler.
Definition at line 970 of file basicClientUserAgent.cxx.
References resip::Message::brief(), and InfoLog.

| void BasicClientUserAgent::onFailure | ( | resip::ClientRegistrationHandle | , |
| const resip::SipMessage & | response | ||
| ) | [protected, virtual] |
Called if registration fails, usage will be destroyed (unless a Registration retry interval is enabled in the Profile)
Implements resip::ClientRegistrationHandler.
Definition at line 540 of file basicClientUserAgent.cxx.
References resip::Message::brief(), InfoLog, and mRegHandle.
Referenced by onFailure().
{
InfoLog(<< "onFailure(ClientRegistrationHandle): msg=" << msg.brief());
mRegHandle = h;
}

| void BasicClientUserAgent::onFailure | ( | resip::ClientInviteSessionHandle | , |
| const resip::SipMessage & | msg | ||
| ) | [protected, virtual] |
Received a failure response from UAS.
Implements resip::InviteSessionHandler.
Definition at line 590 of file basicClientUserAgent.cxx.
References resip::Handle< T >::get(), and onFailure().
{
dynamic_cast<BasicClientCall *>(h->getAppDialogSet().get())->onFailure(h, msg);
}

| virtual void resip::BasicClientUserAgent::onFailure | ( | resip::ClientOutOfDialogReqHandle | , |
| const resip::SipMessage & | msg | ||
| ) | [protected, virtual] |
Received a failure response from UAS.
Implements resip::InviteSessionHandler.
| void BasicClientUserAgent::onFlowTerminated | ( | InviteSessionHandle | ) | [protected, virtual] |
Called when a TCP or TLS flow to the server has terminated.
This can be caused by socket errors, or missing CRLF keep alives pong responses from the server. supports RFC5626 (outbound). Default implementation is to do nothing
Reimplemented from resip::InviteSessionHandler.
Definition at line 746 of file basicClientUserAgent.cxx.
References resip::Handle< T >::get().
{
dynamic_cast<BasicClientCall *>(h->getAppDialogSet().get())->onFlowTerminated(h);
}

| void BasicClientUserAgent::onForkDestroyed | ( | resip::ClientInviteSessionHandle | ) | [protected, virtual] |
called when a fork that was created through a 1xx never receives a 2xx because another fork answered and this fork was canceled by a proxy.
Implements resip::InviteSessionHandler.
Definition at line 734 of file basicClientUserAgent.cxx.
References resip::Handle< T >::get().
{
dynamic_cast<BasicClientCall *>(h->getAppDialogSet().get())->onForkDestroyed(h);
}

| void BasicClientUserAgent::onInfo | ( | resip::InviteSessionHandle | , |
| const resip::SipMessage & | msg | ||
| ) | [protected, virtual] |
called when INFO message is received
Implements resip::InviteSessionHandler.
Definition at line 674 of file basicClientUserAgent.cxx.
References resip::Handle< T >::get().
{
dynamic_cast<BasicClientCall *>(h->getAppDialogSet().get())->onInfo(h, msg);
}

| void BasicClientUserAgent::onInfoFailure | ( | resip::InviteSessionHandle | h, |
| const resip::SipMessage & | msg | ||
| ) | [protected, virtual] |
Implements resip::InviteSessionHandler.
Definition at line 686 of file basicClientUserAgent.cxx.
References resip::Handle< T >::get().
{
dynamic_cast<BasicClientCall *>(h->getAppDialogSet().get())->onInfoFailure(h, msg);
}

| void BasicClientUserAgent::onInfoSuccess | ( | resip::InviteSessionHandle | , |
| const resip::SipMessage & | msg | ||
| ) | [protected, virtual] |
called when response to INFO message is received
Implements resip::InviteSessionHandler.
Definition at line 680 of file basicClientUserAgent.cxx.
References resip::Handle< T >::get().
{
dynamic_cast<BasicClientCall *>(h->getAppDialogSet().get())->onInfoSuccess(h, msg);
}

| void BasicClientUserAgent::onMessage | ( | resip::InviteSessionHandle | , |
| const resip::SipMessage & | msg | ||
| ) | [protected, virtual] |
called when MESSAGE message is received
Implements resip::InviteSessionHandler.
Definition at line 716 of file basicClientUserAgent.cxx.
References resip::Handle< T >::get().
{
dynamic_cast<BasicClientCall *>(h->getAppDialogSet().get())->onMessage(h, msg);
}

| void BasicClientUserAgent::onMessageFailure | ( | resip::InviteSessionHandle | h, |
| const resip::SipMessage & | msg | ||
| ) | [protected, virtual] |
Implements resip::InviteSessionHandler.
Definition at line 728 of file basicClientUserAgent.cxx.
References resip::Handle< T >::get().
{
dynamic_cast<BasicClientCall *>(h->getAppDialogSet().get())->onMessageFailure(h, msg);
}

| void BasicClientUserAgent::onMessageSuccess | ( | resip::InviteSessionHandle | , |
| const resip::SipMessage & | msg | ||
| ) | [protected, virtual] |
called when response to MESSAGE message is received
Implements resip::InviteSessionHandler.
Definition at line 722 of file basicClientUserAgent.cxx.
References resip::Handle< T >::get().
{
dynamic_cast<BasicClientCall *>(h->getAppDialogSet().get())->onMessageSuccess(h, msg);
}

| void BasicClientUserAgent::onNewSession | ( | resip::ClientInviteSessionHandle | , |
| resip::InviteSession::OfferAnswerType | oat, | ||
| const resip::SipMessage & | msg | ||
| ) | [protected, virtual] |
called when an initial INVITE or the intial response to an outoing invite
Implements resip::InviteSessionHandler.
Definition at line 578 of file basicClientUserAgent.cxx.
References resip::Handle< T >::get().
{
dynamic_cast<BasicClientCall *>(h->getAppDialogSet().get())->onNewSession(h, oat, msg);
}

| virtual void resip::BasicClientUserAgent::onNewSession | ( | resip::ServerInviteSessionHandle | , |
| resip::InviteSession::OfferAnswerType | oat, | ||
| const resip::SipMessage & | msg | ||
| ) | [protected, virtual] |
called when an initial INVITE or the intial response to an outoing invite
Implements resip::InviteSessionHandler.
| void BasicClientUserAgent::onNewSubscription | ( | resip::ClientSubscriptionHandle | h, |
| const resip::SipMessage & | notify | ||
| ) | [protected, virtual] |
Implements resip::ClientSubscriptionHandler.
Definition at line 858 of file basicClientUserAgent.cxx.
References resip::Message::brief(), resip::Handle< T >::get(), InfoLog, mClientSubscriptionHandle, and resip::BasicClientCall::onNewSubscription().
{
BasicClientCall* call = dynamic_cast<BasicClientCall *>(h->getAppDialogSet().get());
if(call)
{
call->onNewSubscription(h, msg);
return;
}
mClientSubscriptionHandle = h;
InfoLog(<< "onNewSubscription(ClientSubscriptionHandle): msg=" << msg.brief());
}

| void BasicClientUserAgent::onNewSubscription | ( | resip::ServerSubscriptionHandle | h, |
| const resip::SipMessage & | sub | ||
| ) | [protected, virtual] |
Implements resip::ServerSubscriptionHandler.
Definition at line 886 of file basicClientUserAgent.cxx.
References resip::Message::brief(), InfoLog, mServerSubscriptionHandle, and sendNotify().
{
InfoLog(<< "onNewSubscription(ServerSubscriptionHandle): " << msg.brief());
mServerSubscriptionHandle = h;
mServerSubscriptionHandle->setSubscriptionState(Active);
mServerSubscriptionHandle->send(mServerSubscriptionHandle->accept());
sendNotify();
}

| void BasicClientUserAgent::onNewSubscriptionFromRefer | ( | resip::ServerSubscriptionHandle | ss, |
| const resip::SipMessage & | sub | ||
| ) | [protected, virtual] |
Reimplemented from resip::ServerSubscriptionHandler.
Definition at line 898 of file basicClientUserAgent.cxx.
References resip::Message::brief(), resip::SipMessage::exists(), resip::DialogUsageManager::findInviteSession(), resip::SipMessage::header(), InfoLog, mDum, resip::Handle< InviteSession >::NotValid(), resip::BasicClientCall::onRefer(), and WarningLog.
{
InfoLog(<< "onNewSubscriptionFromRefer(ServerSubscriptionHandle): " << msg.brief());
// Received an out-of-dialog refer request with implicit subscription
try
{
if(msg.exists(h_ReferTo))
{
// Check if TargetDialog header is present
if(msg.exists(h_TargetDialog))
{
pair<InviteSessionHandle, int> presult;
presult = mDum->findInviteSession(msg.header(h_TargetDialog));
if(!(presult.first == InviteSessionHandle::NotValid()))
{
BasicClientCall* callToRefer = (BasicClientCall*)presult.first->getAppDialogSet().get();
callToRefer->onRefer(presult.first, ss, msg);
return;
}
}
// We don't support ood refers that don't target a dialog - reject request
WarningLog (<< "onNewSubscriptionFromRefer(ServerSubscriptionHandle): Received ood refer (noSub) w/out a Target-Dialog: " << msg.brief());
ss->send(ss->reject(400));
}
else
{
WarningLog (<< "onNewSubscriptionFromRefer(ServerSubscriptionHandle): Received refer w/out a Refer-To: " << msg.brief());
ss->send(ss->reject(400));
}
}
catch(BaseException &e)
{
WarningLog(<< "onNewSubscriptionFromRefer(ServerSubscriptionHandle): exception " << e);
}
catch(...)
{
WarningLog(<< "onNewSubscriptionFromRefer(ServerSubscriptionHandle): unknown exception");
}
}

| void BasicClientUserAgent::onNonDialogCreatingProvisional | ( | resip::AppDialogSetHandle | h, |
| const resip::SipMessage & | msg | ||
| ) | [protected, virtual] |
Implements resip::DialogSetHandler.
Definition at line 770 of file basicClientUserAgent.cxx.
References resip::Message::brief(), resip::Handle< T >::get(), InfoLog, and resip::BasicClientCall::onNonDialogCreatingProvisional().
{
BasicClientCall *call = dynamic_cast<BasicClientCall *>(h.get());
if(call)
{
call->onNonDialogCreatingProvisional(h, msg);
}
else
{
InfoLog(<< "onNonDialogCreatingProvisional(AppDialogSetHandle): " << msg.brief());
}
}

| void BasicClientUserAgent::onNotifyNotReceived | ( | ClientSubscriptionHandle | h | ) | [protected, virtual] |
Reimplemented from resip::ClientSubscriptionHandler.
Definition at line 826 of file basicClientUserAgent.cxx.
References resip::Handle< T >::get(), resip::BasicClientCall::onNotifyNotReceived(), and WarningLog.
{
BasicClientCall* call = dynamic_cast<BasicClientCall *>(h->getAppDialogSet().get());
if(call)
{
call->onNotifyNotReceived(h);
return;
}
WarningLog(<< "onNotifyNotReceived(ClientSubscriptionHandle)");
h->end();
}

| void BasicClientUserAgent::onNotifyRejected | ( | resip::ServerSubscriptionHandle | , |
| const resip::SipMessage & | msg | ||
| ) | [protected, virtual] |
Reimplemented from resip::ServerSubscriptionHandler.
Definition at line 958 of file basicClientUserAgent.cxx.
References resip::Message::brief(), and WarningLog.
{
WarningLog(<< "onNotifyRejected(ServerSubscriptionHandle): " << msg.brief());
}

| void BasicClientUserAgent::onNotifyTimeout | ( | unsigned int | timerId | ) | [protected] |
Definition at line 438 of file basicClientUserAgent.cxx.
References mCurrentNotifyTimerId, and sendNotify().
{
if(timerId == mCurrentNotifyTimerId)
{
sendNotify();
}
}

| void BasicClientUserAgent::onOffer | ( | resip::InviteSessionHandle | , |
| const resip::SipMessage & | msg, | ||
| const resip::SdpContents & | |||
| ) | [protected, virtual] |
called when an offer is received - must send an answer soon after this
Implements resip::InviteSessionHandler.
Definition at line 644 of file basicClientUserAgent.cxx.
References resip::Handle< T >::get().
{
dynamic_cast<BasicClientCall *>(h->getAppDialogSet().get())->onOffer(h, msg, sdp);
}

| void BasicClientUserAgent::onOfferRejected | ( | resip::InviteSessionHandle | , |
| const resip::SipMessage * | msg | ||
| ) | [protected, virtual] |
called if an offer in a UPDATE or re-INVITE was rejected - not real useful.
A SipMessage is provided if one is available
Implements resip::InviteSessionHandler.
Definition at line 656 of file basicClientUserAgent.cxx.
References resip::Handle< T >::get().
{
dynamic_cast<BasicClientCall *>(h->getAppDialogSet().get())->onOfferRejected(h, msg);
}

| void BasicClientUserAgent::onOfferRequestRejected | ( | resip::InviteSessionHandle | , |
| const resip::SipMessage & | msg | ||
| ) | [protected, virtual] |
Called when an error response is received for a reinvite-nobody request (via requestOffer)
Reimplemented from resip::InviteSessionHandler.
Definition at line 662 of file basicClientUserAgent.cxx.
References resip::Handle< T >::get().
{
dynamic_cast<BasicClientCall *>(h->getAppDialogSet().get())->onOfferRequestRejected(h, msg);
}

| void BasicClientUserAgent::onOfferRequired | ( | resip::InviteSessionHandle | , |
| const resip::SipMessage & | msg | ||
| ) | [protected, virtual] |
called when an Invite w/out offer is sent, or any other context which requires an offer from the user
Implements resip::InviteSessionHandler.
Definition at line 650 of file basicClientUserAgent.cxx.
References resip::Handle< T >::get().
{
dynamic_cast<BasicClientCall *>(h->getAppDialogSet().get())->onOfferRequired(h, msg);
}

| void BasicClientUserAgent::onProvisional | ( | resip::ClientInviteSessionHandle | , |
| const resip::SipMessage & | |||
| ) | [protected, virtual] |
called when dialog enters the Early state - typically after getting 18x
Implements resip::InviteSessionHandler.
Definition at line 602 of file basicClientUserAgent.cxx.
References resip::Handle< T >::get().
{
dynamic_cast<BasicClientCall *>(h->getAppDialogSet().get())->onProvisional(h, msg);
}

| void BasicClientUserAgent::onReadyToSend | ( | InviteSessionHandle | , |
| SipMessage & | msg | ||
| ) | [protected, virtual] |
called to allow app to adorn a message. default is to send immediately
Reimplemented from resip::InviteSessionHandler.
Definition at line 740 of file basicClientUserAgent.cxx.
References resip::Handle< T >::get().
{
dynamic_cast<BasicClientCall *>(h->getAppDialogSet().get())->onReadyToSend(h, msg);
}

| void BasicClientUserAgent::onReadyToSend | ( | resip::ServerSubscriptionHandle | , |
| resip::SipMessage & | |||
| ) | [protected, virtual] |
Reimplemented from resip::ServerSubscriptionHandler.
Definition at line 953 of file basicClientUserAgent.cxx.
{
}
| void BasicClientUserAgent::onReceivedRequest | ( | resip::ServerOutOfDialogReqHandle | ood, |
| const resip::SipMessage & | request | ||
| ) | [protected, virtual] |
Implements resip::OutOfDialogHandler.
Definition at line 1009 of file basicClientUserAgent.cxx.
References resip::Message::brief(), InfoLog, and resip::SipMessage::method().
{
InfoLog(<< "onReceivedRequest(ServerOutOfDialogReqHandle): " << msg.brief());
switch(msg.method())
{
case OPTIONS:
{
SharedPtr<SipMessage> optionsAnswer = ood->answerOptions();
ood->send(optionsAnswer);
break;
}
default:
ood->send(ood->reject(501 /* Not Implemented*/));
break;
}
}

| void BasicClientUserAgent::onRedirected | ( | resip::ClientInviteSessionHandle | , |
| const resip::SipMessage & | msg | ||
| ) | [protected, virtual] |
called when a 3xx with valid targets is encountered in an early dialog This is different then getting a 3xx in onTerminated, as another request will be attempted, so the DialogSet will not be destroyed.
Basically an onTermintated that conveys more information. checking for 3xx respones in onTerminated will not work as there may be no valid targets.
Implements resip::InviteSessionHandler.
Definition at line 632 of file basicClientUserAgent.cxx.
References resip::Handle< T >::get().
{
dynamic_cast<BasicClientCall *>(h->getAppDialogSet().get())->onRedirected(h, msg);
}

| void BasicClientUserAgent::onRedirectReceived | ( | resip::AppDialogSetHandle | h, |
| const resip::SipMessage & | response | ||
| ) | [protected, virtual] |
Implements resip::RedirectHandler.
Definition at line 1031 of file basicClientUserAgent.cxx.
References resip::Message::brief(), resip::Handle< T >::get(), InfoLog, and resip::BasicClientCall::onRedirectReceived().
{
BasicClientCall* call = dynamic_cast<BasicClientCall *>(h.get());
if(call)
{
call->onRedirectReceived(h, msg);
}
else
{
InfoLog(<< "onRedirectReceived(AppDialogSetHandle): " << msg.brief());
}
}

| void BasicClientUserAgent::onRefer | ( | resip::InviteSessionHandle | , |
| resip::ServerSubscriptionHandle | , | ||
| const resip::SipMessage & | msg | ||
| ) | [protected, virtual] |
called when an REFER message is received.
The refer is accepted or rejected using the server subscription. If the offer is accepted, DialogUsageManager::makeInviteSessionFromRefer can be used to create an InviteSession that will send notify messages using the ServerSubscription
Implements resip::InviteSessionHandler.
Definition at line 692 of file basicClientUserAgent.cxx.
References resip::Handle< T >::get().
{
dynamic_cast<BasicClientCall *>(h->getAppDialogSet().get())->onRefer(h, ssh, msg);
}

| void BasicClientUserAgent::onReferAccepted | ( | resip::InviteSessionHandle | , |
| resip::ClientSubscriptionHandle | , | ||
| const resip::SipMessage & | msg | ||
| ) | [protected, virtual] |
called when an REFER message receives an accepted response
Implements resip::InviteSessionHandler.
Definition at line 698 of file basicClientUserAgent.cxx.
References resip::Handle< T >::get().
{
dynamic_cast<BasicClientCall *>(h->getAppDialogSet().get())->onReferAccepted(h, csh, msg);
}

| void BasicClientUserAgent::onReferNoSub | ( | resip::InviteSessionHandle | h, |
| const resip::SipMessage & | msg | ||
| ) | [protected, virtual] |
Implements resip::InviteSessionHandler.
Definition at line 710 of file basicClientUserAgent.cxx.
References resip::Handle< T >::get().
{
dynamic_cast<BasicClientCall *>(h->getAppDialogSet().get())->onReferNoSub(h, msg);
}

| void BasicClientUserAgent::onReferRejected | ( | resip::InviteSessionHandle | , |
| const resip::SipMessage & | msg | ||
| ) | [protected, virtual] |
called when an REFER message receives a failure response
Implements resip::InviteSessionHandler.
Definition at line 704 of file basicClientUserAgent.cxx.
References resip::Handle< T >::get().
{
dynamic_cast<BasicClientCall *>(h->getAppDialogSet().get())->onReferRejected(h, msg);
}

| void BasicClientUserAgent::onRefresh | ( | resip::ServerSubscriptionHandle | , |
| const resip::SipMessage & | sub | ||
| ) | [protected, virtual] |
Reimplemented from resip::ServerSubscriptionHandler.
Definition at line 941 of file basicClientUserAgent.cxx.
References resip::Message::brief(), and InfoLog.
{
InfoLog(<< "onRefresh(ServerSubscriptionHandle): " << msg.brief());
}

| void BasicClientUserAgent::onRemoteSdpChanged | ( | resip::InviteSessionHandle | , |
| const resip::SipMessage & | msg, | ||
| const resip::SdpContents & | |||
| ) | [protected, virtual] |
called when a modified body is received in a 2xx response to a session-timer reINVITE.
Under normal circumstances where the response body is unchanged from current remote body no handler is called
Reimplemented from resip::InviteSessionHandler.
Definition at line 668 of file basicClientUserAgent.cxx.
References resip::Handle< T >::get().
{
dynamic_cast<BasicClientCall *>(h->getAppDialogSet().get())->onRemoteSdpChanged(h, msg, sdp);
}

| void BasicClientUserAgent::onRemoved | ( | resip::ClientRegistrationHandle | h, |
| const resip::SipMessage & | response | ||
| ) | [protected, virtual] |
Implements resip::ClientRegistrationHandler.
Definition at line 547 of file basicClientUserAgent.cxx.
References resip::Message::brief(), InfoLog, and mRegHandle.
{
InfoLog(<< "onRemoved(ClientRegistrationHandle): msg=" << msg.brief());
mRegHandle = h;
}

| int BasicClientUserAgent::onRequestRetry | ( | resip::ClientRegistrationHandle | , |
| int | retrySeconds, | ||
| const resip::SipMessage & | response | ||
| ) | [protected, virtual] |
call on Retry-After failure.
return values: -1 = fail, 0 = retry immediately, N = retry in N seconds
Implements resip::ClientRegistrationHandler.
Definition at line 554 of file basicClientUserAgent.cxx.
References BaseRegistrationRetryTimeAllFlowsFailed, resip::Message::brief(), InfoLog, resip::Helper::jitterValue(), MaxRegistrationRetryTime, mRegHandle, mRegistrationRetryDelayTime, and resip::resipMin().
{
mRegHandle = h;
if(mRegistrationRetryDelayTime == 0)
{
mRegistrationRetryDelayTime = BaseRegistrationRetryTimeAllFlowsFailed; // We only have one flow in this test app
}
// Use back off procedures of RFC 5626 section 4.5
mRegistrationRetryDelayTime = resipMin(MaxRegistrationRetryTime, mRegistrationRetryDelayTime * 2);
// return an evenly distributed random number between 50% and 100% of mRegistrationRetryDelayTime
int retryTime = Helper::jitterValue(mRegistrationRetryDelayTime, 50, 100);
InfoLog(<< "onRequestRetry(ClientRegistrationHandle): msg=" << msg.brief() << ", retryTime=" << retryTime);
return retryTime;
}

| int BasicClientUserAgent::onRequestRetry | ( | resip::ClientSubscriptionHandle | h, |
| int | retrySeconds, | ||
| const resip::SipMessage & | notify | ||
| ) | [protected, virtual] |
Implements resip::ClientSubscriptionHandler.
Definition at line 871 of file basicClientUserAgent.cxx.
References resip::Message::brief(), FailedSubscriptionRetryTime, resip::Handle< T >::get(), InfoLog, and resip::BasicClientCall::onRequestRetry().
{
BasicClientCall* call = dynamic_cast<BasicClientCall *>(h->getAppDialogSet().get());
if(call)
{
return call->onRequestRetry(h, retrySeconds, msg);
}
InfoLog(<< "onRequestRetry(ClientSubscriptionHandle): msg=" << msg.brief());
return FailedSubscriptionRetryTime;
}

| void BasicClientUserAgent::onStaleCallTimeout | ( | resip::ClientInviteSessionHandle | h | ) | [protected, virtual] |
UAC gets no final response within the stale call timeout (default is 3 minutes).
This is just a notification. After the notification is called, the InviteSession will then call InviteSessionHandler::terminate()
Reimplemented from resip::InviteSessionHandler.
Definition at line 620 of file basicClientUserAgent.cxx.
References resip::Handle< T >::get().
{
dynamic_cast<BasicClientCall *>(h->getAppDialogSet().get())->onStaleCallTimeout(h);
}

| void BasicClientUserAgent::onSuccess | ( | resip::ClientRegistrationHandle | , |
| const resip::SipMessage & | response | ||
| ) | [protected, virtual] |
Called when registraion succeeds or each time it is sucessfully refreshed.
Implements resip::ClientRegistrationHandler.
Definition at line 516 of file basicClientUserAgent.cxx.
References BasicClientCall, resip::Message::brief(), resip::Data::empty(), resip::Handle< T >::getId(), resip::Uri::host(), InfoLog, resip::BasicClientCall::initiateCall(), resip::DialogUsageManager::makeSubscription(), resip::BasicClientCmdLineParser::mCallTarget, mDum, mProfile, mRegHandle, mRegistrationRetryDelayTime, resip::BasicClientCmdLineParser::mSubscribeTarget, and resip::DialogUsageManager::send().
{
InfoLog(<< "onSuccess(ClientRegistrationHandle): msg=" << msg.brief());
if(mRegHandle.getId() == 0) // Note: reg handle id will only be 0 on first successful registration
{
// Check if we should try to form a test subscription
if(!mSubscribeTarget.host().empty())
{
SharedPtr<SipMessage> sub = mDum->makeSubscription(NameAddr(mSubscribeTarget), mProfile, "basicClientTest");
mDum->send(sub);
}
// Check if we should try to form a test call
if(!mCallTarget.host().empty())
{
BasicClientCall* newCall = new BasicClientCall(*this);
newCall->initiateCall(mCallTarget, mProfile);
}
}
mRegHandle = h;
mRegistrationRetryDelayTime = 0; // reset
}

| void BasicClientUserAgent::onSuccess | ( | resip::ClientOutOfDialogReqHandle | , |
| const resip::SipMessage & | response | ||
| ) | [protected, virtual] |
Implements resip::OutOfDialogHandler.
Definition at line 997 of file basicClientUserAgent.cxx.
References resip::Message::brief(), and InfoLog.
{
InfoLog(<< "onSuccess(ClientOutOfDialogReqHandle): " << msg.brief());
}

| void BasicClientUserAgent::onTerminated | ( | resip::ClientSubscriptionHandle | h, |
| const resip::SipMessage * | notify | ||
| ) | [protected, virtual] |
Implements resip::ClientSubscriptionHandler.
Definition at line 839 of file basicClientUserAgent.cxx.
References resip::Message::brief(), resip::Handle< T >::get(), InfoLog, and resip::BasicClientCall::onTerminated().
Referenced by onTerminated().
{
BasicClientCall* call = dynamic_cast<BasicClientCall *>(h->getAppDialogSet().get());
if(call)
{
call->onTerminated(h, msg);
return;
}
if(msg)
{
InfoLog(<< "onTerminated(ClientSubscriptionHandle): msg=" << msg->brief());
}
else
{
InfoLog(<< "onTerminated(ClientSubscriptionHandle)");
}
}

| void BasicClientUserAgent::onTerminated | ( | resip::InviteSessionHandle | h, |
| resip::InviteSessionHandler::TerminatedReason | reason, | ||
| const resip::SipMessage * | msg | ||
| ) | [protected, virtual] |
Implements resip::InviteSessionHandler.
Definition at line 626 of file basicClientUserAgent.cxx.
References resip::Handle< T >::get(), and onTerminated().
{
dynamic_cast<BasicClientCall *>(h->getAppDialogSet().get())->onTerminated(h, reason, msg);
}

| void BasicClientUserAgent::onTerminated | ( | resip::ServerSubscriptionHandle | ) | [protected, virtual] |
Implements resip::ServerSubscriptionHandler.
Definition at line 947 of file basicClientUserAgent.cxx.
References InfoLog.
{
InfoLog(<< "onTerminated(ServerSubscriptionHandle)");
}
| void BasicClientUserAgent::onTrying | ( | resip::AppDialogSetHandle | h, |
| const resip::SipMessage & | msg | ||
| ) | [protected, virtual] |
Implements resip::DialogSetHandler.
Definition at line 756 of file basicClientUserAgent.cxx.
References resip::Message::brief(), resip::Handle< T >::get(), InfoLog, and resip::BasicClientCall::onTrying().
{
BasicClientCall *call = dynamic_cast<BasicClientCall *>(h.get());
if(call)
{
call->onTrying(h, msg);
}
else
{
InfoLog(<< "onTrying(AppDialogSetHandle): " << msg.brief());
}
}

| bool BasicClientUserAgent::onTryingNextTarget | ( | resip::AppDialogSetHandle | , |
| const resip::SipMessage & | request | ||
| ) | [protected, virtual] |
Implements resip::RedirectHandler.
Definition at line 1045 of file basicClientUserAgent.cxx.
References resip::Message::brief(), and InfoLog.
{
InfoLog(<< "onTryingNextTarget(AppDialogSetHandle): " << msg.brief());
// Always allow redirection for now
return true;
}

| void BasicClientUserAgent::onUpdateActive | ( | resip::ClientSubscriptionHandle | h, |
| const resip::SipMessage & | notify, | ||
| bool | outOfOrder | ||
| ) | [protected, virtual] |
Implements resip::ClientSubscriptionHandler.
Definition at line 800 of file basicClientUserAgent.cxx.
References resip::Message::brief(), resip::Handle< T >::get(), InfoLog, and resip::BasicClientCall::onUpdateActive().
{
BasicClientCall* call = dynamic_cast<BasicClientCall *>(h->getAppDialogSet().get());
if(call)
{
call->onUpdateActive(h, msg, outOfOrder);
return;
}
InfoLog(<< "onUpdateActive(ClientSubscriptionHandle): " << msg.brief());
h->acceptUpdate();
}

| void BasicClientUserAgent::onUpdateExtension | ( | resip::ClientSubscriptionHandle | h, |
| const resip::SipMessage & | notify, | ||
| bool | outOfOrder | ||
| ) | [protected, virtual] |
Implements resip::ClientSubscriptionHandler.
Definition at line 813 of file basicClientUserAgent.cxx.
References resip::Message::brief(), resip::Handle< T >::get(), InfoLog, and resip::BasicClientCall::onUpdateExtension().
{
BasicClientCall* call = dynamic_cast<BasicClientCall *>(h->getAppDialogSet().get());
if(call)
{
call->onUpdateExtension(h, msg, outOfOrder);
return;
}
InfoLog(<< "onUpdateExtension(ClientSubscriptionHandle): " << msg.brief());
h->acceptUpdate();
}

| void BasicClientUserAgent::onUpdatePending | ( | resip::ClientSubscriptionHandle | h, |
| const resip::SipMessage & | notify, | ||
| bool | outOfOrder | ||
| ) | [protected, virtual] |
Implements resip::ClientSubscriptionHandler.
Definition at line 787 of file basicClientUserAgent.cxx.
References resip::Message::brief(), resip::Handle< T >::get(), InfoLog, and resip::BasicClientCall::onUpdatePending().
{
BasicClientCall* call = dynamic_cast<BasicClientCall *>(h->getAppDialogSet().get());
if(call)
{
call->onUpdatePending(h, msg, outOfOrder);
return;
}
InfoLog(<< "onUpdatePending(ClientSubscriptionHandle): " << msg.brief());
h->acceptUpdate();
}

| void BasicClientUserAgent::post | ( | Message * | msg | ) | [protected, virtual] |
Implements resip::Postable.
Definition at line 425 of file basicClientUserAgent.cxx.
References resip::ConnectionTerminated::getFlow(), and InfoLog.
{
ConnectionTerminated* terminated = dynamic_cast<ConnectionTerminated*>(msg);
if (terminated)
{
InfoLog(<< "BasicClientUserAgent received connection terminated message for: " << terminated->getFlow());
delete msg;
return;
}
assert(false);
}

| bool BasicClientUserAgent::process | ( | int | timeoutMs | ) |
Definition at line 355 of file basicClientUserAgent.cxx.
References resip::Handle< T >::isValid(), mCallList, mClientSubscriptionHandle, mDum, mDumShutdown, mDumShutdownRequested, mRegHandle, mServerSubscriptionHandle, resip::DialogUsageManager::process(), and resip::DialogUsageManager::shutdown().
Referenced by main().
{
if(!mDumShutdown)
{
if(mDumShutdownRequested)
{
// unregister
if(mRegHandle.isValid())
{
mRegHandle->end();
}
// end any subscriptions
if(mServerSubscriptionHandle.isValid())
{
mServerSubscriptionHandle->end();
}
if(mClientSubscriptionHandle.isValid())
{
mClientSubscriptionHandle->end();
}
// End all calls - copy list in case delete/unregister of call is immediate
std::set<BasicClientCall*> tempCallList = mCallList;
std::set<BasicClientCall*>::iterator it = tempCallList.begin();
for(; it != tempCallList.end(); it++)
{
(*it)->terminateCall();
}
mDum->shutdown(this);
mDumShutdownRequested = false;
}
mDum->process(timeoutMs);
return true;
}
return false;
}

| void BasicClientUserAgent::registerCall | ( | BasicClientCall * | call | ) | [protected] |
Definition at line 480 of file basicClientUserAgent.cxx.
References mCallList.
Referenced by resip::BasicClientCall::BasicClientCall().
{
mCallList.insert(call);
}
| void BasicClientUserAgent::sendNotify | ( | ) | [protected] |
Definition at line 447 of file basicClientUserAgent.cxx.
References resip::Handle< T >::isValid(), mCurrentNotifyTimerId, mDum, mServerSubscriptionHandle, mStack, NotifySendTime, NotifyTimer, and resip::SipStack::post().
Referenced by onNewSubscription(), and onNotifyTimeout().
{
if(mServerSubscriptionHandle.isValid())
{
PlainContents plain("test notify");
mServerSubscriptionHandle->send(mServerSubscriptionHandle->update(&plain));
// start timer for next one
auto_ptr<ApplicationMessage> timer(new NotifyTimer(*this, ++mCurrentNotifyTimerId));
mStack.post(timer, NotifySendTime, mDum);
}
}

| void BasicClientUserAgent::shutdown | ( | ) | [virtual] |
Definition at line 348 of file basicClientUserAgent.cxx.
References mDum, and mDumShutdownRequested.
Referenced by main().
{
assert(mDum);
mDumShutdownRequested = true; // Set flag so that shutdown operations can be run in dum process thread
}
| void BasicClientUserAgent::startup | ( | ) | [virtual] |
Definition at line 317 of file basicClientUserAgent.cxx.
References BasicClientCall, resip::Data::empty(), resip::Uri::host(), InfoLog, resip::BasicClientCall::initiateCall(), resip::DialogUsageManager::makeRegistration(), resip::DialogUsageManager::makeSubscription(), resip::BasicClientCmdLineParser::mAor, resip::BasicClientCmdLineParser::mCallTarget, mDum, mProfile, resip::BasicClientCmdLineParser::mRegisterDuration, mStackThread, resip::BasicClientCmdLineParser::mSubscribeTarget, resip::ThreadIf::run(), and resip::DialogUsageManager::send().
Referenced by main().
{
mStackThread.run();
if (mRegisterDuration)
{
InfoLog (<< "register for " << mAor);
mDum->send(mDum->makeRegistration(NameAddr(mAor)));
}
else
{
// If not registering then form subscription and/or call here. If registering then we will start these
// after the registration is successful.
// Check if we should try to form a test subscription
if(!mSubscribeTarget.host().empty())
{
SharedPtr<SipMessage> sub = mDum->makeSubscription(NameAddr(mSubscribeTarget), mProfile, "basicClientTest");
mDum->send(sub);
}
// Check if we should try to form a test call
if(!mCallTarget.host().empty())
{
BasicClientCall* newCall = new BasicClientCall(*this);
newCall->initiateCall(mCallTarget, mProfile);
}
}
}

| void BasicClientUserAgent::unregisterCall | ( | BasicClientCall * | call | ) | [protected] |
Definition at line 486 of file basicClientUserAgent.cxx.
References mCallList.
Referenced by resip::BasicClientCall::~BasicClientCall().
friend class BasicClientCall [friend] |
Definition at line 147 of file basicClientUserAgent.hxx.
Referenced by onCallTimeout(), onSuccess(), and startup().
friend class CallTimer [friend] |
Definition at line 130 of file basicClientUserAgent.hxx.
friend class NotifyTimer [friend] |
Definition at line 127 of file basicClientUserAgent.hxx.
Referenced by sendNotify().
std::set<BasicClientCall*> resip::BasicClientUserAgent::mCallList [protected] |
Definition at line 148 of file basicClientUserAgent.hxx.
Referenced by isValidCall(), onCallTimeout(), process(), registerCall(), and unregisterCall().
Definition at line 142 of file basicClientUserAgent.hxx.
Referenced by onNewSubscription(), and process().
unsigned int resip::BasicClientUserAgent::mCurrentNotifyTimerId [protected] |
Definition at line 145 of file basicClientUserAgent.hxx.
Referenced by onNotifyTimeout(), and sendNotify().
DialogUsageManager* resip::BasicClientUserAgent::mDum [protected] |
Definition at line 136 of file basicClientUserAgent.hxx.
Referenced by BasicClientUserAgent(), getDialogUsageManager(), onNewSubscriptionFromRefer(), onSuccess(), process(), sendNotify(), shutdown(), startup(), and ~BasicClientUserAgent().
bool resip::BasicClientUserAgent::mDumShutdown [protected] |
Definition at line 140 of file basicClientUserAgent.hxx.
Referenced by onDumCanBeDeleted(), and process().
volatile bool resip::BasicClientUserAgent::mDumShutdownRequested [protected] |
Definition at line 139 of file basicClientUserAgent.hxx.
Referenced by process(), and shutdown().
SharedPtr<MasterProfile> resip::BasicClientUserAgent::mProfile [protected] |
Definition at line 133 of file basicClientUserAgent.hxx.
Referenced by BasicClientUserAgent(), getIncomingUserProfile(), onCallTimeout(), onSuccess(), and startup().
Definition at line 141 of file basicClientUserAgent.hxx.
Referenced by onFailure(), onRemoved(), onRequestRetry(), onSuccess(), and process().
unsigned int resip::BasicClientUserAgent::mRegistrationRetryDelayTime [protected] |
Definition at line 144 of file basicClientUserAgent.hxx.
Referenced by onRequestRetry(), and onSuccess().
Security* resip::BasicClientUserAgent::mSecurity [protected] |
Definition at line 134 of file basicClientUserAgent.hxx.
Definition at line 137 of file basicClientUserAgent.hxx.
Definition at line 143 of file basicClientUserAgent.hxx.
Referenced by onNewSubscription(), process(), and sendNotify().
SipStack resip::BasicClientUserAgent::mStack [protected] |
Definition at line 135 of file basicClientUserAgent.hxx.
Referenced by addTransport(), BasicClientUserAgent(), resip::BasicClientCall::onConnected(), sendNotify(), and resip::BasicClientCall::timerExpired().
Definition at line 138 of file basicClientUserAgent.hxx.
Referenced by startup(), and ~BasicClientUserAgent().
1.7.5.1