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

Commits to the Asterisk SCF project code repositories asterisk-scf-commits at lists.digium.com
Tue Sep 20 07:30:35 CDT 2011


branch "t38udptl" has been updated
       via  d34a15b62902bf2b3d2596b25860be896ff9598e (commit)
       via  e94389eb444bff150f430ada532cf72595b4a3e9 (commit)
       via  d9928ed49f58953692b17d1c13861c0915046941 (commit)
       via  93cffc06bc15610fcf293c956d3c78e142f0d17d (commit)
       via  22f1eb1091870b685f6b3b65c6aef7d5e2c7ceb2 (commit)
       via  b3b4ee002e2a13fc33750dfcb56c32e5ac619453 (commit)
       via  2adfbe9271d8885007ff112cbea23c4f4bc56b64 (commit)
       via  e1f7c466fb0b7586becfcfa89432838627c08438 (commit)
       via  68927c58a70d55a816a39dfafc00075c289d8c97 (commit)
      from  1c58e78ff33ecc57b2d881275f2d8974b2b7b58c (commit)

Summary of changes:
 config/SipConfigurator.py  |   46 ++++++++++++++++++++++--------
 src/PJSipSessionModule.cpp |    8 +----
 src/SipEndpoint.cpp        |   16 ++++++++++
 src/SipEndpoint.h          |    7 ++++-
 src/SipSession.cpp         |   68 ++++++++++++++++++++++++++++++++++++++++---
 5 files changed, 120 insertions(+), 25 deletions(-)


- Log -----------------------------------------------------------------
commit d34a15b62902bf2b3d2596b25860be896ff9598e
Author: Joshua Colp <jcolp at digium.com>
Date:   Tue Sep 20 09:36:20 2011 -0300

    Only provide a T.38 stream when asked and fix a bug where the t38 payload was not present in SDP.

