[asterisk-scf-commits] asterisk-scf/integration/sip.git branch "media" created.

Commits to the Asterisk SCF project code repositories asterisk-scf-commits at lists.digium.com
Mon Jun 13 15:41:56 CDT 2011


branch "media" has been created
        at  142a3b1681235d5ff4e298adbbc6fc8fed58c52f (commit)

- Log -----------------------------------------------------------------
commit 142a3b1681235d5ff4e298adbbc6fc8fed58c52f
Author: Joshua Colp <jcolp at digium.com>
Date:   Mon Jun 13 17:42:21 2011 -0300

    Use the service locator to find the SDP descriptor service for the configured formats.

diff --git a/src/SipEndpoint.cpp b/src/SipEndpoint.cpp
index 4a711af..0caf169 100644
--- a/src/SipEndpoint.cpp
+++ b/src/SipEndpoint.cpp
@@ -21,8 +21,11 @@
 
 #include <AsteriskSCF/Core/Discovery/ServiceLocatorIf.h>
 #include <AsteriskSCF/logger.h>
+#include <AsteriskSCF/Media/SDP/MediaSDPIf.h>
 
 using namespace AsteriskSCF::System::Logging;
+using namespace AsteriskSCF::Media::SDP::V1;
+using namespace AsteriskSCF::Core::Discovery::V1;
 
 namespace
 {
@@ -99,6 +102,33 @@ public:
 };
 
 /**
+ * Callback implementation for SDP descriptor locate request.
+ */
+class SDPDescriptorLocateCallback : public IceUtil::Shared
+{
+public:
+    SDPDescriptorLocateCallback(std::string& name) : mName(name) { }
+
+    void locateCB(const Ice::ObjectPrx&)
+    {
+        std::cout << "Located media format" << std::endl;
+    }
+
+    void locateFailureCB(const Ice::Exception&)
+    {
+        std::cout << "Failed to locate media format" << std::endl;
+    }
+
+private:
+    /**
+     * Name of the media format.
+     */
+    std::string mName;
+};
+
+typedef IceUtil::Handle<SDPDescriptorLocateCallback> SDPDescriptorLocateCallbackPtr;
+
+/**
  * Default constructor.
  */
 SipEndpoint::SipEndpoint(const Ice::ObjectAdapterPtr& adapter, const boost::shared_ptr<SipEndpointFactory>& factory,
@@ -163,6 +193,14 @@ void SipEndpoint::setFormats(const Ice::StringSeq& formats)
 {
     for (Ice::StringSeq::const_iterator format = formats.begin(); format != formats.end(); ++format)
     {
+	SDPDescriptorServiceLocatorParamsPtr params = new SDPDescriptorServiceLocatorParams();
+	params->category = "Media/SDP_Descriptor";
+	params->name = (*format);
+
+        SDPDescriptorLocateCallbackPtr callback = new SDPDescriptorLocateCallback(params->name);
+        Callback_ServiceLocator_locatePtr descriptorCB = newCallback_ServiceLocator_locate(
+            callback, &SDPDescriptorLocateCallback::locateCB, &SDPDescriptorLocateCallback::locateFailureCB);
+        mImplPriv->mServiceLocator->begin_locate(params, descriptorCB);
     }
 }
 

commit a0861d57a4512924c1a7df78573aadd22ad66476
Author: Joshua Colp <jcolp at digium.com>
Date:   Sun Jun 12 19:52:31 2011 -0300

    Add configuration option for media formats on an endpoint. Not yet documented or completely implemented. Coming up soon enough!

diff --git a/config/SipConfigurator.py b/config/SipConfigurator.py
index 980cded..dcd8716 100755
--- a/config/SipConfigurator.py
+++ b/config/SipConfigurator.py
@@ -153,6 +153,18 @@ class SipSectionVisitors(Configurator.SectionVisitors):
         transformer = TLSProtocolMethodTransformer(config)
         mapper.map('tlsprotocolmethod', item, 'protocolMethod', 'crypto', transformer.get, None)
 
+        item = AsteriskSCF.SIP.V1.SipMediaFormatsItem()
+        item.formats = [ ]
+
+        class FormatTransformer():
+            def __init__(self, config):
+                self.config = config
+            def get(self, section, item):
+                return self.config.get(section, item).split(',')
+
+        transformer = FormatTransformer(config)
+        mapper.map('formats', item, 'formats', 'formats', transformer.get, None)
+
         for option in config.options(section):
             mapper.execute(group, section, option)
         mapper.finish(group)
diff --git a/local-slice/SipConfigurationIf.ice b/local-slice/SipConfigurationIf.ice
index ddfe65d..3665ea2 100644
--- a/local-slice/SipConfigurationIf.ice
+++ b/local-slice/SipConfigurationIf.ice
@@ -357,6 +357,17 @@ module V1
    };
 
    /**
+    * Allowable media formats item
+    */
+   class SipMediaFormatsItem extends SipConfigurationItem
+   {
+       /**
+        * A sequence of all configured media formats, in string form
+        */
+       Ice::StringSeq formats;
+   };
+
+   /**
     * User agent presentation configuration item
     */
    class SipUserAgentItem extends SipConfigurationItem
