[asterisk-scf-commits] asterisk-scf/integration/mediatransportudptl.git branch "master" updated.

Commits to the Asterisk SCF project code repositories asterisk-scf-commits at lists.digium.com
Mon Sep 26 11:04:07 CDT 2011


branch "master" has been updated
       via  5b4099438add60bfe040f67715b78785e0047919 (commit)
      from  cdf4544166d459a2449d1bbe8899738afee1f483 (commit)

Summary of changes:
 config/test_component.config                       |   46 ++++------
 config/test_component_v6.config                    |   46 ++++------
 .../Replication/UDPTL/UdptlStateReplicationIf.ice  |    1 +
 src/Component.cpp                                  |    4 +-
 src/UDPTLSession.cpp                               |   92 +++++++++++++++++++-
 src/UDPTLSink.cpp                                  |    9 ++-
 src/UDPTLSource.cpp                                |    4 +-
 src/UdptlStateReplicatorApp.cpp                    |   13 ++--
 test/TestMediaTransportUDPTL.cpp                   |   45 ++++++----
 9 files changed, 171 insertions(+), 89 deletions(-)


- Log -----------------------------------------------------------------
commit 5b4099438add60bfe040f67715b78785e0047919
Author: Joshua Colp <jcolp at digium.com>
Date:   Mon Sep 26 13:11:09 2011 -0300

    Bring completely totally up to date.

diff --git a/config/test_component.config b/config/test_component.config
index 860ee14..c4bc8a3 100644
--- a/config/test_component.config
+++ b/config/test_component.config
@@ -13,10 +13,10 @@ Ice.Override.Timeout=5000
 IceBox.Service.UdptlStateReplicator=UdptlStateReplicator:create
 
 # Adapter parameters for this component
-UdptlStateReplicator.Endpoints=tcp:udp
+UdptlStateReplicator.Adapter.Endpoints=tcp:udp
 
 # A proxy to the service locator management service
-LocatorServiceManagement.Proxy=LocatorServiceManagement:tcp -p 4422
+LocatorServiceManagement.Proxy=LocatorServiceManagement:tcp -p 4412
 
 # A proxy to the service locator service
 LocatorService.Proxy=LocatorService:tcp -p 4411
@@ -32,12 +32,6 @@ MediaTransportUDPTLAdapter.Endpoints=default
 MediaTransportUDPTLAdapterLocal.Endpoints=default
 MediaTransportUDPTLAdapterLogger.Endpoints=default
 
-# A proxy to the service locator management service
-ServiceLocatorManagementProxy=LocatorServiceManagement:tcp -p 4422
-
-# A proxy to the service locator service
-ServiceLocatorProxy=LocatorService:tcp -p 4411
-
 #
 # TestMediaTransportUDPTL Configuration
 #
@@ -50,25 +44,21 @@ IceBox.Service.TestMediaTransportUDPTL=MediaTransportUDPTL_test:create
 
 IceBox.Service.ServiceDiscovery=service_locator:create
 