diff --git a/src/SipSession.cpp b/src/SipSession.cpp
index 7194cf9..cf9e250 100755
--- a/src/SipSession.cpp
+++ b/src/SipSession.cpp
@@ -2191,11 +2191,13 @@ pjmedia_sdp_session *SipSession::createSDPOffer(const AsteriskSCF::Media::V1::St
             mImplPriv->mUDPTLSessions.push_back(session);
 
             // Add the stream to the SDP
-            pjmedia_sdp_media *media = allocate_from_pool<pjmedia_sdp_media>(mImplPriv->mDialog->pool);
+            mImplPriv->mSDP->media_count = 0;
 
+            pjmedia_sdp_media *media = allocate_from_pool<pjmedia_sdp_media>(mImplPriv->mDialog->pool);
             // The media count is purposely not incremented here since it is done when the stream is added to the sequence
             // of streams
             mImplPriv->mSDP->media[mImplPriv->mSDP->media_count] = media;
+
             pj_strdup2(mImplPriv->mDialog->pool, &media->desc.media, mImplPriv->mEndpoint->getDescriptor(
                            stream->second->formats.front())->type.c_str());
 
@@ -2705,11 +2707,15 @@ pjmedia_sdp_session *SipSession::createSDPAnswer(const pjmedia_sdp_session* offe
 
                 mImplPriv->mUDPTLSessions.push_back(session);
 
+                mImplPriv->mSDP->media_count = 0;
+
                 pjmedia_sdp_media *media = allocate_from_pool<pjmedia_sdp_media>(mImplPriv->mDialog->pool);
                 mImplPriv->mSDP->media[mImplPriv->mSDP->media_count++] = media;
 
                 media->desc.media = offer->media[stream]->desc.media;
                 media->desc.transport = offer->media[stream]->desc.transport;
+		media->desc.fmt[0] = offer->media[stream]->desc.fmt[0];
+		media->desc.fmt_count++;
 
                 media->conn = allocate_from_pool<pjmedia_sdp_conn>(mImplPriv->mDialog->pool);
                 media->conn->net_type = offer->origin.net_type;

commit e94389eb444bff150f430ada532cf72595b4a3e9
Author: Joshua Colp <jcolp at digium.com>
Date:   Tue Sep 20 09:35:42 2011 -0300

    Use the SDP parameters from the remote endpoint when making an offer, and set things on the UDPTL session.

diff --git a/src/SipEndpoint.cpp b/src/SipEndpoint.cpp
index cb2d24d..7e18d27 100644
--- a/src/SipEndpoint.cpp
+++ b/src/SipEndpoint.cpp
@@ -663,6 +663,22 @@ SDPDescriptorPtr SipEndpoint::getDescriptor(const FormatPtr& format)
     return 0;
 }
 
+SDPDescriptorPtr SipEndpoint::getInterpretedDescriptor(const FormatPtr& format)
+{
+    for (std::vector<ConfiguredFormatPtr>::const_iterator configuredFormat = mImplPriv->mFormats.begin();
+         configuredFormat != mImplPriv->mFormats.end();
+         ++configuredFormat)
+    {
+        if ((*configuredFormat)->getFormat()->name == format->name)
+        {
+            return (*configuredFormat)->getDescriptorService()->getDescriptor(format);
+        }
+    }
+
+    return 0;
+}
+
+
 StreamInformationDict SipEndpoint::getStreamTopology()
 {
     StreamInformationDict topology;
diff --git a/src/SipEndpoint.h b/src/SipEndpoint.h
index 80b9e2e..349015b 100644
--- a/src/SipEndpoint.h
+++ b/src/SipEndpoint.h
@@ -342,11 +342,16 @@ public:
         const AsteriskSCF::Media::SDP::V1::SDPDescriptorPtr&);
     
     /**
-     * API call which returns a descriptor given a media format.
+     * API call which returns a locally cached descriptor given a media format.
      */
     AsteriskSCF::Media::SDP::V1::SDPDescriptorPtr getDescriptor(const AsteriskSCF::Media::V1::FormatPtr&);
 
     /**
+     * API call which returns a descriptor given a media format.
+     */
+    AsteriskSCF::Media::SDP::V1::SDPDescriptorPtr getInterpretedDescriptor(const AsteriskSCF::Media::V1::FormatPtr&);
+
+    /**
      * API call which returns the stream topology to be used for an SDP offer.
      */
     void setMediaNATOptions(bool useICE, bool useTURN);
diff --git a/src/SipSession.cpp b/src/SipSession.cpp
index dba05b4..7194cf9 100755
--- a/src/SipSession.cpp
+++ b/src/SipSession.cpp
@@ -2227,7 +2227,7 @@ pjmedia_sdp_session *SipSession::createSDPOffer(const AsteriskSCF::Media::V1::St
             media->desc.port = (pj_uint16_t) source->getLocalPort();
             media->desc.port_count = 1;
 
-            SDPDescriptorPtr ourDescriptor = mImplPriv->mEndpoint->getDescriptor(t38);
+            SDPDescriptorPtr ourDescriptor = mImplPriv->mEndpoint->getInterpretedDescriptor(t38);
             for (SDPFormatParameterSeq::const_iterator parameter = ourDescriptor->parameters.begin();
                  parameter != ourDescriptor->parameters.end();
                  ++parameter)
@@ -2724,7 +2724,7 @@ pjmedia_sdp_session *SipSession::createSDPAnswer(const pjmedia_sdp_session* offe
                 media->desc.port = (pj_uint16_t) source->getLocalPort();
                 media->desc.port_count = 1;
 
-                SDPDescriptorPtr ourDescriptor = mImplPriv->mEndpoint->getDescriptor(t38);
+                SDPDescriptorPtr ourDescriptor = mImplPriv->mEndpoint->getInterpretedDescriptor(t38);
                 for (SDPFormatParameterSeq::const_iterator parameter = ourDescriptor->parameters.begin();
                      parameter != ourDescriptor->parameters.end();
                      ++parameter)
@@ -2749,6 +2749,9 @@ pjmedia_sdp_session *SipSession::createSDPAnswer(const pjmedia_sdp_session* offe
                 }
                 return 0;
             }
+
+            sink->setFarMaxDatagram(t38->maxDatagram);
+            sink->setErrorCorrectionScheme(t38->errorCorrection);
         }
         else
         {

commit d9928ed49f58953692b17d1c13861c0915046941
Author: Joshua Colp <jcolp at digium.com>
Date:   Tue Sep 20 09:07:13 2011 -0300

    Fix bug where if a stream was added and the negotiation failed the SessionController would not get notified.

diff --git a/src/PJSipSessionModule.cpp b/src/PJSipSessionModule.cpp
index 30d0a4e..e7df464 100644
--- a/src/PJSipSessionModule.cpp
+++ b/src/PJSipSessionModule.cpp
@@ -1505,14 +1505,8 @@ private:
     ServiceLocatorPrx mServiceLocator;
 };
 
-void PJSipSessionModule::invOnMediaUpdate(pjsip_inv_session *inv, pj_status_t status)
+void PJSipSessionModule::invOnMediaUpdate(pjsip_inv_session *inv, pj_status_t)
 {
-    if (status != PJ_SUCCESS)
-    {
-        // We have nothing, zip, nada, kablamo, in common.
-        return;
-    }
-
     lg(Debug) << "Queuing HandleMediaUpdate";
     enqueueSessionWork(new HandleMediaUpdate(inv, mModule.id, mServiceLocator), inv);
 }

commit 93cffc06bc15610fcf293c956d3c78e142f0d17d
Author: Joshua Colp <jcolp at digium.com>
Date:   Mon Sep 19 11:37:02 2011 -0300

    Add t38 format to the SDP to make it proper.

diff --git a/src/SipSession.cpp b/src/SipSession.cpp
index 95ca93b..dba05b4 100755
--- a/src/SipSession.cpp
+++ b/src/SipSession.cpp
@@ -2201,6 +2201,8 @@ pjmedia_sdp_session *SipSession::createSDPOffer(const AsteriskSCF::Media::V1::St
 
             pj_strdup2(mImplPriv->mDialog->pool, &media->desc.transport, "UDPTL");
 
+	    pj_strdup2(mImplPriv->mDialog->pool, &media->desc.fmt[media->desc.fmt_count++], "t38");
+
             // Add connection level details
             media->conn = allocate_from_pool<pjmedia_sdp_conn>(mImplPriv->mDialog->pool);
             pj_strdup2(mImplPriv->mDialog->pool, &media->conn->net_type, "IN");
@@ -2566,6 +2568,7 @@ pjmedia_sdp_session *SipSession::createSDPAnswer(const pjmedia_sdp_session* offe
                 // Since our stream should be like the offering stream we can just use some values from there
                 media->desc.media = offer->media[stream]->desc.media;
                 media->desc.transport = offer->media[stream]->desc.transport;
+		media->desc.fmt[0] = offer->media[stream]->desc.fmt[0];
 
                 // Add connection level information so they know our IP address
                 media->conn = allocate_from_pool<pjmedia_sdp_conn>(mImplPriv->mDialog->pool);

commit 22f1eb1091870b685f6b3b65c6aef7d5e2c7ceb2
Author: Joshua Colp <jcolp at digium.com>
Date:   Mon Sep 19 11:05:54 2011 -0300

    Add support for modifying the transport of a media stream.

diff --git a/src/SipSession.cpp b/src/SipSession.cpp
index 03c69ad..95ca93b 100755
--- a/src/SipSession.cpp
+++ b/src/SipSession.cpp
@@ -2465,6 +2465,29 @@ pjmedia_sdp_session *SipSession::createSDPAnswer(const pjmedia_sdp_session* offe
 
         if ((audio = AudioFormatPtr::dynamicCast(formats.front())) || (video = VideoFormatPtr::dynamicCast(formats.front())))
         {
+            // If this is a modified stream make sure the transport is RTP, if not clear things out
+            if (!ourStream->sinks.empty())
+            {
+                StreamSinkRTPPrx rtpSink = StreamSinkRTPPrx::checkedCast(ourStream->sinks.front());
+                if (!rtpSink)
+                {
+                    ourStream->sinks.clear();
+                    newStreams.erase(boost::lexical_cast<std::string>(stream));
+                    newStreams.insert(make_pair(boost::lexical_cast<std::string>(stream), ourStream));
+                }
+            }
+
+            if (!ourStream->sources.empty())
+            {
+                StreamSourceRTPPrx rtpSource = StreamSourceRTPPrx::checkedCast(ourStream->sources.front());
+                if (!rtpSource)
+                {
+                    ourStream->sources.clear();
+                    newStreams.erase(boost::lexical_cast<std::string>(stream));
+                    newStreams.insert(make_pair(boost::lexical_cast<std::string>(stream), ourStream));
+                }
+            }
+
             RTPSessionPrx session;
 
             // If no sink and no source is present then this stream has no RTP session yet so find one
@@ -2614,6 +2637,29 @@ pjmedia_sdp_session *SipSession::createSDPAnswer(const pjmedia_sdp_session* offe
         }
         else if ((t38 = T38UdptlFormatPtr::dynamicCast(formats.front())))
         {
+            // If this is a modified stream make sure the transport is UDPTL, if not clear things out
+            if (!ourStream->sinks.empty())
+            {
+                StreamSinkUDPTLPrx udptlSink = StreamSinkUDPTLPrx::checkedCast(ourStream->sinks.front());
+                if (!udptlSink)
+                {
+                    ourStream->sinks.clear();
+                    newStreams.erase(boost::lexical_cast<std::string>(stream));
+                    newStreams.insert(make_pair(boost::lexical_cast<std::string>(stream), ourStream));
+                }
+            }
+
+            if (!ourStream->sources.empty())
+            {
+                StreamSourceUDPTLPrx udptlSource = StreamSourceUDPTLPrx::checkedCast(ourStream->sources.front());
+                if (!udptlSource)
+                {
+                    ourStream->sources.clear();
+                    newStreams.erase(boost::lexical_cast<std::string>(stream));
+                    newStreams.insert(make_pair(boost::lexical_cast<std::string>(stream), ourStream));
+                }
+            }
+
             if (ourStream->sinks.empty() && ourStream->sources.empty())
             {
                 UDPTLServiceLocatorParamsPtr params = new UDPTLServiceLocatorParams();

commit b3b4ee002e2a13fc33750dfcb56c32e5ac619453
Author: Joshua Colp <jcolp at digium.com>
Date:   Mon Sep 19 10:43:58 2011 -0300

    Use the correct subtype to find the T.38 UDPTL media format.

diff --git a/src/SipSession.cpp b/src/SipSession.cpp
index 8266a7a..03c69ad 100755
--- a/src/SipSession.cpp
+++ b/src/SipSession.cpp
@@ -2337,7 +2337,7 @@ pjmedia_sdp_session *SipSession::createSDPAnswer(const pjmedia_sdp_session* offe
             if (descriptor->type == "image" && (payload == "T38" || payload == "t38"))
             {
                 descriptor->payload = 96;
-                descriptor->subtype = "t38udptl";
+                descriptor->subtype = "UDPTL";
             }
             else
             {

commit 2adfbe9271d8885007ff112cbea23c4f4bc56b64
Author: Joshua Colp <jcolp at digium.com>
Date:   Mon Sep 19 10:39:07 2011 -0300

    Tweak so you only have to provide the name of the format.

diff --git a/config/SipConfigurator.py b/config/SipConfigurator.py
index 62aea07..e20050c 100755
--- a/config/SipConfigurator.py
+++ b/config/SipConfigurator.py
@@ -251,16 +251,17 @@ class SipSectionVisitors(Configurator.SectionVisitors):
                 else:
                     rest = front
 
-                if item.name:
-                    item.formatSpecific = [ ]
+                item.formatSpecific = [ ]
+
+                if not item.name:
+                    item.name = format
 
+                if item.name:
                     while rest:
                         front, found, rest = rest.partition('&')
                         item.formatSpecific.append(front)
 
                     group.configurationItems[format] = item
-                else:
-                    print 'There is a format with no name specified'
         except:
             print 'No configured formats for endpoint ' + section
 

commit e1f7c466fb0b7586becfcfa89432838627c08438
Author: Joshua Colp <jcolp at digium.com>
Date:   Mon Sep 19 10:17:57 2011 -0300

    Payload is actually T38 or t38 (depending on remote endpoint), UDPTL is the transport.

diff --git a/src/SipSession.cpp b/src/SipSession.cpp
index c14ceb9..8266a7a 100755
--- a/src/SipSession.cpp
+++ b/src/SipSession.cpp
@@ -2334,7 +2334,7 @@ pjmedia_sdp_session *SipSession::createSDPAnswer(const pjmedia_sdp_session* offe
                 pj_strlen(&offer->media[stream]->desc.fmt[format]));
 
             // If this is for T.38 it is actually special
-            if (descriptor->type == "image" && (payload == "UDPTL" || payload == "udptl"))
+            if (descriptor->type == "image" && (payload == "T38" || payload == "t38"))
             {
                 descriptor->payload = 96;
                 descriptor->subtype = "t38udptl";

commit 68927c58a70d55a816a39dfafc00075c289d8c97
Author: Joshua Colp <jcolp at digium.com>
Date:   Mon Sep 19 08:44:12 2011 -0300

    Make the SIP configurator more forgiving with missing values and have it separate specified parameters.

diff --git a/config/SipConfigurator.py b/config/SipConfigurator.py
index 88639a8..62aea07 100755
--- a/config/SipConfigurator.py
+++ b/config/SipConfigurator.py
@@ -225,21 +225,42 @@ class SipSectionVisitors(Configurator.SectionVisitors):
             formats = config.get(section, 'formats')
             configuredFormats = formats.split(',')
             for format in configuredFormats:
-                name, found, rest = format.partition('/')
-                sampleRate, found, rest = rest.partition('@')
-                frameSize, found, formatSpecific = rest.partition(';')
-
                 item = AsteriskSCF.Configuration.SipSessionManager.V1.SipMediaFormatItem()
-                item.name = name
-                if sampleRate:
-                    item.sampleRate = sampleRate
-                if frameSize:
-                    item.frameSize = frameSize
-                item.formatSpecific = [ ]
-                if formatSpecific:
-                    item.formatSpecific.append(formatSpecific)
-
-                group.configurationItems[format] = item
+
+                front, found, rest = format.partition('/')
+                if found:
+                    item.name = front
+                else:
+                    rest = front
+
+                front, found, rest = rest.partition('@')
+                if found:
+                    if item.name:
+                        item.sampleRate = front
+                    else:
+                        item.name = front
+                else:
+                    rest = front
+
+                front, found, rest = rest.partition(';')
+                if found:
+                    if item.name:
+                        item.frameSize = front
+                    else:
+                        item.name = front
+                else:
+                    rest = front
+
+                if item.name:
+                    item.formatSpecific = [ ]
+
+                    while rest:
+                        front, found, rest = rest.partition('&')
+                        item.formatSpecific.append(front)
+
+                    group.configurationItems[format] = item
+                else:
+                    print 'There is a format with no name specified'
         except:
             print 'No configured formats for endpoint ' + section
 

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


-- 
asterisk-scf/integration/sip.git



More information about the asterisk-scf-commits mailing list