[asterisk-scf-commits] asterisk-scf/integration/sip.git branch "directmedia" updated.
Commits to the Asterisk SCF project code repositories
asterisk-scf-commits at lists.digium.com
Thu Jul 28 16:48:43 CDT 2011
branch "directmedia" has been updated
via ff2e2cf69648586840f9570f807e986ba43603df (commit)
from 7c4596823c88ab5310e64ca48f4b5d9f1b399087 (commit)
Summary of changes:
config/Sip.config | 2 ++
config/SipConfigurator.py | 3 +++
.../SipSessionManager/SipConfigurationIf.ice | 11 +++++++++++
src/SipConfiguration.cpp | 10 ++++++++++
src/SipEndpoint.cpp | 5 +++++
src/SipEndpoint.h | 3 +++
src/SipSession.cpp | 8 ++++++++
7 files changed, 42 insertions(+), 0 deletions(-)
- Log -----------------------------------------------------------------
commit ff2e2cf69648586840f9570f807e986ba43603df
Author: Joshua Colp <jcolp at digium.com>
Date: Thu Jul 28 18:48:30 2011 -0300
Add configuration option to enable or disable direct media support.
diff --git a/config/Sip.config b/config/Sip.config
index ac8e349..6ba2f3b 100644
--- a/config/Sip.config
+++ b/config/Sip.config
@@ -82,3 +82,5 @@ rtpoveripv6=no
# Allowable media formats for the endpoint. Each format is separated using , and follows the format
# <name>/<sample rate>@<frame size>;<format specific parameters>
formats=ulaw/8000,alaw/8000
+# Whether media should be allowed to flow directly between endpoints or not
+directmedia=no
diff --git a/config/SipConfigurator.py b/config/SipConfigurator.py
index 1d34378..894b674 100755
--- a/config/SipConfigurator.py
+++ b/config/SipConfigurator.py
@@ -119,6 +119,9 @@ class SipSectionVisitors(Configurator.SectionVisitors):
item = AsteriskSCF.Configuration.SipSessionManager.V1.SipRTPMediaServiceItem()
mapper.map('rtpoveripv6', item, 'requireIPv6', 'mediaservice', config.getboolean, None)
+ item = AsteriskSCF.Configuration.SipSessionManager.V1.DirectMediaItem()
+ mapper.map('directmedia', item, 'enabled', 'directmedia', config.getboolean, None)
+
item = AsteriskSCF.Configuration.SipSessionManager.V1.SipCryptoCertificateItem()
mapper.map('certificateauthorityfile', item, 'certificateAuthority', 'cryptocert', config.get, None)
mapper.map('certificatefile', item, 'certificate', 'cryptocert', config.get, None)
diff --git a/slice/AsteriskSCF/Configuration/SipSessionManager/SipConfigurationIf.ice b/slice/AsteriskSCF/Configuration/SipSessionManager/SipConfigurationIf.ice
index 7d3b57b..f1c90c7 100644
--- a/slice/AsteriskSCF/Configuration/SipSessionManager/SipConfigurationIf.ice
+++ b/slice/AsteriskSCF/Configuration/SipSessionManager/SipConfigurationIf.ice
@@ -256,6 +256,17 @@ module V1
};
/**
+ * Direct media configuration item
+ */
+ class DirectMediaItem extends SipConfigurationItem
+ {
+ /**
+ * Whether direct media support is enabled or not
+ */
+ bool enabled = false;
+ };
+
+ /**
* RTP Media service configuration item
*/
class SipRTPMediaServiceItem extends SipConfigurationItem
diff --git a/src/SipConfiguration.cpp b/src/SipConfiguration.cpp
index d4077a8..c60a3bb 100644
--- a/src/SipConfiguration.cpp
+++ b/src/SipConfiguration.cpp
@@ -199,6 +199,11 @@ class EndpointConfigHelper : public boost::enable_shared_from_this<EndpointConfi
mUpdates.push_back(boost::bind(&EndpointConfigHelper::updateTarget, mConfig, target));
};
+ void visitDirectMediaItem(const DirectMediaItemPtr& direct)
+ {
+ mUpdates.push_back(boost::bind(&EndpointConfigHelper::updateDirectMedia, mConfig, direct));
+ };
+
void visitSipRTPMediaServiceItem(const SipRTPMediaServiceItemPtr& service)
{
mUpdates.push_back(boost::bind(&EndpointConfigHelper::updateMediaService, mConfig, service));
@@ -278,6 +283,11 @@ public:
mEndpoint->setTargetAddress(target->host, target->port);
}
+ void updateDirectMedia(const DirectMediaItemPtr& direct)
+ {
+ mEndpoint->setDirectMedia(direct->enabled);
+ }
+
void updateMediaService(const SipRTPMediaServiceItemPtr& service)
{
mEndpoint->setRTPOverIPv6(service->requireIPv6);
diff --git a/src/SipEndpoint.cpp b/src/SipEndpoint.cpp
index 6dc9d62..a409cb3 100644
--- a/src/SipEndpoint.cpp
+++ b/src/SipEndpoint.cpp
@@ -266,6 +266,11 @@ void SipEndpoint::setRTPOverIPv6(bool enabled)
mImplPriv->mConfig.sessionConfig.rtpOverIPv6 = enabled;
}
+void SipEndpoint::setDirectMedia(bool enabled)
+{
+ mImplPriv->mConfig.sessionConfig.directMedia = enabled;
+}
+
void SipEndpoint::addFormat(const std::string& name, int sampleRate, int frameSize, const Ice::StringSeq& formatSpecific)
{
SDPDescriptorServiceLocatorParamsPtr params = new SDPDescriptorServiceLocatorParams();
diff --git a/src/SipEndpoint.h b/src/SipEndpoint.h
index 3e4a9a2..6d9ccc4 100644
--- a/src/SipEndpoint.h
+++ b/src/SipEndpoint.h
@@ -142,6 +142,8 @@ public:
// Whether we are using IPv6 for media transport
// or not.
bool rtpOverIPv6;
+ // Whether we are allowing direct media or not
+ bool directMedia;
};
/**
@@ -255,6 +257,7 @@ public:
void setCallDirection(enum Direction);
void setSecureTransport(enum Direction);
void setRTPOverIPv6(bool);
+ void setDirectMedia(bool);
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 30e4232..637fd98 100644
--- a/src/SipSession.cpp
+++ b/src/SipSession.cpp
@@ -579,6 +579,14 @@ public:
SuspendableWorkResult execute(const SuspendableWorkListenerPtr&)
{
+ SipEndpointConfig &config = mImplPriv->mEndpoint->getConfig();
+
+ if (config.sessionConfig.directMedia == false)
+ {
+ mCb->ice_response(Ice::StringSeq());
+ return Complete;
+ }
+
Ice::StringSeq allowedStreams;
lg(Debug) << "Executing a checkDirectConnections Operation";
-----------------------------------------------------------------------
--
asterisk-scf/integration/sip.git
More information about the asterisk-scf-commits
mailing list