<p>Joshua Colp <strong>merged</strong> this change.</p><p><a href="https://gerrit.asterisk.org/6573">View Change</a></p><div style="white-space:pre-wrap">Approvals:
  Benjamin Keith Ford: Looks good to me, but someone else must approve
  Joshua Colp: Looks good to me, approved; Approved for Submit

</div><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 audio codecs configured on the endpoint always<br>get sent, and not just a subset. However priority is given to those codecs that<br>are compatible with the "other side".<br><br>ASTERISK-27259 #close<br><br>Change-Id: Iffabc373bd94cd1dc700925dcfe406e12918c696<br>---<br>M res/res_pjsip_session.c<br>1 file changed, 10 insertions(+), 0 deletions(-)<br><br></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 76dafb3..8b0ca2f 100644<br>--- a/res/res_pjsip_session.c<br>+++ b/res/res_pjsip_session.c<br>@@ -2459,6 +2459,16 @@<br>                             continue;<br>                     }<br> <br>+                 if (ast_stream_get_type(req_stream) == AST_MEDIA_TYPE_AUDIO) {<br>+                               /*<br>+                            * By appending codecs from the endpoint after compatible ones this<br>+                           * guarantees that priority is given to those while also allowing<br>+                             * translation to occur for non-compatible.<br>+                           */<br>+                          ast_format_cap_append_from_cap(joint_cap,<br>+                                    endpoint->media.codecs, AST_MEDIA_TYPE_AUDIO);<br>+                    }<br>+<br>                  ast_stream_set_formats(clone_stream, joint_cap);<br>                      ao2_ref(joint_cap, -1);<br> <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: merged </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: 2 </div>
<div style="display:none"> Gerrit-Owner: Kevin Harwell <kharwell@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Benjamin Keith Ford <bford@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins2 </div>
<div style="display:none"> Gerrit-Reviewer: Joshua Colp <jcolp@digium.com> </div>