[asterisk-scf-commits] asterisk-scf/integration/media_rtp_pjmedia.git branch "telephony-events2" updated.

Commits to the Asterisk SCF project code repositories asterisk-scf-commits at lists.digium.com
Thu Aug 11 11:00:24 CDT 2011


branch "telephony-events2" has been updated
       via  7743183d3e581b8b0b0fbb13f52b593384d3ea0b (commit)
       via  6ab655ebd6b1d46172ba735b2541249a88a5092d (commit)
      from  aa81de303e27c5afb5d1d136581ead995c23d0ed (commit)

Summary of changes:
 .../MediaRTPPJMedia/RtpStateReplicationIf.ice      |    3 ++
 src/RTPSession.cpp                                 |   32 +++++++++++++++++--
 src/RTPSink.cpp                                    |    7 ++--
 src/RTPSink.h                                      |    2 +-
 src/RTPSource.cpp                                  |    6 ++--
 src/RTPSource.h                                    |    2 +-
 src/RTPTelephonyEventSink.cpp                      |    6 +++-
 src/RTPTelephonyEventSink.h                        |    3 +-
 src/RTPTelephonyEventSource.cpp                    |    8 ++++-
 src/RTPTelephonyEventSource.h                      |    4 ++-
 src/RtpStateReplicatorListener.cpp                 |    6 +--
 11 files changed, 59 insertions(+), 20 deletions(-)


- Log -----------------------------------------------------------------
commit 7743183d3e581b8b0b0fbb13f52b593384d3ea0b
Author: Mark Michelson <mmichelson at digium.com>
Date:   Thu Aug 11 11:01:04 2011 -0500

    Some state replication fixes so that IDs of telephony event sources and sinks are properly replicated.

diff --git a/slice/AsteriskSCF/Replication/MediaRTPPJMedia/RtpStateReplicationIf.ice b/slice/AsteriskSCF/Replication/MediaRTPPJMedia/RtpStateReplicationIf.ice
index 0ddeee5..675f19f 100644
--- a/slice/AsteriskSCF/Replication/MediaRTPPJMedia/RtpStateReplicationIf.ice
+++ b/slice/AsteriskSCF/Replication/MediaRTPPJMedia/RtpStateReplicationIf.ice
@@ -87,8 +87,11 @@ module V1
 	int port;
 	Ice::Identity sinkIdentity;
 	Ice::Identity sourceIdentity;
+        Ice::Identity telephonyEventSourceIdentity;
+        Ice::Identity telephonyEventSinkIdentity;
 	AsteriskSCF::Media::V1::FormatSeq formats;
 	AsteriskSCF::Media::RTP::V1::PayloadMap payloadstoFormats;
+        AsteriskSCF::Media::RTP::V1::RTPOptions options;
 	bool ipv6;
         bool srtp;
         string remoteRtcpAddress;
diff --git a/src/RTPSession.cpp b/src/RTPSession.cpp
index dd7ba39..df04bdc 100644
--- a/src/RTPSession.cpp
+++ b/src/RTPSession.cpp
@@ -223,6 +223,8 @@ public:
             const Ice::Identity& id,
             const Ice::Identity& sourceId,
             const Ice::Identity& sinkId,
+            const Ice::Identity& telephonyEventSourceId,
+            const Ice::Identity& telephonyEventSinkId,
             const RTPOptionsPtr& options,
             RTPAllocationOutputsPtr& outputs);
 
