<p>Joshua Colp has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/13958">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">res_pjsip_session: Apply intention behind requested formats.<br><br>When an outgoing channel is created a list of formats may<br>optionally be provided which is used as a request that the<br>formats be used if possible. If an endpoint is not configured<br>for any of the formats we ignore this request and use what is<br>configured. This has the side effect of also including other<br>stream types (such as video) that were not present in the<br>requested formats.<br><br>This change makes it so that the intention of the request is<br>preserved - that is if only an audio format is requested then<br>even if there is no joint audio format between the request and<br>the configuration we will still only place an audio stream in<br>the outgoing call.<br><br>ASTERISK-28787<br><br>Change-Id: Ia54c0c63e94aca176169b9bae4bb8a8380ea245f<br>---<br>M res/res_pjsip_session.c<br>1 file changed, 11 insertions(+), 10 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/58/13958/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/res/res_pjsip_session.c b/res/res_pjsip_session.c</span><br><span>index b9448b9..47d8ef6 100644</span><br><span>--- a/res/res_pjsip_session.c</span><br><span>+++ b/res/res_pjsip_session.c</span><br><span>@@ -2716,16 +2716,6 @@</span><br><span> }</span><br><span> </span><br><span> ast_format_cap_get_compatible(req_cap, endpoint->media.codecs, joint_cap);</span><br><span style="color: hsl(0, 100%, 40%);">- if (!ast_format_cap_count(joint_cap)) {</span><br><span style="color: hsl(0, 100%, 40%);">- ao2_ref(joint_cap, -1);</span><br><span style="color: hsl(0, 100%, 40%);">- continue;</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- clone_stream = ast_stream_clone(req_stream, NULL);</span><br><span style="color: hsl(0, 100%, 40%);">- if (!clone_stream) {</span><br><span style="color: hsl(0, 100%, 40%);">- ao2_ref(joint_cap, -1);</span><br><span style="color: hsl(0, 100%, 40%);">- continue;</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span> </span><br><span> if (ast_stream_get_type(req_stream) == AST_MEDIA_TYPE_AUDIO) {</span><br><span> /*</span><br><span>@@ -2737,6 +2727,17 @@</span><br><span> endpoint->media.codecs, AST_MEDIA_TYPE_AUDIO);</span><br><span> }</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+ if (!ast_format_cap_count(joint_cap)) {</span><br><span style="color: hsl(120, 100%, 40%);">+ ao2_ref(joint_cap, -1);</span><br><span style="color: hsl(120, 100%, 40%);">+ continue;</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ clone_stream = ast_stream_clone(req_stream, NULL);</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!clone_stream) {</span><br><span style="color: hsl(120, 100%, 40%);">+ ao2_ref(joint_cap, -1);</span><br><span style="color: hsl(120, 100%, 40%);">+ continue;</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> ast_stream_set_formats(clone_stream, joint_cap);</span><br><span> ao2_ref(joint_cap, -1);</span><br><span> </span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/13958">change 13958</a>. To unsubscribe, or for help writing mail filters, 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/c/asterisk/+/13958"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 16 </div>
<div style="display:none"> Gerrit-Change-Id: Ia54c0c63e94aca176169b9bae4bb8a8380ea245f </div>
<div style="display:none"> Gerrit-Change-Number: 13958 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Joshua Colp <jcolp@sangoma.com> </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>