-AsteriskSCFIceStorm.InstanceName=AsteriskSCFIceStorm
-AsteriskSCFIceStorm.TopicManager.Endpoints=default -p 10000
-AsteriskSCFIceStorm.Publish.Endpoints=tcp -p 10001:udp -p 10001
-AsteriskSCFIceStorm.Trace.TopicManager=2
-AsteriskSCFIceStorm.Transient=1
-AsteriskSCFIceStorm.Flush.Timeout=2000
-TopicManager.Proxy=AsteriskSCFIceStorm/TopicManager:default -p 10000
-
-UdptlStateReplicatorIceStorm.InstanceName=UdptlStateReplicatorIceStorm
-UdptlStateReplicatorIceStorm.TopicManager.Endpoints=default -p 10005
-UdptlStateReplicatorIceStorm.Publish.Endpoints=default -p 10006
-UdptlStateReplicatorIceStorm.Trace.TopicManager=2
-UdptlStateReplicatorIceStorm.Transient=1
-UdptlStateReplicatorIceStorm.Flush.Timeout=2000
-UdptlStateReplicatorTopicManager.Proxy=UdptlStateReplicatorIceStorm/TopicManager:default -p 10005
-
-ServiceLocatorManagementAdapter.Endpoints=tcp -p 4422
-ServiceLocatorAdapter.Endpoints=tcp -p 4411
-ServiceLocatorLocalAdapter.Endpoints=tcp -p 4412
-LocatorService.Proxy=LocatorService:tcp -p 4411
+ServiceDiscovery.IceStorm.InstanceName=ServiceDiscovery
+ServiceDiscovery.IceStorm.TopicManager.Endpoints=default -p 10000
+ServiceDiscovery.IceStorm.Publish.Endpoints=tcp -p 10001:udp -p 10001
+ServiceDiscovery.IceStorm.Trace.TopicManager=2
+ServiceDiscovery.IceStorm.Transient=1
+ServiceDiscovery.IceStorm.Flush.Timeout=2000
+
+UdptlStateReplicator.IceStorm.InstanceName=UdptlStateReplicator
+UdptlStateReplicator.IceStorm.TopicManager.Endpoints=default -p 10005
+UdptlStateReplicator.IceStorm.Publish.Endpoints=default -p 10006
+UdptlStateReplicator.IceStorm.Trace.TopicManager=2
+UdptlStateReplicator.IceStorm.Transient=1
+UdptlStateReplicator.IceStorm.Flush.Timeout=2000
+
+ServiceDiscovery.Management.ServiceAdapter.Endpoints=tcp -p 4412
+ServiceDiscovery.Locator.ServiceAdapter.Endpoints=tcp -p 4411
 
 LoggerAdapter.Endpoints=default
diff --git a/config/test_component_v6.config b/config/test_component_v6.config
index ac01e7c..89a8889 100644
--- a/config/test_component_v6.config
+++ b/config/test_component_v6.config
@@ -13,10 +13,10 @@ Ice.Override.Timeout=5000
 IceBox.Service.UdptlStateReplicator=UdptlStateReplicator:create
 
 # Adapter parameters for this component
-UdptlStateReplicator.Endpoints=tcp:udp
+UdptlStateReplicator.Adapter.Endpoints=tcp:udp
 
 # A proxy to the service locator management service
-LocatorServiceManagement.Proxy=LocatorServiceManagement:tcp -p 4422
+LocatorServiceManagement.Proxy=LocatorServiceManagement:tcp -p 4412
 
 # A proxy to the service locator service
 LocatorService.Proxy=LocatorService:tcp -p 4411
@@ -32,12 +32,6 @@ MediaTransportUDPTLAdapter.Endpoints=default
 MediaTransportUDPTLAdapterLocal.Endpoints=default
 MediaTransportUDPTLAdapterLogger.Endpoints=default
 
-# A proxy to the service locator management service
-ServiceLocatorManagementProxy=LocatorServiceManagement:tcp -p 4422
-
-# A proxy to the service locator service
-ServiceLocatorProxy=LocatorService:tcp -p 4411
-
 #
 # TestMediaTransportUDPTL Configuration
 #
@@ -50,25 +44,21 @@ IceBox.Service.TestMediaTransportUDPTL=MediaTransportUDPTL_test_v6:create
 
 IceBox.Service.ServiceDiscovery=service_locator:create
 