@@ -920,13 +922,25 @@ RTPSessionPrx RTPSessionImpl::activate(
     assert(id == mId);
     Ice::Identity sourceId(mAdapter->getCommunicator()->stringToIdentity(IceUtil::generateUUID()));
     Ice::Identity sinkId(mAdapter->getCommunicator()->stringToIdentity(IceUtil::generateUUID()));
-    return activate(mAdapter->getCommunicator()->stringToIdentity(id), sourceId, sinkId, options, outputs);
+    Ice::Identity telephonyEventSourceId(mAdapter->getCommunicator()->stringToIdentity(IceUtil::generateUUID()));
+    Ice::Identity telephonyEventSinkId(mAdapter->getCommunicator()->stringToIdentity(IceUtil::generateUUID()));
+
+    return activate(
+            mAdapter->getCommunicator()->stringToIdentity(id),
+            sourceId,
+            sinkId,
+            telephonyEventSourceId,
+            telephonyEventSinkId,
+            options,
+            outputs);
 }
 
 RTPSessionPrx RTPSessionImpl::activate(
         const Ice::Identity& id,
         const Ice::Identity& sourceId,
         const Ice::Identity& sinkId,
+        const Ice::Identity& telephonyEventSourceId,
+        const Ice::Identity& telephonyEventSinkId,
         const RTPOptionsPtr& options,
         RTPAllocationOutputsPtr& outputs)
 {
@@ -950,11 +964,11 @@ RTPSessionPrx RTPSessionImpl::activate(
             outputs = new RTPAllocationOutputs();
 
             mTelephonyEventSourcePrx =
-                mStreamSource->createTelephonyEventSource(mAdapter);
+                mStreamSource->createTelephonyEventSource(mAdapter, telephonyEventSourceId);
             outputs->eventSources.push_back(mTelephonyEventSourcePrx);
 
             mTelephonyEventSinkPrx =
-                mStreamSink->createTelephonyEventSink(mAdapter);
+                mStreamSink->createTelephonyEventSink(mAdapter, telephonyEventSinkId);
             outputs->eventSinks.push_back(mTelephonyEventSinkPrx);
         }
 
@@ -982,6 +996,7 @@ RTPSessionPrx RTPSessionImpl::activate(
             {
                 mSessionStateItem->port = 0;
             }
+            mSessionStateItem->options = options;
             replicateState(
                     mSessionStateItem,
                     mStreamSink->getStateItem(),
@@ -1096,7 +1111,16 @@ ReplicationAdapterPtr AsteriskSCF::PJMediaRTP::RTPSession::create(const Ice::Obj
                     item->port, item->formats, item->ipv6, item->srtp,
                     AsteriskSCF::Discovery::SmartProxy<RtpStateReplicatorPrx>(), 
                     configuration));
-    servant->activate(item->sessionIdentity, item->sourceIdentity, item->sinkIdentity, options, outputs);
+
+    servant->activate(
+            item->sessionIdentity,
+            item->sourceIdentity,
+            item->sinkIdentity,
+            item->telephonyEventSourceIdentity,
+            item->telephonyEventSinkIdentity,
+            options,
+            outputs);
+
     return ReplicationAdapterPtr(new ReplicationAdapterImpl(servant));
 }
 
diff --git a/src/RTPSink.cpp b/src/RTPSink.cpp
index e90d63a..0e00731 100644
--- a/src/RTPSink.cpp
+++ b/src/RTPSink.cpp
@@ -106,7 +106,7 @@ StreamSinkRTPImpl::StreamSinkRTPImpl(
 {
 }
 
-TelephonyEventSinkPrx StreamSinkRTPImpl::createTelephonyEventSink(Ice::ObjectAdapterPtr& adapter)
+TelephonyEventSinkPrx StreamSinkRTPImpl::createTelephonyEventSink(Ice::ObjectAdapterPtr& adapter, const Ice::Identity& id)
 {
     mImpl->mTelephonyEventSink =
         new RTPTelephonyEventSink(
@@ -115,7 +115,7 @@ TelephonyEventSinkPrx StreamSinkRTPImpl::createTelephonyEventSink(Ice::ObjectAda
             mImpl->mSessionAdapter,
             mImpl->mSessionId);
 
-    return TelephonyEventSinkPrx::uncheckedCast(adapter->addWithUUID(mImpl->mTelephonyEventSink));
+    return TelephonyEventSinkPrx::uncheckedCast(adapter->add(mImpl->mTelephonyEventSink, id));
 }
 
 RTPTelephonyEventSinkPtr StreamSinkRTPImpl::getTelephonyEventSink()
diff --git a/src/RTPSink.h b/src/RTPSink.h
index 4c08486..c4d8fa4 100644
--- a/src/RTPSink.h
+++ b/src/RTPSink.h
@@ -42,7 +42,7 @@ public:
     std::string getRemoteAddress(const Ice::Current&);
     Ice::Int getRemotePort(const Ice::Current&);
 
-    AsteriskSCF::SessionCommunications::V1::TelephonyEventSinkPrx createTelephonyEventSink(Ice::ObjectAdapterPtr& adapter);
+    AsteriskSCF::SessionCommunications::V1::TelephonyEventSinkPrx createTelephonyEventSink(Ice::ObjectAdapterPtr& adapter, const Ice::Identity& id);
     RTPTelephonyEventSinkPtr getTelephonyEventSink();
     /**
      * Internal implementation methods.
diff --git a/src/RTPSource.cpp b/src/RTPSource.cpp
index 529bbc4..01597c0 100644
--- a/src/RTPSource.cpp
+++ b/src/RTPSource.cpp
@@ -217,11 +217,11 @@ StreamSourceRTPImpl::StreamSourceRTPImpl(const SessionAdapterPtr& session,
 {
 }
 
-TelephonyEventSourcePrx StreamSourceRTPImpl::createTelephonyEventSource(Ice::ObjectAdapterPtr& adapter)
+TelephonyEventSourcePrx StreamSourceRTPImpl::createTelephonyEventSource(Ice::ObjectAdapterPtr& adapter, const Ice::Identity& id)
 {
     mImpl->mTelephonyEventSource = new RTPTelephonyEventSource(mImpl->mSessionAdapter, mImpl->mSessionId);
 
-    return TelephonyEventSourcePrx::uncheckedCast(adapter->addWithUUID(mImpl->mTelephonyEventSource));
+    return TelephonyEventSourcePrx::uncheckedCast(adapter->add(mImpl->mTelephonyEventSource, id));
 }
 
 RTPTelephonyEventSourcePtr StreamSourceRTPImpl::getTelephonyEventSource()
diff --git a/src/RTPSource.h b/src/RTPSource.h
index aa57773..23383b8 100644
--- a/src/RTPSource.h
+++ b/src/RTPSource.h
@@ -49,7 +49,7 @@ public:
 
     void setSinkImpl(const AsteriskSCF::Media::V1::StreamSinkPrx& proxy);
 
-    AsteriskSCF::SessionCommunications::V1::TelephonyEventSourcePrx createTelephonyEventSource(Ice::ObjectAdapterPtr& adapter);
+    AsteriskSCF::SessionCommunications::V1::TelephonyEventSourcePrx createTelephonyEventSource(Ice::ObjectAdapterPtr& adapter, const Ice::Identity& id);
     RTPTelephonyEventSourcePtr getTelephonyEventSource();
 
     /**
diff --git a/src/RtpStateReplicatorListener.cpp b/src/RtpStateReplicatorListener.cpp
index 5c287ce..e35140d 100644
--- a/src/RtpStateReplicatorListener.cpp
+++ b/src/RtpStateReplicatorListener.cpp
@@ -106,12 +106,10 @@ public:
 		    localitem = newitem;
 		    mImpl->mStateItems.insert(make_pair(item->sessionId, newitem));
 
-            //XXX We need to sort out the options and outputs here.
-            RTPOptionsPtr options(new RTPOptions);
-            RTPAllocationOutputsPtr outputs(new RTPAllocationOutputs);
+            RTPAllocationOutputsPtr outputs;
             localitem->setSession(
                     AsteriskSCF::PJMediaRTP::RTPSession::create(mImpl->mAdapter, mImpl->mEnvironment, item,
-                        mImpl->mConfigurationService, options, outputs));
+                        mImpl->mConfigurationService, item->options, outputs));
 		}
 		else
 		{

commit 6ab655ebd6b1d46172ba735b2541249a88a5092d
Author: Mark Michelson <mmichelson at digium.com>
Date:   Thu Aug 11 09:30:11 2011 -0500

    Be sure to set the sessionId and key of state items for telephony event sources and sinks.

diff --git a/src/RTPSink.cpp b/src/RTPSink.cpp
index 3b37056..e90d63a 100644
--- a/src/RTPSink.cpp
+++ b/src/RTPSink.cpp
@@ -112,7 +112,8 @@ TelephonyEventSinkPrx StreamSinkRTPImpl::createTelephonyEventSink(Ice::ObjectAda
         new RTPTelephonyEventSink(
             &mImpl->mOutgoingSession,
             mImpl->mTransport,
-            mImpl->mSessionAdapter);
+            mImpl->mSessionAdapter,
+            mImpl->mSessionId);
 
     return TelephonyEventSinkPrx::uncheckedCast(adapter->addWithUUID(mImpl->mTelephonyEventSink));
 }
diff --git a/src/RTPSource.cpp b/src/RTPSource.cpp
index 81e4978..529bbc4 100644
--- a/src/RTPSource.cpp
+++ b/src/RTPSource.cpp
@@ -219,7 +219,7 @@ StreamSourceRTPImpl::StreamSourceRTPImpl(const SessionAdapterPtr& session,
 
 TelephonyEventSourcePrx StreamSourceRTPImpl::createTelephonyEventSource(Ice::ObjectAdapterPtr& adapter)
 {
-    mImpl->mTelephonyEventSource = new RTPTelephonyEventSource(mImpl->mSessionAdapter);
+    mImpl->mTelephonyEventSource = new RTPTelephonyEventSource(mImpl->mSessionAdapter, mImpl->mSessionId);
 
     return TelephonyEventSourcePrx::uncheckedCast(adapter->addWithUUID(mImpl->mTelephonyEventSource));
 }
diff --git a/src/RTPTelephonyEventSink.cpp b/src/RTPTelephonyEventSink.cpp
index e2108c3..82cf3a7 100644
--- a/src/RTPTelephonyEventSink.cpp
+++ b/src/RTPTelephonyEventSink.cpp
@@ -17,6 +17,7 @@
 #include "RTPTelephonyEventSink.h"
 
 #include <AsteriskSCF/Media/Formats/OtherFormats.h>
+#include <IceUtil/UUID.h>
 
 namespace
 {
@@ -43,9 +44,12 @@ using namespace AsteriskSCF::Replication::MediaRTPPJMedia::V1;
 RTPTelephonyEventSink::RTPTelephonyEventSink(
         pjmedia_rtp_session *session,
         const PJMediaTransportPtr& transport,
-        const SessionAdapterPtr& sessionAdapter)
+        const SessionAdapterPtr& sessionAdapter,
+        const std::string& sessionId)
     : mSession(session), mTransport(transport), mSessionAdapter(sessionAdapter), mStateItem(new RTPTelephonyEventSinkStateItem)
 {
+    mStateItem->sessionId = sessionId;
+    mStateItem->key = IceUtil::generateUUID();
     mStateItem->segmentno = 0;
 }
 
diff --git a/src/RTPTelephonyEventSink.h b/src/RTPTelephonyEventSink.h
index 49aa3df..407c1b2 100644
--- a/src/RTPTelephonyEventSink.h
+++ b/src/RTPTelephonyEventSink.h
@@ -30,7 +30,8 @@ public:
     RTPTelephonyEventSink(
             pjmedia_rtp_session *session,
             const AsteriskSCF::PJMediaRTP::PJMediaTransportPtr& transport,
-            const AsteriskSCF::PJMediaRTP::SessionAdapterPtr& sessionAdapter);
+            const AsteriskSCF::PJMediaRTP::SessionAdapterPtr& sessionAdapter,
+            const std::string& sessionId);
 
     /**
      * Overrides of TelephonyEventSink interface
diff --git a/src/RTPTelephonyEventSource.cpp b/src/RTPTelephonyEventSource.cpp
index aee56f9..3a6631a 100644
--- a/src/RTPTelephonyEventSource.cpp
+++ b/src/RTPTelephonyEventSource.cpp
@@ -15,8 +15,10 @@
  */
 
 #include "RTPTelephonyEventSource.h"
+
 #include <AsteriskSCF/logger.h>
 #include <pjmedia.h>
+#include <IceUtil/UUID.h>
 
 using namespace AsteriskSCF::SessionCommunications::V1;
 using namespace AsteriskSCF::System::Logging;
@@ -28,9 +30,13 @@ namespace
 Logger lg = getLoggerFactory().getLogger("AsteriskSCF.MediaRTP");
 }
 
-RTPTelephonyEventSource::RTPTelephonyEventSource(const SessionAdapterPtr& sessionAdapter) 
+RTPTelephonyEventSource::RTPTelephonyEventSource(
+        const SessionAdapterPtr& sessionAdapter,
+        const std::string& sessionId)
     : mSessionAdapter(sessionAdapter), mStateItem(new RTPTelephonyEventSourceStateItem())
 {
+    mStateItem->sessionId = sessionId;
+    mStateItem->key = IceUtil::generateUUID();
     mStateItem->onEnd = false;
     mStateItem->timestamp = 0;
 }
diff --git a/src/RTPTelephonyEventSource.h b/src/RTPTelephonyEventSource.h
index c5c4fc2..cd7eb13 100644
--- a/src/RTPTelephonyEventSource.h
+++ b/src/RTPTelephonyEventSource.h
@@ -28,7 +28,9 @@
 class RTPTelephonyEventSource : public AsteriskSCF::SessionCommunications::V1::TelephonyEventSource
 {
 public:
-    RTPTelephonyEventSource(const AsteriskSCF::PJMediaRTP::SessionAdapterPtr& sessionAdapter);
+    RTPTelephonyEventSource(
+            const AsteriskSCF::PJMediaRTP::SessionAdapterPtr& sessionAdapter,
+            const std::string& sessionId);
 
     /**
      * Overrides of TelephonyEventSource interface

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


-- 
asterisk-scf/integration/media_rtp_pjmedia.git



More information about the asterisk-scf-commits mailing list