<p>Friendly Automation <strong>submitted</strong> this change.</p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/14809">View Change</a></p><div style="white-space:pre-wrap">Approvals:
  Joshua Colp: Looks good to me, but someone else must approve
  George Joseph: Looks good to me, approved
  Friendly Automation: Approved for Submit

</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">chan_pjsip: disallow PJSIP_SEND_SESSION_REFRESH pre-answer execution<br><br>This patch makes it so if the PJSIP_SEND_SESSION_REFRESH dialplan function<br>is called on a channel prior to answering a warning is issued and the<br>function returns unsuccessful.<br><br>ASTERISK-28878 #close<br><br>Change-Id: I053f767d10cf3b2b898fa9e3e7c35ff07e23c9bb<br>---<br>M channels/pjsip/dialplan_functions.c<br>A doc/CHANGES-staging/pjsip_send_session_refresh.txt<br>2 files changed, 9 insertions(+), 0 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/channels/pjsip/dialplan_functions.c b/channels/pjsip/dialplan_functions.c</span><br><span>index 721f47f..176bc49 100644</span><br><span>--- a/channels/pjsip/dialplan_functions.c</span><br><span>+++ b/channels/pjsip/dialplan_functions.c</span><br><span>@@ -1680,6 +1680,11 @@</span><br><span>            return -1;</span><br><span>   }</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+ if (ast_channel_state(chan) != AST_STATE_UP) {</span><br><span style="color: hsl(120, 100%, 40%);">+                ast_log(LOG_WARNING, "'%s' not allowed on unanswered channel '%s'.\n", cmd, ast_channel_name(chan));</span><br><span style="color: hsl(120, 100%, 40%);">+                return -1;</span><br><span style="color: hsl(120, 100%, 40%);">+    }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span>  if (strcmp(ast_channel_tech(chan)->type, "PJSIP")) {</span><br><span>            ast_log(LOG_WARNING, "Cannot call %s on a non-PJSIP channel\n", cmd);</span><br><span>              return -1;</span><br><span>diff --git a/doc/CHANGES-staging/pjsip_send_session_refresh.txt b/doc/CHANGES-staging/pjsip_send_session_refresh.txt</span><br><span>new file mode 100644</span><br><span>index 0000000..0705c29</span><br><span>--- /dev/null</span><br><span>+++ b/doc/CHANGES-staging/pjsip_send_session_refresh.txt</span><br><span>@@ -0,0 +1,4 @@</span><br><span style="color: hsl(120, 100%, 40%);">+Subject: chan_pjsip</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+The PJSIP_SEND_SESSION_REFRESH dialplan function now issues a warning, and</span><br><span style="color: hsl(120, 100%, 40%);">+returns unsuccessful if it's used on a channel prior to answering.</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/14809">change 14809</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/+/14809"/><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: I053f767d10cf3b2b898fa9e3e7c35ff07e23c9bb </div>
<div style="display:none"> Gerrit-Change-Number: 14809 </div>
<div style="display:none"> Gerrit-PatchSet: 3 </div>
<div style="display:none"> Gerrit-Owner: Kevin Harwell <kharwell@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Friendly Automation </div>
<div style="display:none"> Gerrit-Reviewer: George Joseph <gjoseph@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Joshua Colp <jcolp@sangoma.com> </div>
<div style="display:none"> Gerrit-MessageType: merged </div>