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

Commits to the Asterisk SCF project code repositories asterisk-scf-commits at lists.digium.com
Tue Jul 12 07:03:54 CDT 2011


branch "nat-support" has been updated
       via  5846372d877d813e35164d59177c7dffd3324d65 (commit)
      from  924f082ff8ef9321b4b652a6f506f3ad8777ecd2 (commit)

Summary of changes:
 src/STUNTransport.cpp |    1 +
 src/SipSession.cpp    |   70 +++++++++++++++++++++++++++---------------------
 2 files changed, 40 insertions(+), 31 deletions(-)
 mode change 100644 => 100755 src/SipSession.cpp


- Log -----------------------------------------------------------------
commit 5846372d877d813e35164d59177c7dffd3324d65
Author: Brent Eagles <beagles at digium.com>
Date:   Tue Jul 12 09:32:50 2011 -0230

    Fixing compile error found on Windows (odd that it built on linux).
    Add some localized exception handling when setting up RTP sessions.

diff --git a/src/STUNTransport.cpp b/src/STUNTransport.cpp
index 1b509b4..076ee72 100644
--- a/src/STUNTransport.cpp
+++ b/src/STUNTransport.cpp
@@ -120,6 +120,7 @@ private:
         {
             data->op_key.tdata = 0;
         }
+        return PJ_SUCCESS;
     }
 
     static pj_status_t shutdownImplCB(pjsip_transport*)
diff --git a/src/SipSession.cpp b/src/SipSession.cpp
old mode 100644
new mode 100755
index 4e7c9da..43f12c7
--- a/src/SipSession.cpp
+++ b/src/SipSession.cpp
@@ -1302,43 +1302,51 @@ void SipSession::requestRTPSessions(AsteriskSCF::Media::V1::FormatSeq& formats,
     params->formats = formats;
     params->ipv6 = ipv6;
 
-    AsteriskSCF::Media::RTP::V1::RTPMediaServicePrx factory =
-        AsteriskSCF::Media::RTP::V1::RTPMediaServicePrx::uncheckedCast(mImplPriv->mServiceLocator->locate(params));
-    if (!factory)
+    try
     {
-        assert("Location request has returned a nil proxy, this should throw!" == 0);
-        //
-        // TODO: throw!
-        //
-    }
-    AsteriskSCF::Media::RTP::V1::RTPSessionPrx session = factory->allocate(params);
+        AsteriskSCF::Media::RTP::V1::RTPMediaServicePrx factory =
+            AsteriskSCF::Media::RTP::V1::RTPMediaServicePrx::uncheckedCast(mImplPriv->mServiceLocator->locate(params));
+        if (!factory)
+        {
+            assert("Location request has returned a nil proxy, this should throw!" == 0);
+            //
+            // TODO: throw!
+            //
+        }
+        AsteriskSCF::Media::RTP::V1::RTPSessionPrx session = factory->allocate(params);
 
-    if (!session)
-    {
-        assert("Allocation of rtp streams failed! This should've thrown an exception!" == 0);
-        //
-        // TODO Throw!
-        //
-    }
-    mImplPriv->mRTPSessions.push_back(session);
+        if (!session)
+        {
+            assert("Allocation of rtp streams failed! This should've thrown an exception!" == 0);
+            //
+            // TODO Throw!
+            //
+        }
+        mImplPriv->mRTPSessions.push_back(session);
 
-    // Create a local copy of the sources, this won't get changed by the RTP session so it's all good
-    mImplPriv->mSources = session->getSources();
+        // Create a local copy of the sources, this won't get changed by the RTP session so it's all good
+        mImplPriv->mSources = session->getSources();
 
-    // Create a local copy of the sinks, this won't get changed by the RTP session so it's all good
-    mImplPriv->mSinks = session->getSinks();
+        // Create a local copy of the sinks, this won't get changed by the RTP session so it's all good
+        mImplPriv->mSinks = session->getSinks();
 
-    // For testing push a static payload mapping for ULAW into the RTP session
-    AsteriskSCF::Media::RTP::V1::PayloadMap payloads;
-    AsteriskSCF::Media::V1::AudioFormatPtr format = new AsteriskSCF::Media::V1::AudioFormat();
-    format->name = "ulaw";
-    format->sampleRate = 8000;
-    format->frameSize = 20;
-    format->maximumFrameSize = 20;
-    format->minimumFrameSize = 20;
-    payloads.insert(std::make_pair(0, format));
+        // For testing push a static payload mapping for ULAW into the RTP session
+        AsteriskSCF::Media::RTP::V1::PayloadMap payloads;
+        AsteriskSCF::Media::V1::AudioFormatPtr format = new AsteriskSCF::Media::V1::AudioFormat();
+        format->name = "ulaw";
+        format->sampleRate = 8000;
+        format->frameSize = 20;
+        format->maximumFrameSize = 20;
+        format->minimumFrameSize = 20;
+        payloads.insert(std::make_pair(0, format));
 
-    session->associatePayloads(payloads);
+        session->associatePayloads(payloads);
+    }
+    catch (const Ice::Exception& ex)
+    {
+        lg(Debug) << "Exception caught while trying to allocate RTP session. " << ex.what();
+        throw;
+    }
 }
 
 /**

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


-- 
asterisk-scf/integration/sip.git



More information about the asterisk-scf-commits mailing list