<p>Jean Aunis - Prescom has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/8208">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">chan_sip : Fix improper RTP framing on outgoing calls<br><br>The "ptime" SDP parameter received in a SIP response was not honoured.<br>Moreover, in the abscence of this "ptime" parameter, locally configured framing<br>was lost during response processing.<br>This patch systematically stores the framing information in the ast_rtp_codecs<br>structure, taking it from the response or from the configuration as appropriate.<br><br>ASTERISK-27674<br><br>Change-Id: I828a6a98d27a45a8afd07236a2bd0aa3cbd3fb2c<br>---<br>M channels/chan_sip.c<br>1 file changed, 9 insertions(+), 5 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/08/8208/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/channels/chan_sip.c b/channels/chan_sip.c<br>index 6bd8205..832f66b 100644<br>--- a/channels/chan_sip.c<br>+++ b/channels/chan_sip.c<br>@@ -10917,22 +10917,26 @@<br>   if (portno != -1 || vportno != -1 || tportno != -1) {<br>                 /* We are now ready to change the sip session and RTP structures with the offered codecs, since<br>                  they are acceptable */<br>+            unsigned int framing;<br>                 ast_format_cap_remove_by_type(p->jointcaps, AST_MEDIA_TYPE_UNKNOWN);<br>               ast_format_cap_append_from_cap(p->jointcaps, newjointcapability, AST_MEDIA_TYPE_UNKNOWN); /* Our joint codec profile for this call */<br>              ast_format_cap_remove_by_type(p->peercaps, AST_MEDIA_TYPE_UNKNOWN);<br>                ast_format_cap_append_from_cap(p->peercaps, newpeercapability, AST_MEDIA_TYPE_UNKNOWN); /* The other side's capability in latest offer */<br>              p->jointnoncodeccapability = newnoncodeccapability;     /* DTMF capabilities */<br> <br>+                tmp_fmt = ast_format_cap_get_format(p->jointcaps, 0);<br>+             framing = ast_format_cap_get_format_framing(p->jointcaps, tmp_fmt);<br>                /* respond with single most preferred joint codec, limiting the other side's choice */<br>            if (ast_test_flag(&p->flags[1], SIP_PAGE2_PREFERRED_CODEC)) {<br>-                 unsigned int framing;<br>-<br>-                     tmp_fmt = ast_format_cap_get_format(p->jointcaps, 0);<br>-                     framing = ast_format_cap_get_format_framing(p->jointcaps, tmp_fmt);<br>                        ast_format_cap_remove_by_type(p->jointcaps, AST_MEDIA_TYPE_UNKNOWN);<br>                       ast_format_cap_append(p->jointcaps, tmp_fmt, framing);<br>+            }<br>+            if(!ast_rtp_codecs_get_framing(&newaudiortp)) {<br>+                  /* Peer did not force us to use a specific framing, so use our own */<br>+                        ast_rtp_codecs_set_framing(&newaudiortp, framing);<br>                        ao2_ref(tmp_fmt, -1);<br>                 }<br>+            ao2_ref(tmp_fmt, -1);<br>         }<br> <br>  /* Setup audio address and port */<br>@@ -11127,7 +11131,6 @@<br>                   ao2_ref(caps, -1);<br>                    ao2_ref(tmp_fmt, -1);<br>                 }<br>-<br>          ast_set_read_format(p->owner, ast_channel_readformat(p->owner));<br>                ast_set_write_format(p->owner, ast_channel_writeformat(p->owner));<br>      }<br>@@ -11441,6 +11444,7 @@<br>            if (framing && p->autoframing) {<br>                   ast_debug(1, "Setting framing to %ld\n", framing);<br>                  ast_format_cap_set_framing(p->caps, framing);<br>+                     ast_rtp_codecs_set_framing(newaudiortp, framing);<br>             }<br>             found = TRUE;<br>         } else if (sscanf(a, "rtpmap: %30u %127[^/]/%30u", &codec, mimeSubtype, &sample_rate) == 3) {<br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/8208">change 8208</a>. To unsubscribe, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/8208"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 15 </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: I828a6a98d27a45a8afd07236a2bd0aa3cbd3fb2c </div>
<div style="display:none"> Gerrit-Change-Number: 8208 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Jean Aunis - Prescom <jean.aunis@prescom.fr> </div>