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

Commits to the Asterisk SCF project code repositories asterisk-scf-commits at lists.digium.com
Wed Jun 15 08:34:48 CDT 2011


branch "media" has been updated
       via  db491458611fb4760828cdeb9b26d464ce679ed4 (commit)
      from  8fc35f40989061e6473806b993b3b623319a05b8 (commit)

Summary of changes:
 local-slice/SipStateReplicationIf.ice |    6 +++---
 src/PJSipSessionModule.cpp            |   11 +++++++++--
 src/SipEndpoint.cpp                   |    4 ++--
 src/SipEndpoint.h                     |    2 +-
 src/SipSession.cpp                    |   24 ++++++++----------------
 src/SipSession.h                      |   12 ++++++------
 src/SipStateReplicatorListener.cpp    |    2 +-
 7 files changed, 30 insertions(+), 31 deletions(-)


- Log -----------------------------------------------------------------
commit db491458611fb4760828cdeb9b26d464ce679ed4
Author: Joshua Colp <jcolp at digium.com>
Date:   Wed Jun 15 10:35:33 2011 -0300

    Replicate *all* RTP sessions and not just the first one allocated.

diff --git a/local-slice/SipStateReplicationIf.ice b/local-slice/SipStateReplicationIf.ice
index aae6991..1478233 100644
--- a/local-slice/SipStateReplicationIf.ice
+++ b/local-slice/SipStateReplicationIf.ice
@@ -18,6 +18,7 @@
 #include <Ice/BuiltinSequences.ice>
 #include <Ice/Identity.ice>
 #include <AsteriskSCF/Media/MediaIf.ice>
+#include <AsteriskSCF/Media/RTP/MediaRTPIf.ice>
 #include <AsteriskSCF/SessionCommunications/SessionCommunicationsIf.ice>
 #include <AsteriskSCF/Core/Discovery/ServiceLocatorIf.ice>
 #include <AsteriskSCF/System/Component/ConfigurationIf.ice>
@@ -137,8 +138,7 @@ module V1
 
    sequence<AsteriskSCF::SessionCommunications::V1::SessionListener*> SessionListenerSeq;
 
-   // Should this exist within MediaIf.ice? Are we going to pass around a sequence of sessions elsewhere?
-   //sequence<AsteriskSCF::Media::V1::Session*> MediaSessionSeq;
+   sequence<AsteriskSCF::Media::RTP::V1::RTPSession*> RTPMediaSessionSeq;
 
    class SipSessionStateItem extends SipStateItem
    {
@@ -149,7 +149,7 @@ module V1
       Ice::Identity mMediaSessionObjectId;
       AsteriskSCF::Media::V1::StreamSourceSeq mSources;
       AsteriskSCF::Media::V1::StreamSinkSeq mSinks;
-      AsteriskSCF::Media::V1::Session *mMediaSession;
+      RTPMediaSessionSeq mRTPMediaSessions;
       SessionListenerSeq mListeners;
       AsteriskSCF::SessionCommunications::V1::Bridge *mBridge;
    };
diff --git a/src/PJSipSessionModule.cpp b/src/PJSipSessionModule.cpp
index 10dca3a..06fe044 100644
--- a/src/PJSipSessionModule.cpp
+++ b/src/PJSipSessionModule.cpp
@@ -98,7 +98,7 @@ void PJSipSessionModInfo::updateSessionState(pjsip_inv_session *inv_session)
         mSessionState->mMediaSessionObjectId = mSession->getMediaSessionProxy()->ice_getIdentity();
         mSessionState->mSources = mSession->getSources();
         mSessionState->mSinks = mSession->getSinks();
