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

Commits to the Asterisk SCF project code repositories asterisk-scf-commits at lists.digium.com
Mon May 7 18:21:37 CDT 2012


branch "retry_deux" has been updated
       via  3826b2a07601a9e6ab878d51552e45a0e6bf837a (commit)
       via  faabd1d81ee4e79701eb1bb20f3f202991c73174 (commit)
      from  c90e9070e1a2f1d1f3959913c3bc2e8db998331e (commit)

Summary of changes:
 src/PJSIPSessionModule.cpp |    8 +++---
 src/SIPSession.cpp         |   57 ++++++++++++++++++++++++++-----------------
 src/SIPSession.h           |   10 +++++--
 3 files changed, 45 insertions(+), 30 deletions(-)


- Log -----------------------------------------------------------------
commit 3826b2a07601a9e6ab878d51552e45a0e6bf837a
Merge: faabd1d c90e907
Author: Ken Hunt <ken.hunt at digium.com>
Date:   Mon May 7 18:22:00 2012 -0500

    Merge branch 'retry_deux' of git.asterisk.org:asterisk-scf/integration/sip into retry_deux


commit faabd1d81ee4e79701eb1bb20f3f202991c73174
Author: Ken Hunt <ken.hunt at digium.com>
Date:   Mon May 7 18:20:29 2012 -0500

    Corrected overly aggressive reuse of session's original operation context which could lead to operations being ignored.

diff --git a/src/PJSIPSessionModule.cpp b/src/PJSIPSessionModule.cpp
index 9fb3d35..f8de853 100644
--- a/src/PJSIPSessionModule.cpp
+++ b/src/PJSIPSessionModule.cpp
@@ -528,12 +528,12 @@ protected:
         if (!mInv->neg || fail(pjmedia_sdp_neg_get_neg_remote(mInv->neg, &remote_sdp)))
         {
             // No SDP was present in the INVITE so we need to create an offer
-            sdp = mSession->createSDPOffer(StreamInformationDict(), streams);
+            sdp = mSession->createSDPOffer(Operations::createContext(), StreamInformationDict(), streams);
         }
         else
         {
             // SDP was present in the INVITE so we need to create an answer using their offer
-            sdp = mSession->createSDPAnswer(remote_sdp, streams);
+            sdp = mSession->createSDPAnswer(Operations::createContext(), remote_sdp, streams);
         }
 
         if (!sdp)
@@ -2105,7 +2105,7 @@ protected:
         SIPSessionPtr session = session_mod_info->getSessionPtr();
 
         StreamInformationDict added;
-        session->createSDPAnswer(remote_sdp, added);
+        session->createSDPAnswer(Operations::createContext(), remote_sdp, added);
 
         return Complete;
     }
@@ -2242,7 +2242,7 @@ protected:
         }
 
         // Call into the session for the serious work
-        mSession->createSDPAnswer(offer_sdp, mStreamsAdded);
+        mSession->createSDPAnswer(Operations::createContext(), offer_sdp, mStreamsAdded);
 
         // If no streams were added we can respond to the offer with the SDP we had previously and move on
         if (mStreamsAdded.empty())
diff --git a/src/SIPSession.cpp b/src/SIPSession.cpp
index 31a2e3d..9c4b21b 100755
--- a/src/SIPSession.cpp
+++ b/src/SIPSession.cpp
@@ -783,7 +783,7 @@ public:
 
             // Create an offer adding in the requested streams
             StreamInformationDict added;
-            pjmedia_sdp_session *sdp = mSession->createSDPOffer(mStreams, added);
+            pjmedia_sdp_session *sdp = mSession->createSDPOffer(mOperationContext, mStreams, added);
 
             // If no streams were actually added respond back appropriately
             if (added.empty())
@@ -1369,7 +1369,7 @@ void SIPSession::initializePJSIPStructs()
 
     // Create an SDP offer based on what is configured
     StreamInformationDict added;
