<p>Kevin Harwell has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/6573">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">res_pjsip_session: outgoing call did not offer all configured codecs<br><br>For some scenarios when an outgoing call was made only a subset of the<br>configured codecs were offered. If the codecs being offered happened to<br>not have a codec supported by the phone then the call would fail.<br><br>For instance Alice and Bob both are configured in Asterisk for g722 and ulaw(<br>allow=!all,g722,ulaw). Alice's endpoint however only supports g722 while Bob's<br>only supports ulaw. When Alice calls Bob, Alice negotiates g722 fine with<br>Asterisk. But when Asterisk sends the outgoing offer to Bob it only contains<br>g722 and not both g722 and ulaw, so the call ends.<br><br>This patch makes it so all the codecs configured on the endpoint always get sent<br>and not just a subset.<br><br>ASTERISK-27259 #close<br><br>Change-Id: Iffabc373bd94cd1dc700925dcfe406e12918c696<br>---<br>M res/res_pjsip_session.c<br>1 file changed, 10 insertions(+), 11 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/73/6573/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/res/res_pjsip_session.c b/res/res_pjsip_session.c<br>index 2beb6dc..f17c9c1 100644<br>--- a/res/res_pjsip_session.c<br>+++ b/res/res_pjsip_session.c<br>@@ -2431,7 +2431,6 @@<br>                 for (i = 0; i < ast_stream_topology_get_count(req_topology); ++i) {<br>                        struct ast_stream *req_stream;<br>                        struct ast_format_cap *req_cap;<br>-                      struct ast_format_cap *joint_cap;<br>                     struct ast_stream *clone_stream;<br> <br>                   req_stream = ast_stream_topology_get_stream(req_topology, i);<br>@@ -2440,27 +2439,27 @@<br>                                continue;<br>                     }<br> <br>-                 req_cap = ast_stream_get_formats(req_stream);<br>-<br>-                     joint_cap = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_DEFAULT);<br>-                       if (!joint_cap) {<br>+                    req_cap = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_DEFAULT);<br>+                 if (!req_cap) {<br>                               continue;<br>                     }<br> <br>-                 ast_format_cap_get_compatible(req_cap, endpoint->media.codecs, joint_cap);<br>-                        if (!ast_format_cap_count(joint_cap)) {<br>-                              ao2_ref(joint_cap, -1);<br>+                      ast_format_cap_append_from_cap(req_cap,<br>+                              endpoint->media.codecs, AST_MEDIA_TYPE_UNKNOWN);<br>+<br>+                       if (!ast_format_cap_count(req_cap)) {<br>+                                ao2_ref(req_cap, -1);<br>                                 continue;<br>                     }<br> <br>                  clone_stream = ast_stream_clone(req_stream, NULL);<br>                    if (!clone_stream) {<br>-                         ao2_ref(joint_cap, -1);<br>+                              ao2_ref(req_cap, -1);<br>                                 continue;<br>                     }<br> <br>-                 ast_stream_set_formats(clone_stream, joint_cap);<br>-                     ao2_ref(joint_cap, -1);<br>+                      ast_stream_set_formats(clone_stream, req_cap);<br>+                       ao2_ref(req_cap, -1);<br> <br>                      if (!session->pending_media_state->topology) {<br>                          session->pending_media_state->topology = ast_stream_topology_alloc();<br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/6573">change 6573</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/6573"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: Iffabc373bd94cd1dc700925dcfe406e12918c696 </div>
<div style="display:none"> Gerrit-Change-Number: 6573 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Kevin Harwell <kharwell@digium.com> </div>