-        mSessionState->mMediaSession = mSession->getHiddenMediaSession();
+        mSessionState->mRTPMediaSessions = mSession->getRTPMediaSessions();
         mSessionState->mListeners = mSession->getListeners();
         try
         {
@@ -217,7 +217,14 @@ void PJSipSessionModule::replicateState(PJSipDialogModInfo *dlgInfo, PJSipTransa
         lg(Debug) << "Endpoint name: " << sessionInfo->mSessionState->mEndpointName;
         lg(Debug) << "Session object identity: " << sessionInfo->mSessionState->mSessionObjectId.name;
         lg(Debug) << "Media session object identity: " << sessionInfo->mSessionState->mMediaSessionObjectId.name;
-        lg(Debug) << "Media session: " << sessionInfo->mSessionState->mMediaSession;
+
+	for (RTPMediaSessionSeq::const_iterator mediaSession = sessionInfo->mSessionState->mRTPMediaSessions.begin();
+             mediaSession != sessionInfo->mSessionState->mRTPMediaSessions.end();
+             ++mediaSession)
+        {
+            lg(Debug) << "Media session: " << (*mediaSession);
+        }
+
         lg(Debug) << "Bridge: " << sessionInfo->mSessionState->mBridge;
         lg(Debug) << "--- Begin Invite Session " << sessionInfo->mInviteState->key;
         lg(Debug) << "Current state: " << sessionInfo->mInviteState->mCurrentState;
diff --git a/src/SipEndpoint.cpp b/src/SipEndpoint.cpp
index bfe3908..2627a29 100644
--- a/src/SipEndpoint.cpp
+++ b/src/SipEndpoint.cpp
@@ -421,10 +421,10 @@ AsteriskSCF::SipSessionManager::SipSessionPtr SipEndpoint::createSession(const s
 
 AsteriskSCF::SipSessionManager::SipSessionPtr SipEndpoint::createSession(const std::string& destination,
         const Ice::Identity& sessionid, const Ice::Identity& mediaid,
-        const AsteriskSCF::Media::V1::SessionPrx& mediasession, const AsteriskSCF::Media::V1::StreamSourceSeq& sources,
+        const AsteriskSCF::SIP::V1::RTPMediaSessionSeq& mediasessions, const AsteriskSCF::Media::V1::StreamSourceSeq& sources,
         const AsteriskSCF::Media::V1::StreamSinkSeq& sinks)
 {
-    SipSessionPtr session = new SipSession(mImplPriv->mAdapter, this, destination, sessionid, mediaid, mediasession,
+    SipSessionPtr session = new SipSession(mImplPriv->mAdapter, this, destination, sessionid, mediaid, mediasessions,
             sources, sinks, mImplPriv->mManager, mImplPriv->mServiceLocator, mImplPriv->mReplica, false);
     mImplPriv->mSessions.push_back(session);
     return session;
diff --git a/src/SipEndpoint.h b/src/SipEndpoint.h
index 6327a09..654b5f2 100644
--- a/src/SipEndpoint.h
+++ b/src/SipEndpoint.h
@@ -251,7 +251,7 @@ public:
     //
     AsteriskSCF::SipSessionManager::SipSessionPtr createSession(const std::string&);
     AsteriskSCF::SipSessionManager::SipSessionPtr createSession(const std::string&, const Ice::Identity&,
-            const Ice::Identity&, const AsteriskSCF::Media::V1::SessionPrx&,
+            const Ice::Identity&, const AsteriskSCF::SIP::V1::RTPMediaSessionSeq&,
             const AsteriskSCF::Media::V1::StreamSourceSeq&, const AsteriskSCF::Media::V1::StreamSinkSeq&);
 
     void removeSession(const AsteriskSCF::SessionCommunications::V1::SessionPtr&);
diff --git a/src/SipSession.cpp b/src/SipSession.cpp
index 2f4fbe6..3f050c9 100644
--- a/src/SipSession.cpp
+++ b/src/SipSession.cpp
@@ -213,7 +213,7 @@ public:
     /**
      * A vector of RTP media sessions belonging to this endpoint.
      */
-    std::vector<AsteriskSCF::Media::RTP::V1::RTPSessionPrx> mRTPSessions;
+    RTPMediaSessionSeq mRTPSessions;
 
     /**
      * A vector of media sources associated with this endpoint.
@@ -353,7 +353,7 @@ SipSession::SipSession(const Ice::ObjectAdapterPtr& adapter, const SipEndpointPt
  */
 SipSession::SipSession(const Ice::ObjectAdapterPtr& adapter, const SipEndpointPtr& endpoint,
         const std::string& destination, const Ice::Identity& sessionid,
-        const Ice::Identity& mediaid, const AsteriskSCF::Media::V1::SessionPrx& mediasession,
+        const Ice::Identity& mediaid, const AsteriskSCF::SIP::V1::RTPMediaSessionSeq& mediasessions,
         const AsteriskSCF::Media::V1::StreamSourceSeq& sources, const AsteriskSCF::Media::V1::StreamSinkSeq& sinks,
         PJSipManager *manager, const AsteriskSCF::Core::Discovery::V1::ServiceLocatorPrx& serviceLocator,
         const AsteriskSCF::System::Component::V1::ReplicaPtr& replica, bool isUAC)
@@ -366,10 +366,7 @@ SipSession::SipSession(const Ice::ObjectAdapterPtr& adapter, const SipEndpointPt
     mImplPriv->mMediaSessionProxy =
         AsteriskSCF::Media::V1::SessionPrx::uncheckedCast(adapter->add(mImplPriv->mMediaSession, mediaid));
 
-    AsteriskSCF::Media::RTP::V1::RTPSessionPrx rtpsession =
-        AsteriskSCF::Media::RTP::V1::RTPSessionPrx::uncheckedCast(mediasession);
-    mImplPriv->mRTPSessions.push_back(rtpsession);
-
+    mImplPriv->mRTPSessions = mediasessions;
     mImplPriv->mSources = sources;
     mImplPriv->mSinks = sinks;
 
@@ -865,8 +862,8 @@ public:
         {
             //XXX This loop may be a candidate for making AMI-ified and returning "Suspended"
             // Release all the RTP sessions we are using
-            for (std::vector<AsteriskSCF::Media::RTP::V1::RTPSessionPrx>::const_iterator i =
-                     mSessionPriv->mRTPSessions.begin(); i != mSessionPriv->mRTPSessions.end(); ++i)
+            for (RTPMediaSessionSeq::const_iterator i = mSessionPriv->mRTPSessions.begin();
+		 i != mSessionPriv->mRTPSessions.end(); ++i)
             {
                 try
                 {
@@ -1396,16 +1393,11 @@ void SipSession::setListeners(const AsteriskSCF::SIP::V1::SessionListenerSeq& li
 }
 
 /**
- * Internal function which returns the media session that is hidden inside the SIP session.
+ * Internal function which returns the RTP media sessions that are hidden inside the SIP session.
  */
-AsteriskSCF::Media::V1::SessionPrx SipSession::getHiddenMediaSession()
+RTPMediaSessionSeq SipSession::getRTPMediaSessions()
 {
-    if (mImplPriv->mRTPSessions.empty())
-    {
-        return 0;
-    }
-    // TODO: This should return a sequence
-    return mImplPriv->mRTPSessions.front();
+    return mImplPriv->mRTPSessions;
 }
 
 bool SipSession::operator==(const SipSession &other) const {
diff --git a/src/SipSession.h b/src/SipSession.h
index 4fe6c50..dfad6fa 100644
--- a/src/SipSession.h
+++ b/src/SipSession.h
@@ -100,11 +100,11 @@ public:
         bool isUAC);
 
     SipSession(const Ice::ObjectAdapterPtr&, const SipEndpointPtr&, const std::string&, const Ice::Identity&,
-        const Ice::Identity&, const AsteriskSCF::Media::V1::SessionPrx&,
-        const AsteriskSCF::Media::V1::StreamSourceSeq&, const AsteriskSCF::Media::V1::StreamSinkSeq&,
-        PJSipManager *manager, const AsteriskSCF::Core::Discovery::V1::ServiceLocatorPrx& serviceLocator,
-        const AsteriskSCF::System::Component::V1::ReplicaPtr& replica,
-        bool isUAC);
+               const Ice::Identity&, const AsteriskSCF::SIP::V1::RTPMediaSessionSeq&,
+               const AsteriskSCF::Media::V1::StreamSourceSeq&, const AsteriskSCF::Media::V1::StreamSinkSeq&,
+               PJSipManager *manager, const AsteriskSCF::Core::Discovery::V1::ServiceLocatorPrx& serviceLocator,
+               const AsteriskSCF::System::Component::V1::ReplicaPtr& replica,
+               bool isUAC);
 
     bool operator==(const SipSession &other) const;
 
@@ -196,7 +196,7 @@ public:
 
     void setListeners(const AsteriskSCF::SIP::V1::SessionListenerSeq&);
 
-    AsteriskSCF::Media::V1::SessionPrx getHiddenMediaSession();
+    AsteriskSCF::SIP::V1::RTPMediaSessionSeq getRTPMediaSessions();
 
     void enqueueSessionWork(const AsteriskSCF::System::WorkQueue::V1::SuspendableWorkPtr&);
 private:
diff --git a/src/SipStateReplicatorListener.cpp b/src/SipStateReplicatorListener.cpp
index 7774efe..19d4789 100644
--- a/src/SipStateReplicatorListener.cpp
+++ b/src/SipStateReplicatorListener.cpp
@@ -102,7 +102,7 @@ public:
 
                     // Now that all is well we can create an actual session
                     SipSessionPtr localSession = endpoint->createSession("", session->mSessionObjectId,
-                        session->mMediaSessionObjectId, session->mMediaSession, session->mSources, session->mSinks);
+                        session->mMediaSessionObjectId, session->mRTPMediaSessions, session->mSources, session->mSinks);
                     localitem->setSession(localSession);
                 }
                 else

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


-- 
asterisk-scf/integration/sip.git



More information about the asterisk-scf-commits mailing list