-    pjmedia_sdp_session *sdp = createSDPOffer(StreamInformationDict(), added);
+    pjmedia_sdp_session *sdp = createSDPOffer(mImplPriv->mOperationContext, StreamInformationDict(), added);
 
     if (fail(pjsip_inv_create_uac(dialog, sdp, 0, &inviteSession)))
     {
@@ -3462,8 +3462,10 @@ void SIPSession::addFormatstoSDP(const FormatSeq& formats, pjmedia_sdp_media *me
 /**
  * Internal function called to produce an SDP session structure using configuration and provided streams
  */
-pjmedia_sdp_session *SIPSession::createSDPOffer(const AsteriskSCF::Media::V1::StreamInformationDict& streams,
-                                                AsteriskSCF::Media::V1::StreamInformationDict& newStreams)
+pjmedia_sdp_session *SIPSession::createSDPOffer(
+    const OperationContextPtr& baseContext,
+    const AsteriskSCF::Media::V1::StreamInformationDict& streams,
+    AsteriskSCF::Media::V1::StreamInformationDict& newStreams)
 {
     StreamInformationDict requestedStreams = streams;
 
@@ -3563,7 +3565,7 @@ pjmedia_sdp_session *SIPSession::createSDPOffer(const AsteriskSCF::Media::V1::St
 
             string modifier = "rtpSessionCreate." + boost::lexical_cast<std::string>(streamCount);
             RTPSessionPrx session = factory->allocate(
-                Operations::calculateOperationContext(mImplPriv->mOperationContext, modifier),
+                Operations::calculateOperationContext(baseContext, modifier),
                 params, options, outputs);
 
             // Double check to make sure they actually gave us a sesson back... they could have had a problem
@@ -3644,7 +3646,7 @@ pjmedia_sdp_session *SIPSession::createSDPOffer(const AsteriskSCF::Media::V1::St
             // Push the payload mapping to the RTP session so it'll correctly map things
             string payloadModifier = "payload." + boost::lexical_cast<std::string>(streamCount);
             session->associatePayloads(
-                Operations::calculateOperationContext(mImplPriv->mOperationContext, payloadModifier), 
+                Operations::calculateOperationContext(baseContext, payloadModifier), 
                 payloads);
         }
         else if ((t38 = T38UdptlFormatPtr::dynamicCast(formats.front())))
@@ -3680,7 +3682,7 @@ pjmedia_sdp_session *SIPSession::createSDPOffer(const AsteriskSCF::Media::V1::St
 
             string udptlModifier = "udptlCreate." + boost::lexical_cast<std::string>(streamCount);
             UDPTLSessionPrx session = factory->allocate(
-                Operations::calculateOperationContext(mImplPriv->mOperationContext, udptlModifier), 
+                Operations::calculateOperationContext(baseContext, udptlModifier), 
                 params);
 
             if (session == 0)
@@ -3782,8 +3784,10 @@ pjmedia_sdp_session *SIPSession::createSDPOffer(const AsteriskSCF::Media::V1::St
 /**
  * Internal function called to produce an SDP session structure using configuration and an SDP offer.
  */
-pjmedia_sdp_session *SIPSession::createSDPAnswer(const pjmedia_sdp_session* offer,
-                                                 AsteriskSCF::Media::V1::StreamInformationDict& newStreams)
+pjmedia_sdp_session *SIPSession::createSDPAnswer(
+    const OperationContextPtr& baseContext,
+    const pjmedia_sdp_session* offer,
+    AsteriskSCF::Media::V1::StreamInformationDict& newStreams)
 {
     // Create the most common part of the SDP if not already done
     if (!mImplPriv->mSDP)
@@ -4081,7 +4085,7 @@ pjmedia_sdp_session *SIPSession::createSDPAnswer(const pjmedia_sdp_session* offe
 
                 string rtpModifier = "sdpCreateRTPSession." + boost::lexical_cast<std::string>(streamCount);
                 session = factory->allocate(
-                    Operations::calculateOperationContext(mImplPriv->mOperationContext, rtpModifier), 
+                    Operations::calculateOperationContext(baseContext, rtpModifier), 
                     params, options, outputs);
 
                 // Double check to make sure they actually gave us a sesson back... they could have had a problem
@@ -4145,7 +4149,7 @@ pjmedia_sdp_session *SIPSession::createSDPAnswer(const pjmedia_sdp_session* offe
                 // Push the payload mapping to the RTP session so it'll correctly map things
                 string sdpPayloadModifier = "sdpPayload." + boost::lexical_cast<std::string>(streamCount);
                 session->associatePayloads(
-                    Operations::calculateOperationContext(mImplPriv->mOperationContext, sdpPayloadModifier), 
+                    Operations::calculateOperationContext(baseContext, sdpPayloadModifier), 
                     payloads);
             }
 
@@ -4173,7 +4177,7 @@ pjmedia_sdp_session *SIPSession::createSDPAnswer(const pjmedia_sdp_session* offe
 
                 string rtcpDetailModifier = "RTCPDetails." + boost::lexical_cast<std::string>(streamCount);
                 rtcpSession->setRemoteDetails(
-                    Operations::calculateOperationContext(mImplPriv->mOperationContext, rtcpDetailModifier),
+                    Operations::calculateOperationContext(baseContext, rtcpDetailModifier),
                     rtcpConnection, rtcpPort);
             }
 
@@ -4186,7 +4190,7 @@ pjmedia_sdp_session *SIPSession::createSDPAnswer(const pjmedia_sdp_session* offe
             {
                 string sinkRtpModifier = "sinkRtpDetails." + boost::lexical_cast<std::string>(streamCount);
                 sink->setRemoteDetails(
-                    Operations::calculateOperationContext(mImplPriv->mOperationContext, sinkRtpModifier),
+                    Operations::calculateOperationContext(baseContext, sinkRtpModifier),
                     connection, offer->media[stream]->desc.port);
             }
             catch (const AsteriskSCF::Media::RTP::V1::InvalidAddress&)
@@ -4273,7 +4277,7 @@ pjmedia_sdp_session *SIPSession::createSDPAnswer(const pjmedia_sdp_session* offe
 
                 string udptlModifier = "sdpUdptlCreate." + boost::lexical_cast<std::string>(streamCount);
                 UDPTLSessionPrx session = factory->allocate(
-                    Operations::calculateOperationContext(mImplPriv->mOperationContext, udptlModifier), 
+                    Operations::calculateOperationContext(baseContext, udptlModifier), 
                     params);
 
                 if (session == 0)
@@ -4335,7 +4339,7 @@ pjmedia_sdp_session *SIPSession::createSDPAnswer(const pjmedia_sdp_session* offe
             {
                 string sinkUdptlModifier = "sinkUdptlDetails." + boost::lexical_cast<std::string>(streamCount);
                 sink->setRemoteDetails(
-                     Operations::calculateOperationContext(mImplPriv->mOperationContext, sinkUdptlModifier),
+                     Operations::calculateOperationContext(baseContext, sinkUdptlModifier),
                      connection, offer->media[stream]->desc.port);
             }
             catch (const AsteriskSCF::Network::V1::InvalidAddress&)
@@ -4359,19 +4363,19 @@ pjmedia_sdp_session *SIPSession::createSDPAnswer(const pjmedia_sdp_session* offe
             if (t38Configuration->maxDatagram)
             {
                 sink->setFarMaxDatagram(
-                     Operations::calculateOperationContext(mImplPriv->mOperationContext, farMaxModifier),
+                     Operations::calculateOperationContext(baseContext, farMaxModifier),
                      t38Configuration->maxDatagram);
             }
             else
             {
                 sink->setFarMaxDatagram(
-                    Operations::calculateOperationContext(mImplPriv->mOperationContext, farMaxModifier),
+                    Operations::calculateOperationContext(baseContext, farMaxModifier),
                     t38->maxDatagram);
             }
 
             string ecModifier = "errorCorrect." + boost::lexical_cast<std::string>(streamCount);
             sink->setErrorCorrectionScheme(
-                Operations::calculateOperationContext(mImplPriv->mOperationContext, ecModifier),
+                Operations::calculateOperationContext(baseContext, ecModifier),
                 t38->errorCorrection);
 
 	    break;
@@ -4397,14 +4401,14 @@ pjmedia_sdp_session *SIPSession::createSDPAnswer(const pjmedia_sdp_session* offe
         {
             string sdpRemoveModifier = "sdpRemoveStream." + boost::lexical_cast<std::string>(streamCount);
             mImplPriv->mSessionController->removeStreams(
-                Operations::calculateOperationContext(mImplPriv->mOperationContext, sdpRemoveModifier), 
+                Operations::calculateOperationContext(baseContext, sdpRemoveModifier), 
                 streamsRemoved);
         }
         if (!streamsChanged.empty())
         {
             string sdpChangeStreamModifier = "sdpChangeStream." + boost::lexical_cast<std::string>(streamCount);
             mImplPriv->mSessionController->changeStreamStates(
-                Operations::calculateOperationContext(mImplPriv->mOperationContext, sdpChangeStreamModifier),
+                Operations::calculateOperationContext(baseContext, sdpChangeStreamModifier),
                 streamsChanged);
         }
     }
@@ -4415,7 +4419,7 @@ pjmedia_sdp_session *SIPSession::createSDPAnswer(const pjmedia_sdp_session* offe
         mImplPriv->mAddStreamsCb = 0;
     }
 
-    startMedia(mImplPriv->mSDP, offer);
+    startMedia(baseContext, mImplPriv->mSDP, offer);
 
     mImplPriv->mNewStreams.clear();
     mImplPriv->mAddStreamsMapping.clear();
@@ -4632,7 +4636,14 @@ AsteriskSCF::SessionCommunications::V1::SessionListenerSeq SIPSession::getListen
     return mImplPriv->mListeners;
 }
 
-void SIPSession::startMedia(const pjmedia_sdp_session*, const pjmedia_sdp_session* remote)
+/** 
+ * Start media streams.
+ * @param baseContext Used as a basis for outgoing remote calls. 
+ */
+void SIPSession::startMedia(
+    const AsteriskSCF::System::V1::OperationContextPtr& baseContext,
+    const pjmedia_sdp_session*, 
+    const pjmedia_sdp_session* remote)
 {
     //
     // XXX: we aren't going to do anything with local just yet. We only have the one attribute
@@ -4705,7 +4716,7 @@ void SIPSession::startMedia(const pjmedia_sdp_session*, const pjmedia_sdp_sessio
             
             }
             srtpSession->start(
-                Operations::calculateOperationContext(mImplPriv->mOperationContext, "srtpStart"),
+                Operations::calculateOperationContext(baseContext, "srtpStart"),
                 suite, key, config.srtpConfig.enableAuthentication,
                 config.srtpConfig.enableEncryption);
         }
diff --git a/src/SIPSession.h b/src/SIPSession.h
index 3a15024..2408259 100644
--- a/src/SIPSession.h
+++ b/src/SIPSession.h
@@ -321,10 +321,12 @@ public:
 
     void addKeys(const SIPEndpointMediaSRTPConfig& config, pjmedia_sdp_media* mediaSDP);
 
-    pjmedia_sdp_session *createSDPOffer(const AsteriskSCF::Media::V1::StreamInformationDict&,
+    pjmedia_sdp_session *createSDPOffer(const AsteriskSCF::System::V1::OperationContextPtr&,
+                                        const AsteriskSCF::Media::V1::StreamInformationDict&,
                                         AsteriskSCF::Media::V1::StreamInformationDict&);
 
-    pjmedia_sdp_session *createSDPAnswer(const pjmedia_sdp_session*,
+    pjmedia_sdp_session *createSDPAnswer(const AsteriskSCF::System::V1::OperationContextPtr&,
+                                         const pjmedia_sdp_session*,
                                          AsteriskSCF::Media::V1::StreamInformationDict&);
 
     pjmedia_sdp_session *modifySDP(const AsteriskSCF::Media::V1::StreamInformationDict&);
@@ -356,7 +358,9 @@ public:
     // Final notification to the media components (if necessary) that the connection has been completely established.
     // This should happen after the SDP negotiation is complete.
     //
-    void startMedia(const pjmedia_sdp_session* local, const pjmedia_sdp_session* remote);
+    void startMedia(const AsteriskSCF::System::V1::OperationContextPtr&,
+                    const pjmedia_sdp_session* local, 
+                    const pjmedia_sdp_session* remote);
 
     AsteriskSCF::Media::V1::StreamInformationDict& getStreams();
 

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


-- 
asterisk-scf/integration/sip.git



More information about the asterisk-scf-commits mailing list