[asterisk-scf-commits] asterisk-scf/release/sip.git branch "master" updated.
Commits to the Asterisk SCF project code repositories
asterisk-scf-commits at lists.digium.com
Thu May 19 11:58:37 CDT 2011
branch "master" has been updated
via 8eb9a6461494bff1489e01b5541b569e7ecef3bc (commit)
via 40f2cf7feed6d313e0f59a3188906960ea0eb84c (commit)
from 958eccbe685be31e05b8651dd7bc3a72a3d11c99 (commit)
Summary of changes:
config/Sip.config | 2 ++
config/SipConfigurator.py | 3 +++
local-slice/SipConfigurationIf.ice | 5 +++++
src/SipConfiguration.cpp | 10 ++++++++++
src/SipEndpoint.cpp | 9 +++++++--
src/SipEndpoint.h | 4 ++++
src/SipSession.cpp | 33 +++++++++++++++++++++++----------
src/SipSession.h | 5 +++--
8 files changed, 57 insertions(+), 14 deletions(-)
- Log -----------------------------------------------------------------
commit 8eb9a6461494bff1489e01b5541b569e7ecef3bc
Merge: 958eccb 40f2cf7
Author: Joshua Colp <jcolp at digium.com>
Date: Thu May 19 13:59:10 2011 -0300
Merge branch 'rtp-ipv6'
commit 40f2cf7feed6d313e0f59a3188906960ea0eb84c
Author: Joshua Colp <jcolp at digium.com>
Date: Tue May 17 14:02:32 2011 -0300
Add support for RTP over IPv6.
diff --git a/config/Sip.config b/config/Sip.config
index 048a751..e1f3937 100644
--- a/config/Sip.config
+++ b/config/Sip.config
@@ -75,3 +75,5 @@ targetport=5060
#sourceport=
# What directions calls are permitted in. Valid options are inbound, outbound, and both.
direction=both
+# Whether to use IPv6 for media transport or not
+rtpoveripv6=no
diff --git a/config/SipConfigurator.py b/config/SipConfigurator.py
index d04f2ac..4b820f2 100755
--- a/config/SipConfigurator.py
+++ b/config/SipConfigurator.py
@@ -111,6 +111,9 @@ class SipSectionVisitors(Configurator.SectionVisitors):
transformer = AllowableCallDirectionTransformer(config)
mapper.map('direction', AsteriskSCF.SIP.V1.SipAllowableCallDirectionItem(), 'callDirection', 'callDirection', transformer.get, None)
+ item = AsteriskSCF.SIP.V1.RTPMediaServiceItem()
+ mapper.map('rtpoveripv6', item, 'requireIPv6', 'mediaservice', config.getboolean, None)
+
item = AsteriskSCF.SIP.V1.SipCryptoCertificateItem()
mapper.map('certificateauthorityfile', item, 'certificateAuthority', 'cryptocert', config.get, None)
mapper.map('certificatefile', item, 'certificate', 'cryptocert', config.get, None)
@@ -161,6 +164,10 @@ class SipSectionVisitors(Configurator.SectionVisitors):
elif config.get(section, 'type') == 'endpoint':
self.visit_endpoint(config, section)
+# In order to do service locator based lookup we need to pass in a params object
+serviceLocatorParams = AsteriskSCF.SIP.V1.SipConfigurationParams()
+serviceLocatorParams.category = AsteriskSCF.SIP.V1.ConfigurationDiscoveryCategory
+
# Make a configurator application and let it run
-app = Configurator.ConfiguratorApp('Sip.config', SipSectionVisitors())
+app = Configurator.ConfiguratorApp('Sip.config', SipSectionVisitors(), None, serviceLocatorParams)
sys.exit(app.main(sys.argv))
diff --git a/local-slice/SipConfigurationIf.ice b/local-slice/SipConfigurationIf.ice
index 58cae24..14f700a 100644
--- a/local-slice/SipConfigurationIf.ice
+++ b/local-slice/SipConfigurationIf.ice
@@ -241,6 +241,11 @@ module V1
* Name of the RTP media service to use
*/
string mediaServiceName;
+
+ /**
+ * Whether to choose an IPv6 RTP media service or not
+ */
+ bool requireIPv6 = false;
};
/**
diff --git a/src/SipConfiguration.cpp b/src/SipConfiguration.cpp
index bfd715d..1b40dad 100644
--- a/src/SipConfiguration.cpp
+++ b/src/SipConfiguration.cpp
@@ -194,6 +194,11 @@ class EndpointConfigHelper : public boost::enable_shared_from_this<EndpointConfi
mUpdates.push_back(boost::bind(&EndpointConfigHelper::updateTarget, mConfig, target));
};
+ void visitSipRTPMediaServiceItem(const SipRTPMediaServiceItemPtr& service)
+ {
+ mUpdates.push_back(boost::bind(&EndpointConfigHelper::updateMediaService, mConfig, service));
+ };
+
private:
UpdateCommandList mUpdates;;
@@ -258,6 +263,11 @@ public:
mEndpoint->setTargetAddress(target->host, target->port);
}
+ void updateMediaService(const SipRTPMediaServiceItemPtr& service)
+ {
+ mEndpoint->setRTPOverIPv6(service->requireIPv6);
+ }
+
void updated(const UpdateCommandList& updates)
{
//
diff --git a/src/SipEndpoint.cpp b/src/SipEndpoint.cpp
index e066cd4..c130685 100644
--- a/src/SipEndpoint.cpp
+++ b/src/SipEndpoint.cpp
@@ -149,6 +149,11 @@ void SipEndpoint::setCallDirection(enum Direction direction)
mImplPriv->mConfig.sessionConfig.callDirection = direction;
}
+void SipEndpoint::setRTPOverIPv6(bool enabled)
+{
+ mImplPriv->mConfig.sessionConfig.rtpOverIPv6 = enabled;
+}
+
void SipEndpoint::setConfiguration(const Ice::PropertyDict& props)
{
setTransportConfiguration(props);
@@ -265,7 +270,7 @@ AsteriskSCF::SessionCommunications::V1::SessionPrx SipEndpoint::createSession(co
}
SipSessionPtr session = new SipSession(mImplPriv->mAdapter, this, destination, listener, mImplPriv->mManager,
- mImplPriv->mServiceLocator, mImplPriv->mReplica);
+ mImplPriv->mServiceLocator, mImplPriv->mReplica, mImplPriv->mConfig.sessionConfig.rtpOverIPv6);
mImplPriv->mSessions.push_back(session);
return session->getSessionProxy();
}
@@ -273,7 +278,7 @@ AsteriskSCF::SessionCommunications::V1::SessionPrx SipEndpoint::createSession(co
AsteriskSCF::SipSessionManager::SipSessionPtr SipEndpoint::createSession(const std::string& destination)
{
SipSessionPtr session = new SipSession(mImplPriv->mAdapter, this, destination, 0, mImplPriv->mManager,
- mImplPriv->mServiceLocator, mImplPriv->mReplica);
+ mImplPriv->mServiceLocator, mImplPriv->mReplica, mImplPriv->mConfig.sessionConfig.rtpOverIPv6);
mImplPriv->mSessions.push_back(session);
return session;
}
diff --git a/src/SipEndpoint.h b/src/SipEndpoint.h
index 1eb9680..2f5e011 100644
--- a/src/SipEndpoint.h
+++ b/src/SipEndpoint.h
@@ -138,6 +138,9 @@ public:
// The source IP address and port to use
// when contacting this endpoint.
std::string sourceAddress;
+ // Whether we are using IPv6 for media transport
+ // or not.
+ bool rtpOverIPv6;
};
/**
@@ -254,6 +257,7 @@ public:
void setSourceAddress(std::string, int);
void setTargetAddress(std::string, int);
void setCallDirection(enum Direction);
+ void setRTPOverIPv6(bool);
private:
/**
diff --git a/src/SipSession.cpp b/src/SipSession.cpp
index 2b36d1f..6f06e3f 100644
--- a/src/SipSession.cpp
+++ b/src/SipSession.cpp
@@ -173,7 +173,7 @@ public:
SipSession::SipSession(const Ice::ObjectAdapterPtr& adapter, const SipEndpointPtr& endpoint,
const std::string& destination, const AsteriskSCF::SessionCommunications::V1::SessionListenerPrx& listener,
PJSipManager *manager, const AsteriskSCF::Core::Discovery::V1::ServiceLocatorPrx& serviceLocator,
- const AsteriskSCF::System::Component::V1::ReplicaPtr& replica)
+ const AsteriskSCF::System::Component::V1::ReplicaPtr& replica, bool ipv6)
: mImplPriv(new SipSessionPriv(adapter, endpoint, destination, manager, serviceLocator, replica))
{
if (listener != 0)
@@ -190,7 +190,7 @@ SipSession::SipSession(const Ice::ObjectAdapterPtr& adapter, const SipEndpointPt
// Get an RTP session capable of handling the formats we are going to offer
AsteriskSCF::Media::V1::FormatSeq formats;
- requestRTPSessions(formats);
+ requestRTPSessions(formats, ipv6);
}
/**
@@ -560,22 +560,33 @@ pjmedia_sdp_session *SipSession::createSDPOffer()
pj_gettimeofday(&tv);
sdp->origin.version = sdp->origin.id = (pj_uint32_t) (tv.sec + 2208988800UL);
pj_strdup2(mImplPriv->mDialog->pool, &sdp->origin.net_type, "IN");
- pj_strdup2(mImplPriv->mDialog->pool, &sdp->origin.addr_type, "IP4");
+
+ // Right now we only support a single stream so go and get it
+ AsteriskSCF::Media::RTP::V1::StreamSourceRTPPrx stream =
+ AsteriskSCF::Media::RTP::V1::StreamSourceRTPPrx::uncheckedCast(mImplPriv->mSources.front());
+
+ std::string address = stream->getLocalAddress();
+
+ if (address.find(":") != std::string::npos)
+ {
+ pj_strdup2(mImplPriv->mDialog->pool, &sdp->origin.addr_type, "IP6");
+ }
+ else
+ {
+ pj_strdup2(mImplPriv->mDialog->pool, &sdp->origin.addr_type, "IP4");
+ }
+
sdp->origin.addr = *pj_gethostname();
sdp->name = sdp->origin.user;
sdp->time.start = 0;
sdp->time.stop = 0;
sdp->attr_count = 0;
- // Right now we only support a single stream so go and get it
- AsteriskSCF::Media::RTP::V1::StreamSourceRTPPrx stream =
- AsteriskSCF::Media::RTP::V1::StreamSourceRTPPrx::uncheckedCast(mImplPriv->mSources.front());
-
// Add connection details at the session level since we currently only support one media stream.
sdp->conn = static_cast<pjmedia_sdp_conn*>(pj_pool_zalloc(mImplPriv->mDialog->pool, sizeof(pjmedia_sdp_conn)));
sdp->conn->net_type = sdp->origin.net_type;
sdp->conn->addr_type = sdp->origin.addr_type;
- pj_strdup2(mImplPriv->mDialog->pool, &sdp->conn->addr, stream->getLocalAddress().c_str());
+ pj_strdup2(mImplPriv->mDialog->pool, &sdp->conn->addr, address.c_str());
// Add a single media stream
sdp->media_count = 1;
@@ -615,16 +626,18 @@ pjmedia_sdp_session *SipSession::createSDPOffer()
/**
* Internal function called to request needed RTP sessions.
*/
-void SipSession::requestRTPSessions(AsteriskSCF::Media::V1::FormatSeq& formats)
+void SipSession::requestRTPSessions(AsteriskSCF::Media::V1::FormatSeq& formats, bool ipv6)
{
// TODO: This needs to be improved for multiple streams
AsteriskSCF::Media::RTP::V1::RTPServiceLocatorParamsPtr params =
new AsteriskSCF::Media::RTP::V1::RTPServiceLocatorParams();
params->category = "rtp";
+ params->formats = formats;
+ params->ipv6 = ipv6;
AsteriskSCF::Media::RTP::V1::RTPMediaServicePrx factory =
AsteriskSCF::Media::RTP::V1::RTPMediaServicePrx::uncheckedCast(mImplPriv->mServiceLocator->locate(params));
- AsteriskSCF::Media::RTP::V1::RTPSessionPrx session = factory->allocate(formats);
+ AsteriskSCF::Media::RTP::V1::RTPSessionPrx session = factory->allocate(params);
mImplPriv->mRTPSessions.push_back(session);
// Create a local copy of the sources, this won't get changed by the RTP session so it's all good
diff --git a/src/SipSession.h b/src/SipSession.h
index 643e70e..e18c480 100644
--- a/src/SipSession.h
+++ b/src/SipSession.h
@@ -62,7 +62,8 @@ public:
SipSession(const Ice::ObjectAdapterPtr&, const SipEndpointPtr&, const std::string&,
const AsteriskSCF::SessionCommunications::V1::SessionListenerPrx&, PJSipManager *manager,
const AsteriskSCF::Core::Discovery::V1::ServiceLocatorPrx& serviceLocator,
- const AsteriskSCF::System::Component::V1::ReplicaPtr& replica);
+ const AsteriskSCF::System::Component::V1::ReplicaPtr& replica,
+ bool ipv6);
SipSession(const Ice::ObjectAdapterPtr&, const SipEndpointPtr&, const std::string&, const Ice::Identity&,
const Ice::Identity&, const AsteriskSCF::Media::V1::SessionPrx&,
@@ -133,7 +134,7 @@ public:
AsteriskSCF::Media::V1::SessionPrx getHiddenMediaSession();
private:
- void requestRTPSessions(AsteriskSCF::Media::V1::FormatSeq& formats);
+ void requestRTPSessions(AsteriskSCF::Media::V1::FormatSeq& formats, bool ipv6);
/**
* Private implementation details.
-----------------------------------------------------------------------
--
asterisk-scf/release/sip.git
More information about the asterisk-scf-commits
mailing list