<p>Friendly Automation <strong>submitted</strong> this change.</p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/16183">View Change</a></p><div style="white-space:pre-wrap">Approvals:
  Friendly Automation: Looks good to me, approved; Approved for Submit

</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">AST-2021-007 - res_pjsip_session: Don't offer if no channel exists.<br><br>If a re-INVITE is received after we have sent a BYE request then it<br>is possible for no channel to be present on the session. If this<br>occurs we allow PJSIP to produce the offer instead. Since the call<br>is being hung up if it produces an incorrect offer it doesn't<br>actually matter. This also ensures that code which produces SDP<br>does not need to handle if a channel is not present.<br><br>ASTERISK-29381<br><br>Change-Id: I673cb88c432f38f69b2e0851d55cc57a62236042<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;"><span>diff --git a/res/res_pjsip_session.c b/res/res_pjsip_session.c</span><br><span>index 3f61b63..b1288b5 100644</span><br><span>--- a/res/res_pjsip_session.c</span><br><span>+++ b/res/res_pjsip_session.c</span><br><span>@@ -5263,6 +5263,16 @@</span><br><span>        pjmedia_sdp_session *offer;</span><br><span>  int i;</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+    /* We allow PJSIP to produce an SDP if no channel is present. This may result</span><br><span style="color: hsl(120, 100%, 40%);">+  * in an incorrect SDP occurring, but if no channel is present then we are in</span><br><span style="color: hsl(120, 100%, 40%);">+  * the midst of a BYE and are hanging up. This ensures that all the code to</span><br><span style="color: hsl(120, 100%, 40%);">+    * produce an SDP doesn't need to worry about a channel being present or not,</span><br><span style="color: hsl(120, 100%, 40%);">+      * just in case.</span><br><span style="color: hsl(120, 100%, 40%);">+       */</span><br><span style="color: hsl(120, 100%, 40%);">+   if (!session->channel) {</span><br><span style="color: hsl(120, 100%, 40%);">+           return;</span><br><span style="color: hsl(120, 100%, 40%);">+       }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span>  if (inv->neg) {</span><br><span>           if (pjmedia_sdp_neg_was_answer_remote(inv->neg)) {</span><br><span>                        pjmedia_sdp_neg_get_active_remote(inv->neg, &previous_sdp);</span><br><span></span><br></pre><div style="white-space:pre-wrap"></div><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/16183">change 16183</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/+/16183"/><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-Change-Id: I673cb88c432f38f69b2e0851d55cc57a62236042 </div>
<div style="display:none"> Gerrit-Change-Number: 16183 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Friendly Automation </div>
<div style="display:none"> Gerrit-Reviewer: Friendly Automation </div>
<div style="display:none"> Gerrit-CC: Joshua Colp <jcolp@sangoma.com> </div>
<div style="display:none"> Gerrit-MessageType: merged </div>