-AsteriskSCFIceStorm.InstanceName=AsteriskSCFIceStorm
-AsteriskSCFIceStorm.TopicManager.Endpoints=default -p 10000
-AsteriskSCFIceStorm.Publish.Endpoints=tcp -p 10001:udp -p 10001
-AsteriskSCFIceStorm.Trace.TopicManager=2
-AsteriskSCFIceStorm.Transient=1
-AsteriskSCFIceStorm.Flush.Timeout=2000
-TopicManager.Proxy=AsteriskSCFIceStorm/TopicManager:default -p 10000
-
-UdptlStateReplicatorIceStorm.InstanceName=UdptlStateReplicatorIceStorm
-UdptlStateReplicatorIceStorm.TopicManager.Endpoints=default -p 10005
-UdptlStateReplicatorIceStorm.Publish.Endpoints=default -p 10006
-UdptlStateReplicatorIceStorm.Trace.TopicManager=2
-UdptlStateReplicatorIceStorm.Transient=1
-UdptlStateReplicatorIceStorm.Flush.Timeout=2000
-UdptlStateReplicatorTopicManager.Proxy=UdptlStateReplicatorIceStorm/TopicManager:default -p 10005
-
-ServiceLocatorManagementAdapter.Endpoints=tcp -p 4422
-ServiceLocatorAdapter.Endpoints=tcp -p 4411
-ServiceLocatorLocalAdapter.Endpoints=tcp -p 4412
-LocatorService.Proxy=LocatorService:tcp -p 4411
+ServiceDiscovery.IceStorm.InstanceName=ServiceDiscovery
+ServiceDiscovery.IceStorm.TopicManager.Endpoints=default -p 10000
+ServiceDiscovery.IceStorm.Publish.Endpoints=tcp -p 10001:udp -p 10001
+ServiceDiscovery.IceStorm.Trace.TopicManager=2
+ServiceDiscovery.IceStorm.Transient=1
+ServiceDiscovery.IceStorm.Flush.Timeout=2000
+
+UdptlStateReplicator.IceStorm.InstanceName=UdptlStateReplicator
+UdptlStateReplicator.IceStorm.TopicManager.Endpoints=default -p 10005
+UdptlStateReplicator.IceStorm.Publish.Endpoints=default -p 10006
+UdptlStateReplicator.IceStorm.Trace.TopicManager=2
+UdptlStateReplicator.IceStorm.Transient=1
+UdptlStateReplicator.IceStorm.Flush.Timeout=2000
+
+ServiceDiscovery.Management.ServiceAdapter.Endpoints=tcp -p 4412
+ServiceDiscovery.Locator.ServiceAdapter.Endpoints=tcp -p 4411
 
 LoggerAdapter.Endpoints=default
diff --git a/slice/AsteriskSCF/Replication/UDPTL/UdptlStateReplicationIf.ice b/slice/AsteriskSCF/Replication/UDPTL/UdptlStateReplicationIf.ice
index 2893045..d7e65f4 100644
--- a/slice/AsteriskSCF/Replication/UDPTL/UdptlStateReplicationIf.ice
+++ b/slice/AsteriskSCF/Replication/UDPTL/UdptlStateReplicationIf.ice
@@ -80,6 +80,7 @@ module V1
         bool ipv6;
 	Ice::Identity sinkIdentity;
 	Ice::Identity sourceIdentity;
+        AsteriskSCF::Media::V1::SessionCookieDict cookies;
     };
 
     class UdptlStreamSinkStateItem extends UdptlStateItem
diff --git a/src/Component.cpp b/src/Component.cpp
index cbf51e1..0589c3b 100644
--- a/src/Component.cpp
+++ b/src/Component.cpp
@@ -322,7 +322,7 @@ void Component::findRemoteServices()
     ServiceLocatorParamsPtr replicatorParams = new ServiceLocatorParams();
     replicatorParams->category = StateReplicatorDiscoveryCategory;
     replicatorParams->service =
-        getCommunicator()->getProperties()->getPropertyWithDefault("Udptl.StateReplicatorService", "default");
+        getCommunicator()->getProperties()->getPropertyWithDefault(getName() + ".StateReplicatorService", "default");
 
     try
     {
@@ -454,7 +454,7 @@ void Component::onRegisterPrimaryServices()
         return;
     }
 
-    mGeneralState->serviceManagement = mUdptlMediaServiceRegistration->getServiceMangement();
+    mGeneralState->serviceManagement = mUdptlMediaServiceRegistration->getServiceManagement();
     mGeneralState->serviceManagement->addLocatorParams(mUdptlLocatorParams, "");
 }
 
diff --git a/src/UDPTLSession.cpp b/src/UDPTLSession.cpp
index 4545629..b5d2edb 100644
--- a/src/UDPTLSession.cpp
+++ b/src/UDPTLSession.cpp
@@ -77,6 +77,14 @@ public:
     AsteriskSCF::Media::V1::StreamSourceSeq getSources(const Ice::Current&);
     AsteriskSCF::Media::V1::StreamSinkSeq getSinks(const Ice::Current&);
     std::string getId(const Ice::Current&);