diff --git a/src/SipConfiguration.cpp b/src/SipConfiguration.cpp
index f65f05d..c4edd21 100644
--- a/src/SipConfiguration.cpp
+++ b/src/SipConfiguration.cpp
@@ -183,6 +183,11 @@ class EndpointConfigHelper : public boost::enable_shared_from_this<EndpointConfi
         {
             mUpdates.push_back(boost::bind(&EndpointConfigHelper::updateDirection, mConfig, direction));
         }
+
+	void visitSipMediaFormatsItem(const SipMediaFormatsItemPtr& formats)
+	{
+            mUpdates.push_back(boost::bind(&EndpointConfigHelper::updateFormats, mConfig, formats));
+	}
         
         void visitSipSourceTransportAddressItem(const SipSourceTransportAddressItemPtr& source)
         {
@@ -258,6 +263,11 @@ public:
         mEndpoint->setCallDirection(translateCallDirection(direction->callDirection));
     }
 
+    void updateFormats(const SipMediaFormatsItemPtr& formats)
+    {
+	mEndpoint->setFormats(formats->formats);
+    }
+
     void updateSource(const SipSourceTransportAddressItemPtr& source)
     {
         mEndpoint->setSourceAddress(source->host, source->port);
diff --git a/src/SipEndpoint.cpp b/src/SipEndpoint.cpp
index 3ff806f..4a711af 100644
--- a/src/SipEndpoint.cpp
+++ b/src/SipEndpoint.cpp
@@ -159,6 +159,13 @@ void SipEndpoint::setRTPOverIPv6(bool enabled)
     mImplPriv->mConfig.sessionConfig.rtpOverIPv6 = enabled;
 }
 
+void SipEndpoint::setFormats(const Ice::StringSeq& formats)
+{
+    for (Ice::StringSeq::const_iterator format = formats.begin(); format != formats.end(); ++format)
+    {
+    }
+}
+
 void SipEndpoint::setConfiguration(const Ice::PropertyDict& props)
 {
     setTransportConfiguration(props);
diff --git a/src/SipEndpoint.h b/src/SipEndpoint.h
index 40a8e25..c3bed5c 100644
--- a/src/SipEndpoint.h
+++ b/src/SipEndpoint.h
@@ -259,6 +259,7 @@ public:
     void setCallDirection(enum Direction);
     void setSecureTransport(enum Direction);
     void setRTPOverIPv6(bool);
+    void setFormats(const Ice::StringSeq&);
 
 private:
     /**

commit 25d0047fcc6a5eb943f0afc0a66610cb7a437e9e
Author: Joshua Colp <jcolp at digium.com>
Date:   Sun Jun 12 18:12:11 2011 -0300

    Don't compile old code, but leave it in since it is useful. It will be part of the media changes.

diff --git a/src/PJSipSessionModule.cpp b/src/PJSipSessionModule.cpp
index 74fe6f3..958d96e 100644
--- a/src/PJSipSessionModule.cpp
+++ b/src/PJSipSessionModule.cpp
@@ -1406,6 +1406,8 @@ protected:
             return Complete;
 	}
 
+#if 0
+
         // Each stream has its own set of formats, so go to that granularity
         for (unsigned int stream = 0; stream < remote_sdp->media_count; stream++)
         {
@@ -1489,6 +1491,7 @@ protected:
                 }
             }
         }
+#endif
         return Complete;
     }
 

-----------------------------------------------------------------------


-- 
asterisk-scf/integration/sip.git



More information about the asterisk-scf-commits mailing list