<h1>Project "FreeSWITCH Source" received a push.</h1>

<h2>branch: master updated</h2>
<pre>
       via: c565501f555a507fa2c56eccedccdbba7a366d6d (commit)
      from: 6ea5f03b445c3ddb023464e0d497b4325025025a (commit)


</pre>= COMMIT LOG ===========================================================
<div class="highlight"><pre>committer: Anthony Minessale
comments: 
tell rtp stack about what remote payload type to expect when the receiving end follows the stupid SHOULD as WONT and sends a different dynamic payload number than the one in the offer

<span style="color: #000080; font-weight: bold">diff --git a/src/include/switch_rtp.h b/src/include/switch_rtp.h</span>
<span style="color: #000080; font-weight: bold">index 27dacc7..2870bba 100644</span>
<span style="color: #A00000">--- a/src/include/switch_rtp.h</span>
<span style="color: #00A000">+++ b/src/include/switch_rtp.h</span>
<span style="color: #800080; font-weight: bold">@@ -437,6 +437,8 @@ SWITCH_DECLARE(void) switch_rtp_set_private(switch_rtp_t *rtp_session, void *pri</span>
 */
 SWITCH_DECLARE(void) switch_rtp_set_telephony_event(switch_rtp_t *rtp_session, switch_payload_t te);
 SWITCH_DECLARE(void) switch_rtp_set_telephony_recv_event(switch_rtp_t *rtp_session, switch_payload_t te);
<span style="color: #00A000">+SWITCH_DECLARE(void) switch_rtp_set_recv_pt(switch_rtp_t *rtp_session, switch_payload_t pt);</span>
<span style="color: #00A000">+</span>
 /*! 
   \brief Set the payload type for comfort noise
   \param rtp_session the RTP session to modify
<span style="color: #000080; font-weight: bold">diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.h b/src/mod/endpoints/mod_sofia/mod_sofia.h</span>
<span style="color: #000080; font-weight: bold">index 12148c0..da92746 100644</span>
<span style="color: #A00000">--- a/src/mod/endpoints/mod_sofia/mod_sofia.h</span>
<span style="color: #00A000">+++ b/src/mod/endpoints/mod_sofia/mod_sofia.h</span>
<span style="color: #800080; font-weight: bold">@@ -587,6 +587,8 @@ struct private_object {</span>
         sofia_private_t *sofia_private;
         uint8_t flags[TFLAG_MAX];
         switch_payload_t agreed_pt;
<span style="color: #00A000">+        switch_payload_t audio_recv_pt;</span>
<span style="color: #00A000">+        switch_payload_t video_recv_pt;</span>
         switch_core_session_t *session;
         switch_channel_t *channel;
         switch_frame_t read_frame;
<span style="color: #000080; font-weight: bold">diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c</span>
<span style="color: #000080; font-weight: bold">index a0b7fca..b2185a2 100644</span>
<span style="color: #A00000">--- a/src/mod/endpoints/mod_sofia/sofia_glue.c</span>
<span style="color: #00A000">+++ b/src/mod/endpoints/mod_sofia/sofia_glue.c</span>
<span style="color: #800080; font-weight: bold">@@ -3234,6 +3234,11 @@ switch_status_t sofia_glue_activate_rtp(private_object_t *tech_pvt, switch_rtp_f</span>
                         switch_rtp_set_telephony_recv_event(tech_pvt-&gt;rtp_session, tech_pvt-&gt;recv_te);
                 }
 
<span style="color: #00A000">+                if (tech_pvt-&gt;audio_recv_pt != tech_pvt-&gt;agreed_pt) {</span>
<span style="color: #00A000">+                        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt-&gt;session), SWITCH_LOG_CRIT, &quot;Set audio receive payload to %u\n&quot;, tech_pvt-&gt;audio_recv_pt);</span>
<span style="color: #00A000">+                        switch_rtp_set_recv_pt(tech_pvt-&gt;rtp_session, tech_pvt-&gt;audio_recv_pt);</span>
<span style="color: #00A000">+                }</span>
<span style="color: #00A000">+</span>
                 if (sofia_test_pflag(tech_pvt-&gt;profile, PFLAG_SUPPRESS_CNG) ||
                         ((val = switch_channel_get_variable(tech_pvt-&gt;channel, &quot;supress_cng&quot;)) &amp;&amp; switch_true(val)) ||
                         ((val = switch_channel_get_variable(tech_pvt-&gt;channel, &quot;suppress_cng&quot;)) &amp;&amp; switch_true(val))) {
<span style="color: #800080; font-weight: bold">@@ -3307,7 +3312,7 @@ switch_status_t sofia_glue_activate_rtp(private_object_t *tech_pvt, switch_rtp_f</span>
                                 if ((rport = switch_channel_get_variable(tech_pvt-&gt;channel, &quot;sip_remote_video_rtcp_port&quot;))) {
                                         remote_rtcp_port = (switch_port_t)atoi(rport);
                                 }
<span style="color: #A00000">-</span>
<span style="color: #00A000">+                                </span>
                                 if (switch_rtp_set_remote_address
                                         (tech_pvt-&gt;video_rtp_session, tech_pvt-&gt;remote_sdp_video_ip, tech_pvt-&gt;remote_sdp_video_port, remote_rtcp_port, SWITCH_TRUE,
                                          &amp;err) != SWITCH_STATUS_SUCCESS) {
<span style="color: #800080; font-weight: bold">@@ -3412,6 +3417,13 @@ switch_status_t sofia_glue_activate_rtp(private_object_t *tech_pvt, switch_rtp_f</span>
                                         switch_rtp_set_ssrc(tech_pvt-&gt;video_rtp_session, ssrc_ul);
                                 }
 
<span style="color: #00A000">+</span>
<span style="color: #00A000">+                                if (tech_pvt-&gt;video_recv_pt != tech_pvt-&gt;video_agreed_pt) {</span>
<span style="color: #00A000">+                                        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt-&gt;session), SWITCH_LOG_DEBUG, </span>
<span style="color: #00A000">+                                                                          &quot;Set video receive payload to %u\n&quot;, tech_pvt-&gt;video_recv_pt);</span>
<span style="color: #00A000">+                                        switch_rtp_set_recv_pt(tech_pvt-&gt;rtp_session, tech_pvt-&gt;video_recv_pt);</span>
<span style="color: #00A000">+                                }</span>
<span style="color: #00A000">+</span>
                                 switch_channel_set_variable_printf(tech_pvt-&gt;channel, &quot;sip_use_video_pt&quot;, &quot;%d&quot;, tech_pvt-&gt;video_agreed_pt);
                                 tech_pvt-&gt;video_ssrc = switch_rtp_get_ssrc(tech_pvt-&gt;rtp_session);
                                 switch_channel_set_variable_printf(tech_pvt-&gt;channel, &quot;rtp_use_video_ssrc&quot;, &quot;%u&quot;, tech_pvt-&gt;ssrc);
<span style="color: #800080; font-weight: bold">@@ -4038,6 +4050,24 @@ switch_t38_options_t *sofia_glue_extract_t38_options(switch_core_session_t *sess</span>
 
 }
 
<span style="color: #00A000">+switch_status_t sofia_glue_get_offered_pt(private_object_t *tech_pvt, const switch_codec_implementation_t *mimp, switch_payload_t *pt)</span>
<span style="color: #00A000">+{</span>
<span style="color: #00A000">+        int i = 0;</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        for (i = 0; i &lt; tech_pvt-&gt;num_codecs; i++) {</span>
<span style="color: #00A000">+                const switch_codec_implementation_t *imp = tech_pvt-&gt;codecs[i];</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+                if (!strcasecmp(imp-&gt;iananame, mimp-&gt;iananame)) {</span>
<span style="color: #00A000">+                        *pt = tech_pvt-&gt;ianacodes[i];</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+                        return SWITCH_STATUS_SUCCESS;</span>
<span style="color: #00A000">+                }</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+        return SWITCH_STATUS_FALSE;</span>
<span style="color: #00A000">+}</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+</span>
 uint8_t sofia_glue_negotiate_sdp(switch_core_session_t *session, const char *r_sdp)
 {
         uint8_t match = 0;
<span style="color: #800080; font-weight: bold">@@ -4554,9 +4584,17 @@ uint8_t sofia_glue_negotiate_sdp(switch_core_session_t *session, const char *r_s</span>
                                         switch_snprintf(tmp, sizeof(tmp), &quot;%d&quot;, tech_pvt-&gt;remote_sdp_audio_port);
                                         switch_channel_set_variable(tech_pvt-&gt;channel, SWITCH_REMOTE_MEDIA_IP_VARIABLE, tech_pvt-&gt;remote_sdp_audio_ip);
                                         switch_channel_set_variable(tech_pvt-&gt;channel, SWITCH_REMOTE_MEDIA_PORT_VARIABLE, tmp);
<span style="color: #A00000">-</span>
<span style="color: #00A000">+                                        tech_pvt-&gt;audio_recv_pt = map-&gt;rm_pt;</span>
<span style="color: #00A000">+                                        </span>
<span style="color: #00A000">+                                        if (switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_OUTBOUND) {</span>
<span style="color: #00A000">+                                                sofia_glue_get_offered_pt(tech_pvt, mimp, &amp;tech_pvt-&gt;audio_recv_pt);</span>
<span style="color: #00A000">+                                        }</span>
<span style="color: #00A000">+                                        </span>
<span style="color: #00A000">+                                        switch_snprintf(tmp, sizeof(tmp), &quot;%d&quot;, tech_pvt-&gt;audio_recv_pt);</span>
<span style="color: #00A000">+                                        switch_channel_set_variable(tech_pvt-&gt;channel, &quot;sip_audio_recv_pt&quot;, tmp);</span>
<span style="color: #00A000">+                                        </span>
                                 }
<span style="color: #A00000">-</span>
<span style="color: #00A000">+                                </span>
                                 if (match) {
                                         if (sofia_glue_tech_set_codec(tech_pvt, 1) == SWITCH_STATUS_SUCCESS) {
                                                 got_audio = 1;
<span style="color: #800080; font-weight: bold">@@ -4583,7 +4621,7 @@ uint8_t sofia_glue_negotiate_sdp(switch_core_session_t *session, const char *r_s</span>
                                 }
                         }
 
<span style="color: #A00000">-</span>
<span style="color: #00A000">+                        </span>
                         if (!match &amp;&amp; greedy &amp;&amp; mine &lt; tech_pvt-&gt;num_codecs) {
                                 mine++;
                                 skip = 0;
<span style="color: #800080; font-weight: bold">@@ -4665,6 +4703,16 @@ uint8_t sofia_glue_negotiate_sdp(switch_core_session_t *session, const char *r_s</span>
                                                 switch_snprintf(tmp, sizeof(tmp), &quot;%d&quot;, tech_pvt-&gt;video_agreed_pt);
                                                 switch_channel_set_variable(tech_pvt-&gt;channel, &quot;sip_video_pt&quot;, tmp);
                                                 sofia_glue_check_video_codecs(tech_pvt);
<span style="color: #00A000">+</span>
<span style="color: #00A000">+                                                tech_pvt-&gt;video_recv_pt = map-&gt;rm_pt;</span>
<span style="color: #00A000">+                                                </span>
<span style="color: #00A000">+                                                if (switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_OUTBOUND) {</span>
<span style="color: #00A000">+                                                        sofia_glue_get_offered_pt(tech_pvt, mimp, &amp;tech_pvt-&gt;video_recv_pt);</span>
<span style="color: #00A000">+                                                }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+                                                switch_snprintf(tmp, sizeof(tmp), &quot;%d&quot;, tech_pvt-&gt;video_recv_pt);</span>
<span style="color: #00A000">+                                                switch_channel_set_variable(tech_pvt-&gt;channel, &quot;sip_video_recv_pt&quot;, tmp);</span>
<span style="color: #00A000">+                                                </span>
                                                 break;
                                         } else {
                                                 vmatch = 0;
<span style="color: #800080; font-weight: bold">@@ -5164,7 +5212,7 @@ static int recover_callback(void *pArg, int argc, char **argv, char **columnName</span>
                         if ((tmp = switch_channel_get_variable(channel, &quot;sip_use_pt&quot;))) {
                                 tech_pvt-&gt;pt = tech_pvt-&gt;agreed_pt = (switch_payload_t)atoi(tmp);
                         }
<span style="color: #A00000">-</span>
<span style="color: #00A000">+                        </span>
                         sofia_glue_tech_set_codec(tech_pvt, 1);
 
                         tech_pvt-&gt;adv_sdp_audio_ip = tech_pvt-&gt;extrtpip = (char *) ip;
<span style="color: #800080; font-weight: bold">@@ -5219,6 +5267,19 @@ static int recover_callback(void *pArg, int argc, char **argv, char **columnName</span>
                                 switch_xml_free(xml);
                                 return 0;
                         }
<span style="color: #00A000">+                        </span>
<span style="color: #00A000">+                        if (switch_rtp_ready(tech_pvt-&gt;rtp_session)) {</span>
<span style="color: #00A000">+                                if ((tmp = switch_channel_get_variable(channel, &quot;sip_audio_recv_pt&quot;))) {</span>
<span style="color: #00A000">+                                        switch_rtp_set_recv_pt(tech_pvt-&gt;rtp_session, atoi(tmp));</span>
<span style="color: #00A000">+                                }</span>
<span style="color: #00A000">+                        }</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+                        if (switch_rtp_ready(tech_pvt-&gt;video_rtp_session)) {</span>
<span style="color: #00A000">+                                if ((tmp = switch_channel_get_variable(channel, &quot;sip_video_recv_pt&quot;))) {</span>
<span style="color: #00A000">+                                        switch_rtp_set_recv_pt(tech_pvt-&gt;rtp_session, atoi(tmp));</span>
<span style="color: #00A000">+                                }</span>
<span style="color: #00A000">+                        }</span>
<span style="color: #00A000">+</span>
                 }
 
                 if (switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE)) {
<span style="color: #000080; font-weight: bold">diff --git a/src/switch_rtp.c b/src/switch_rtp.c</span>
<span style="color: #000080; font-weight: bold">index faa79e3..ffc41a7 100644</span>
<span style="color: #A00000">--- a/src/switch_rtp.c</span>
<span style="color: #00A000">+++ b/src/switch_rtp.c</span>
<span style="color: #800080; font-weight: bold">@@ -1578,7 +1578,7 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_create(switch_rtp_t **new_rtp_session</span>
         rtp_session-&gt;recv_msg.header.cc = 0;
 
         rtp_session-&gt;payload = payload;
<span style="color: #A00000">-</span>
<span style="color: #00A000">+        rtp_session-&gt;rpayload = payload;</span>
 
         rtp_session-&gt;rtcp_send_msg.header.version = 2;
         rtp_session-&gt;rtcp_send_msg.header.p = 0;
<span style="color: #800080; font-weight: bold">@@ -1773,6 +1773,12 @@ SWITCH_DECLARE(void) switch_rtp_set_telephony_recv_event(switch_rtp_t *rtp_sessi</span>
         }
 }
 
<span style="color: #00A000">+SWITCH_DECLARE(void) switch_rtp_set_recv_pt(switch_rtp_t *rtp_session, switch_payload_t pt)</span>
<span style="color: #00A000">+{</span>
<span style="color: #00A000">+        rtp_session-&gt;rpayload = pt;</span>
<span style="color: #00A000">+}</span>
<span style="color: #00A000">+</span>
<span style="color: #00A000">+</span>
 SWITCH_DECLARE(void) switch_rtp_set_cng_pt(switch_rtp_t *rtp_session, switch_payload_t pt)
 {
         rtp_session-&gt;cng_pt = pt;
<span style="color: #800080; font-weight: bold">@@ -2813,7 +2819,7 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_</span>
                         rtp_session-&gt;recv_msg.header.pt != 13 &amp;&amp; 
                         rtp_session-&gt;recv_msg.header.pt != rtp_session-&gt;recv_te &amp;&amp; 
                         (!rtp_session-&gt;cng_pt || rtp_session-&gt;recv_msg.header.pt != rtp_session-&gt;cng_pt) &amp;&amp; 
<span style="color: #A00000">-                        rtp_session-&gt;recv_msg.header.pt != rtp_session-&gt;payload) {</span>
<span style="color: #00A000">+                        rtp_session-&gt;recv_msg.header.pt != rtp_session-&gt;rpayload) {</span>
                         /* drop frames of incorrect payload number and return CNG frame instead */
                         return_cng_frame();
                 }
<span style="color: #800080; font-weight: bold">@@ -3131,8 +3137,6 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_</span>
                         rtp_session-&gt;recv_msg.header.pt = 97;
                 }
 
<span style="color: #A00000">-                rtp_session-&gt;rpayload = (switch_payload_t) rtp_session-&gt;recv_msg.header.pt;</span>
<span style="color: #A00000">-</span>
                 break;
 
         do_continue:
</pre></div>
========================================================================<pre>

Summary of changes:
 src/include/switch_rtp.h                 |    2 +
 src/mod/endpoints/mod_sofia/mod_sofia.h  |    2 +
 src/mod/endpoints/mod_sofia/sofia_glue.c |   71 +++++++++++++++++++++++++++--
 src/switch_rtp.c                         |   12 +++--
 4 files changed, 78 insertions(+), 9 deletions(-)
</pre>
<p>this email was generated because of /git/your-repo.git/hooks/post-receive by the file /git-core/contrib/hooks/post-receive-email<br />
For more info, see <a href="http://blog.chomperstomp.com/?p=630">http://blog.chomperstomp.com/?p=630</a>
-- <br />
FreeSWITCH Source</p>