+    void setCookies(const AsteriskSCF::Media::V1::SessionCookieDict& cookies);
+    void setCookies(const AsteriskSCF::Media::V1::SessionCookies& cookies,
+                    const Ice::Current&);
+    void getCookies_async(const AsteriskSCF::Media::V1::AMD_Session_getCookiesPtr &cb,
+                          const AsteriskSCF::Media::V1::SessionCookies& cookiesToGet,
+                          const Ice::Current&);
+    void removeCookies(const AsteriskSCF::Media::V1::SessionCookies& cookies,
+                       const Ice::Current&);
     void release(const Ice::Current&);
 
     void setRemoteDetails(const std::string& address, Ice::Int port);
@@ -261,6 +269,8 @@ StreamSourceSeq UDPTLSessionImpl::getSources(const Ice::Current&)
     return sources;
 }
 
+
+
 /**
  * Implementation of the getSinks method as defined in MediaUDPTLIf.ice
  */
@@ -283,6 +293,85 @@ std::string UDPTLSessionImpl::getId(const Ice::Current&)
 }
 
 /**
+ * Local implementation.
+ */
+void UDPTLSessionImpl::setCookies(const AsteriskSCF::Media::V1::SessionCookieDict& cookieMap)
+{
+    boost::unique_lock<boost::shared_mutex> lock(mLock);
+    mSessionStateItem->cookies = cookieMap;
+}
+
+/**
+ * Support for the corresponding API call.
+ */
+void UDPTLSessionImpl::setCookies(const AsteriskSCF::Media::V1::SessionCookies& cookies,
+                                  const Ice::Current&)
+{
+    { // scope the lock
+        boost::unique_lock<boost::shared_mutex> lock(mLock);
+        for (AsteriskSCF::Media::V1::SessionCookies::const_iterator i = cookies.begin();
+             i != cookies.end();  ++i)
+        {
+            mSessionStateItem->cookies[(*i)->ice_id()] = (*i);
+        }
+    }
+
+    if (mReplicationContext->isReplicating() == true)
+    {
+        replicateState(mSessionStateItem, 0, 0);
+    }
+}
+
+/**
+ * Implementation of the corresponding API call.
+ */
+void UDPTLSessionImpl::getCookies_async(
+    const AsteriskSCF::Media::V1::AMD_Session_getCookiesPtr &cb,
+    const AsteriskSCF::Media::V1::SessionCookies& cookiesToGet,
+    const Ice::Current&)
+{
+    AsteriskSCF::Media::V1::SessionCookies results;
+
+    boost::unique_lock<boost::shared_mutex> lock(mLock);
+    for (AsteriskSCF::Media::V1::SessionCookies::const_iterator i = cookiesToGet.begin();
+         i != cookiesToGet.end();
+         ++i)
+    {
+        AsteriskSCF::Media::V1::SessionCookieDict::const_iterator cookie = mSessionStateItem->cookies.find((*i)->ice_id());
+
+        if (cookie == mSessionStateItem->cookies.end())
+        {
+            continue;
+        }
+
+        results.push_back(cookie->second);
+    }
+
+    cb->ice_response(results);
+}
+
+/**
+ * Implementation of the corresponding API call.
+ */
+void UDPTLSessionImpl::removeCookies(const AsteriskSCF::Media::V1::SessionCookies& cookies,
+                                   const Ice::Current&)
+{
+    { // scope the lock
+        boost::unique_lock<boost::shared_mutex> lock(mLock);
+        for (AsteriskSCF::Media::V1::SessionCookies::const_iterator i = cookies.begin();
+             i != cookies.end(); ++i)
+        {
+            mSessionStateItem->cookies.erase((*i)->ice_id());
+        }
+    }
+
+    if (mReplicationContext->isReplicating() == true)
+    {
+        replicateState(mSessionStateItem, 0, 0);
+    }
+}
+
+/**
  * Implementation of the release method as defined in MediaUDPTLIf.ice
  */
 void UDPTLSessionImpl::release(const Ice::Current&)
