[asterisk-scf-commits] asterisk-scf/integration/sip.git branch "jira-astscf-397-sipuseragent" updated.
Commits to the Asterisk SCF project code repositories
asterisk-scf-commits at lists.digium.com
Wed Jan 18 14:24:06 CST 2012
branch "jira-astscf-397-sipuseragent" has been updated
via e342af22bb693c2ce2abb7b2382331ad0d568790 (commit)
via 1e0c8436c2926ff66065aa34a7c7484e5af92d32 (commit)
from d1d1ac375f2c94c687bb47307d96a6c5b4fdf8e7 (commit)
Summary of changes:
config/SipConfigurator.py | 2 +
src/PJSIPSessionModule.cpp | 62 +++++++++++++++++++++++++++++++++++++++++++-
src/SIPConfiguration.cpp | 7 +++++
src/SIPEndpoint.cpp | 15 ++++++++++
src/SIPEndpoint.h | 21 +++++++++++++++
src/SIPSession.cpp | 21 ++++++++++++---
6 files changed, 123 insertions(+), 5 deletions(-)
- Log -----------------------------------------------------------------
commit e342af22bb693c2ce2abb7b2382331ad0d568790
Author: Brent Eagles <beagles at digium.com>
Date: Wed Jan 18 16:53:01 2012 -0330
Added a check to make sure that the smart proxy for the session router is
only overridden if the configured and default values differ.
diff --git a/src/PJSIPSessionModule.cpp b/src/PJSIPSessionModule.cpp
index 48b765b..12a0f08 100644
--- a/src/PJSIPSessionModule.cpp
+++ b/src/PJSIPSessionModule.cpp
@@ -419,12 +419,18 @@ protected:
{
AsteriskSCF::Core::Discovery::V1::ServiceLocatorParamsPtr locationParameters =
sessionRouter.getLocationParameters();
- locationParameters->service = endpointConfig.sessionConfig.routingServiceName;
//
- // This should throw a 'ServiceNotFound' et al. if it is bogus.
+ // Only change them if they are not equal.
//
- sessionRouter = AsteriskSCF::Discovery::SmartProxy<SessionRouterPrx>(
- sessionRouter.getLocator(), locationParameters, lg);
+ if (locationParameters->service != endpointConfig.sessionConfig.routingServiceName)
+ {
+ locationParameters->service = endpointConfig.sessionConfig.routingServiceName;
+ //
+ // This should throw a 'ServiceNotFound' et al. if it is bogus.
+ //
+ sessionRouter = AsteriskSCF::Discovery::SmartProxy<SessionRouterPrx>(
+ sessionRouter.getLocator(), locationParameters, lg);
+ }
}
catch (const std::exception& ex)
{
commit 1e0c8436c2926ff66065aa34a7c7484e5af92d32
Author: Brent Eagles <beagles at digium.com>
Date: Wed Jan 18 16:48:01 2012 -0330
Changes to incorporate user agent header setting, propagate different media
service name configurations as well as the routing service configuration
name. The latter involved adding an override in the PJSSIPSessionModule
prior to call begin_routeSession().
diff --git a/config/SipConfigurator.py b/config/SipConfigurator.py
index d7aa10b..67af390 100755
--- a/config/SipConfigurator.py
+++ b/config/SipConfigurator.py
@@ -255,6 +255,7 @@ class SIPSectionVisitors(Configurator.SectionVisitors):
item = AsteriskSCF.Configuration.SIPSessionManager.V1.SIPRTPMediaServiceItem()
mapper.map('rtpoveripv6', item, 'requireIPv6', 'mediaservice', config.getboolean, None)
+ mapper.map('rtpmediaservice', item, 'mediaServiceName', 'mediaservice', config.get, None)
item = AsteriskSCF.Configuration.SIPSessionManager.V1.DirectMediaItem()
mapper.map('directmedia', item, 'enabled', 'directmedia', config.getboolean, None)
@@ -263,6 +264,7 @@ class SIPSectionVisitors(Configurator.SectionVisitors):
mapper.map('udptloveripv6', item, 'requireIPv6', 'udptlmediaservice', config.getboolean, None)
mapper.map('udptloverice', item, 'enableICE', 'udptlmediaservice', config.getboolean, None)
mapper.map('udptlwithturn', item, 'enableTURN', 'udptlmediaservice', config.getboolean, None)
+ mapper.map('udptlmediaservice', item, 'mediaServiceName', 'udptlmediaservice', config.get, None);
item = AsteriskSCF.Configuration.SIPSessionManager.V1.SIPCryptoCertificateItem()
mapper.map('certificateauthorityfile', item, 'certificateAuthority', 'cryptocert', config.get, None)
diff --git a/src/PJSIPSessionModule.cpp b/src/PJSIPSessionModule.cpp
index 8bedeb0..48b765b 100644
--- a/src/PJSIPSessionModule.cpp
+++ b/src/PJSIPSessionModule.cpp
@@ -409,6 +409,60 @@ protected:
return Complete;
}
+ AsteriskSCF::Discovery::SmartProxy<SessionRouterPrx> sessionRouter = mSessionRouter;
+
+ SIPEndpointConfig endpointConfig = mCaller->getConfig();
+ if (!endpointConfig.sessionConfig.routingServiceName.empty())
+ {
+ lg(Trace) << "overriding default session router";
+ try
+ {
+ AsteriskSCF::Core::Discovery::V1::ServiceLocatorParamsPtr locationParameters =
+ sessionRouter.getLocationParameters();
+ locationParameters->service = endpointConfig.sessionConfig.routingServiceName;
+ //
+ // This should throw a 'ServiceNotFound' et al. if it is bogus.
+ //
+ sessionRouter = AsteriskSCF::Discovery::SmartProxy<SessionRouterPrx>(
+ sessionRouter.getLocator(), locationParameters, lg);
+ }
+ catch (const std::exception& ex)
+ {
+ lg(Error) << "Caught an " << ex.what() <<
+ " while trying to locate configured session routing component: "
+ << endpointConfig.sessionConfig.routingServiceName << ", responding with 500";
+ //
+ // Everything else doesn't really map so they just become internal server errors
+ //
+ if (success(pjsip_inv_end_session(mInv, 500, NULL, &mTdata)))
+ {
+ pjsip_inv_send_msg(mInv, mTdata);
+ }
+ else
+ {
+ lg(Warning) << "Unable to create 500 response for INVITE";
+ }
+ }
+ catch (...)
+ {
+ lg(Error) << "Caught an unknown exception " <<
+ " while trying to locate configured session routing component: "
+ << endpointConfig.sessionConfig.routingServiceName << ", responding with 500";
+
+ //
+ // Everything else doesn't really map so they just become internal server errors
+ //
+ if (success(pjsip_inv_end_session(mInv, 500, NULL, &mTdata)))
+ {
+ pjsip_inv_send_msg(mInv, mTdata);
+ }
+ else
+ {
+ lg(Warning) << "Unable to create 500 response for INVITE";
+ }
+ }
+ }
+
mSession->setInviteSession(mInv);
mSession->setDialog(mInv->dlg);
@@ -480,7 +534,7 @@ protected:
SuspendableWorkListenerPtr listener = 0;
SIPAMICallbackPtr cb(new SIPAMICallback(listener, mSession, this, false, true));
Ice::CallbackPtr d = Ice::newCallback(cb, &SIPAMICallback::callback);
- mSessionRouter->begin_routeSession(operationId, mSession->getSessionProxy(), mDestination, 0, mCallerID, mRedirections, d);
+ sessionRouter->begin_routeSession(operationId, mSession->getSessionProxy(), mDestination, 0, mCallerID, mRedirections, d);
}
}
catch (const Ice::CommunicatorDestroyedException &)
diff --git a/src/SIPConfiguration.cpp b/src/SIPConfiguration.cpp
index 9699a63..484d7a2 100644
--- a/src/SIPConfiguration.cpp
+++ b/src/SIPConfiguration.cpp
@@ -590,11 +590,13 @@ public:
void updateMediaService(const SIPRTPMediaServiceItemPtr& service)
{
+ mEndpoint->setMediaServiceName(service->mediaServiceName);
mEndpoint->setRTPOverIPv6(service->requireIPv6);
}
void updateUDPTLMediaService(const SIPUDPTLMediaServiceItemPtr& service)
{
+ mEndpoint->setUDPTLMediaServiceName(service->mediaServiceName);
mEndpoint->setUDPTLOverIPv6(service->requireIPv6);
mEndpoint->enableUDPTLICE(service->enableICE);
mEndpoint->enableUDPTLTURN(service->enableTURN);
@@ -605,6 +607,11 @@ public:
mEndpoint->setSecureTransport(translateCallDirection(transport->secureTransport));
}
+ void updateRouting(const SIPRoutingItemPtr& item)
+ {
+ mEndpoint->setRoutingServiceName(item->routingServiceName);
+ }
+
void updateSRTP(const SRTPCryptoItemPtr& srtpOptions)
{
SIPEndpointMediaSRTPConfig srtpConfig(mEndpoint->getConfig().srtpConfig);
diff --git a/src/SIPEndpoint.cpp b/src/SIPEndpoint.cpp
index 1081e9c..e630e39 100644
--- a/src/SIPEndpoint.cpp
+++ b/src/SIPEndpoint.cpp
@@ -448,6 +448,21 @@ void SIPEndpoint::enableUDPTLTURN(bool enabled)
mImplPriv->mConfig.sessionConfig.udptlWithTURN = enabled;
}
+void SIPEndpoint::setMediaServiceName(const string& serviceName)
+{
+ mImplPriv->mConfig.sessionConfig.mediaServiceName = serviceName;
+}
+
+void SIPEndpoint::setUDPTLMediaServiceName(const string& serviceName)
+{
+ mImplPriv->mConfig.sessionConfig.udptlServiceName = serviceName;
+}
+
+void SIPEndpoint::setRoutingServiceName(const string& serviceName)
+{
+ mImplPriv->mConfig.sessionConfig.routingServiceName = serviceName;
+}
+
void SIPEndpoint::setMediaNATOptions(bool useICE, bool useTURN)
{
mImplPriv->mConfig.sessionConfig.rtpOverICE = useICE;
diff --git a/src/SIPEndpoint.h b/src/SIPEndpoint.h
index cbf447f..c5fb88d 100644
--- a/src/SIPEndpoint.h
+++ b/src/SIPEndpoint.h
@@ -181,6 +181,24 @@ public:
//
bool rtpICEIncludeTURN;
+ //
+ // The service name identifier to use in locator queries for the RTP
+ // media component.
+ //
+ std::string mediaServiceName;
+
+ //
+ // The service name identifier to use in locator queries for the UDPTL
+ // component.
+ //
+ std::string udptlServiceName;
+
+ //
+ // The service name identifier to use in locator queries for the
+ // routing component.
+ //
+ std::string routingServiceName;
+
SIPEndpointSessionConfig() :
rtpOverIPv6(false),
rtpOverICE(false),
@@ -355,6 +373,9 @@ public:
void setUDPTLOverIPv6(bool);
void enableUDPTLICE(bool);
void enableUDPTLTURN(bool);
+ void setMediaServiceName(const std::string& serviceName);
+ void setUDPTLMediaServiceName(const std::string& serviceName);
+ void setRoutingServiceName(const std::string& serviceName);
void addFormat(const std::string& name, int sampleRate, int frameSize, const Ice::StringSeq& formatSpecific);
/**
diff --git a/src/SIPSession.cpp b/src/SIPSession.cpp
index cff2dcb..69adb5c 100755
--- a/src/SIPSession.cpp
+++ b/src/SIPSession.cpp
@@ -3093,10 +3093,15 @@ pjmedia_sdp_session *SIPSession::createSDPOffer(const AsteriskSCF::Media::V1::St
// If this stream contains an audio or video format the stream is transported using RTP
if ((audio = AudioFormatPtr::dynamicCast(formats.front())) || (video = VideoFormatPtr::dynamicCast(formats.front())))
{
+ SIPEndpointConfig& config = mImplPriv->mEndpoint->getConfig();
RTPServiceLocatorParamsPtr params = new RTPServiceLocatorParams();
params->category = "rtp";
params->formats = stream->second->formats;
params->ipv6 = mImplPriv->mEndpoint->getConfig().sessionConfig.rtpOverIPv6;
+ if (!config.sessionConfig.mediaServiceName.empty())
+ {
+ params->service = config.sessionConfig.mediaServiceName;
+ }
// Try to find a factory for RTP sessions matching what we need
RTPMediaServicePrx factory = RTPMediaServicePrx::uncheckedCast(mImplPriv->mServiceLocator->locate(params));
@@ -3111,7 +3116,6 @@ pjmedia_sdp_session *SIPSession::createSDPOffer(const AsteriskSCF::Media::V1::St
RTPOptionsPtr options(new RTPOptions());
RTPAllocationOutputsPtr outputs;
- SIPEndpointConfig& config = mImplPriv->mEndpoint->getConfig();
if (config.sessionConfig.dtmf == AsteriskSCF::Configuration::SIPSessionManager::V1::RFC4733)
{
options->handleTelephonyEvents = true;
@@ -3213,10 +3217,15 @@ pjmedia_sdp_session *SIPSession::createSDPOffer(const AsteriskSCF::Media::V1::St
{
params = new AsteriskSCF::Media::UDPTL::V1::UDPTLServiceLocatorParams;
}
+ SIPEndpointConfig config = mImplPriv->mEndpoint->getConfig();
params->category = "udptl";
- params->ipv6 = mImplPriv->mEndpoint->getConfig().sessionConfig.udptlOverIPv6;
-
+ params->ipv6 = config.sessionConfig.udptlOverIPv6;
+ if (!config.sessionConfig.udptlServiceName.empty())
+ {
+ params->service = config.sessionConfig.udptlServiceName;
+ }
+
UDPTLMediaServicePrx factory = UDPTLMediaServicePrx::uncheckedCast(mImplPriv->mServiceLocator->locate(params));
if (factory == 0)
{
@@ -3601,11 +3610,15 @@ pjmedia_sdp_session *SIPSession::createSDPAnswer(const pjmedia_sdp_session* offe
RTPOptionsPtr options(new RTPOptions());
RTPAllocationOutputsPtr outputs;
- SIPEndpointConfig& config = mImplPriv->mEndpoint->getConfig();
+ SIPEndpointConfig config = mImplPriv->mEndpoint->getConfig();
if (config.sessionConfig.dtmf == AsteriskSCF::Configuration::SIPSessionManager::V1::RFC4733)
{
options->handleTelephonyEvents = true;
}
+ if (!config.sessionConfig.mediaServiceName.empty())
+ {
+ params->service = config.sessionConfig.mediaServiceName;
+ }
session = factory->allocate(params, options, outputs);
-----------------------------------------------------------------------
--
asterisk-scf/integration/sip.git
More information about the asterisk-scf-commits
mailing list