@@ -470,8 +559,9 @@ class ReplicationAdapterImpl : public ReplicationAdapter
 {
 public:
 
-    void update(const UdptlSessionStateItemPtr&)
+    void update(const UdptlSessionStateItemPtr& item)
     {
+        mImpl->setCookies(item->cookies);
     }
 
     void update(const UdptlStreamSinkStateItemPtr& item)
diff --git a/src/UDPTLSink.cpp b/src/UDPTLSink.cpp
index 6b1cde6..5170139 100644
--- a/src/UDPTLSink.cpp
+++ b/src/UDPTLSink.cpp
@@ -121,9 +121,14 @@ void StreamSinkUDPTLImpl::write(const AsteriskSCF::Media::V1::FrameSeq& frames,
     {
         const int bufsize = udptl_get_far_max_datagram(mImpl->mUdptl);
         uint8_t buf[bufsize];
-        int len;
+        int len = 0;
 
-        len = udptl_build_packet(mImpl->mUdptl, buf, sizeof(buf), &(*frame)->payload[0], (unsigned int)(*frame)->payload.size());
+        ByteSeqPayloadPtr payload = ByteSeqPayloadPtr::dynamicCast((*frame)->payload);
+
+        if (payload)
+        {
+            len = udptl_build_packet(mImpl->mUdptl, buf, sizeof(buf), &payload->payload[0], (unsigned int)payload->payload.size());
+        }
 
         if (len > 0)
         {
diff --git a/src/UDPTLSource.cpp b/src/UDPTLSource.cpp
index 38759d9..c639d79 100644
--- a/src/UDPTLSource.cpp
+++ b/src/UDPTLSource.cpp
@@ -234,7 +234,9 @@ static void receiveUDPTL(void *userdata, void *packet, pj_ssize_t size)
     for (frame = udptl_rx_packet(source->mImpl->mUdptl, (uint8_t*)packet, (unsigned int)size); frame; frame = frame->next)
     {
         StreamFramePtr faxFrame = new StreamFrame();
-        copy((Ice::Byte*)frame->data, (Ice::Byte*)frame->data + frame->datalen, std::back_inserter(faxFrame->payload));
+        ByteSeqPayloadPtr payload = new ByteSeqPayload();
+        copy((Ice::Byte*)frame->data, (Ice::Byte*)frame->data + frame->datalen, std::back_inserter(payload->payload));
+        faxFrame->payload = payload;
         faxFrame->seqno = frame->seqno;
         frames.push_back(faxFrame);
     }
diff --git a/src/UdptlStateReplicatorApp.cpp b/src/UdptlStateReplicatorApp.cpp
index 805201d..a9b3c8a 100644
--- a/src/UdptlStateReplicatorApp.cpp
+++ b/src/UdptlStateReplicatorApp.cpp
@@ -169,7 +169,7 @@ void UdptlStateReplicatorService::registerWithServiceLocator(const Ice::Communic
         // Add category as a parameter to enable other components look this component up.
         ServiceLocatorParamsPtr genericparams = new ServiceLocatorParams();
         genericparams->category = AsteriskSCF::Replication::UDPTL::V1::StateReplicatorComponentCategory;
-        genericparams->service =  ic->getProperties()->getPropertyWithDefault("UdptlStateReplicator.Service", "default");
+        genericparams->service =  ic->getProperties()->getPropertyWithDefault(mAppName + ".ServiceName", "default");
         genericparams->id = mAppName;
         mComponentServiceManagement->addLocatorParams(genericparams, "");
 
@@ -182,7 +182,7 @@ void UdptlStateReplicatorService::registerWithServiceLocator(const Ice::Communic
 
         ServiceLocatorParamsPtr discoveryParams = new ServiceLocatorParams;
         discoveryParams->category = AsteriskSCF::Replication::UDPTL::V1::StateReplicatorDiscoveryCategory;
-        discoveryParams->service = ic->getProperties()->getPropertyWithDefault("UdptlStateReplicator.Service", "default");
+        discoveryParams->service = ic->getProperties()->getPropertyWithDefault(mAppName + ".ServiceName", "default");
         discoveryParams->id = mAppName;
         mStateReplicationManagement->addLocatorParams(discoveryParams, "");
 
@@ -193,7 +193,7 @@ void UdptlStateReplicatorService::registerWithServiceLocator(const Ice::Communic
         // Populate the configuration parameters with details so we can be found
         ServiceLocatorParamsPtr configurationParams = new ServiceLocatorParams();
         configurationParams->category = ConfigurationDiscoveryCategory;
-        configurationParams->service = ic->getProperties()->getPropertyWithDefault("UdptlConfiguration.Service", "default");
+        configurationParams->service = ic->getProperties()->getPropertyWithDefault(mAppName + ".ServiceName", "default");
         configurationParams->id = mAppName;
         mConfigurationManagement->addLocatorParams(configurationParams, "");
 
@@ -225,10 +225,9 @@ void UdptlStateReplicatorService::deregisterFromServiceLocator()
 
 void UdptlStateReplicatorService::initialize(const string& appName, const Ice::CommunicatorPtr& ic)
 {
-    mIceStorm = new CollocatedIceStorm("UdptlStateReplicatorIceStorm", ic->getProperties());
+    mIceStorm = new CollocatedIceStorm(appName, ic->getProperties());
 
-    IceStorm::TopicManagerPrx topicManager = IceStorm::TopicManagerPrx::checkedCast(
-    ic->propertyToProxy("UdptlStateReplicatorTopicManager.Proxy"));
+    IceStorm::TopicManagerPrx topicManager = mIceStorm->createTopicManagerProxy(ic);
 
     IceStorm::TopicPrx topic;
 
@@ -259,7 +258,7 @@ void UdptlStateReplicatorService::initialize(const string& appName, const Ice::C
         lg(Info) << "IceStorm topic manager proxy not present, unable to perform configuration replication.";
     }
 
-    mAdapter = ic->createObjectAdapter("UdptlStateReplicator");
+    mAdapter = ic->createObjectAdapter(appName + ".Adapter");
 
     // setup logging client
     mIceLogger = createIceLogger(mAdapter);
diff --git a/test/TestMediaTransportUDPTL.cpp b/test/TestMediaTransportUDPTL.cpp
index 43fc9ed..0b99136 100644
--- a/test/TestMediaTransportUDPTL.cpp
+++ b/test/TestMediaTransportUDPTL.cpp
@@ -648,16 +648,19 @@ BOOST_AUTO_TEST_CASE(TransmitFrametoEmptySink)
         frame->mediaFormat = format;
 
         /* Populate the payload with some useless data, but enough to confirm the payload passes unaltered. */
-        frame->payload.push_back('a');
-        frame->payload.push_back('b');
-        frame->payload.push_back('c');
-        frame->payload.push_back('d');
-        frame->payload.push_back('e');
-        frame->payload.push_back('f');
-        frame->payload.push_back('g');
-        frame->payload.push_back('h');
-        frame->payload.push_back('i');
-        frame->payload.push_back('j');
+        ByteSeqPayloadPtr payload = new ByteSeqPayload();
+        payload->payload.push_back('a');
+        payload->payload.push_back('b');
+        payload->payload.push_back('c');
+        payload->payload.push_back('d');
+        payload->payload.push_back('e');
+        payload->payload.push_back('f');
+        payload->payload.push_back('g');
+        payload->payload.push_back('h');
+        payload->payload.push_back('i');
+        payload->payload.push_back('j');
+
+        frame->payload = payload;
 
         FrameSeq frames;
         frames.push_back(frame);
@@ -938,16 +941,18 @@ BOOST_AUTO_TEST_CASE(TransmitandReceiveFrame)
         StreamFramePtr frame = new StreamFrame();
 
         /* Populate the payload with some useless data, but enough to confirm the payload passes unaltered. */
-        frame->payload.push_back('a');
-        frame->payload.push_back('b');
-        frame->payload.push_back('c');
-        frame->payload.push_back('d');
-        frame->payload.push_back('e');
-        frame->payload.push_back('f');
-        frame->payload.push_back('g');
-        frame->payload.push_back('h');
-        frame->payload.push_back('i');
-        frame->payload.push_back('j');
+        ByteSeqPayloadPtr payload = new ByteSeqPayload();
+        payload->payload.push_back('a');
+        payload->payload.push_back('b');
+        payload->payload.push_back('c');
+        payload->payload.push_back('d');
+        payload->payload.push_back('e');
+        payload->payload.push_back('f');
+        payload->payload.push_back('g');
+        payload->payload.push_back('h');
+        payload->payload.push_back('i');
+        payload->payload.push_back('j');
+        frame->payload = payload;
 
         FrameSeq frames;
         frames.push_back(frame);

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


-- 
asterisk-scf/integration/mediatransportudptl.git



More information about the asterisk-scf-commits mailing list