<p> Attention is currently required from: N A. </p>
<p><a href="https://gerrit.asterisk.org/c/asterisk/+/15893">View Change</a></p><p>1 comment:</p><ul style="list-style: none; padding: 0;"><li style="margin: 0; padding: 0;"><p><a href="null">Patchset:</a></p><ul style="list-style: none; padding: 0;"><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.asterisk.org/c/asterisk/+/15893?tab=comments">Patch Set #7:</a> </p><p style="white-space: pre-wrap; word-wrap: break-word;">This function has been needed for a very long time.</p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">Here's one of, and the main good reason to push this:<br>The AMI Setvar uses identical flow:<br> - Get Channel By Name<br> - Set Variable</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><br>static int action_setvar(struct mansession *s, const struct message *m)<br>{<br> struct ast_channel *c = NULL;<br> const char *name = astman_get_header(m, "Channel");<br> const char *varname = astman_get_header(m, "Variable");<br> const char *varval = astman_get_header(m, "Value");<br> int res = 0;</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"> if (ast_strlen_zero(varname)) {<br> astman_send_error(s, m, "No variable specified");<br> return 0;<br> }</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"> if (!ast_strlen_zero(name)) {<br> if (!(c = ast_channel_get_by_name(name))) {<br> astman_send_error(s, m, "No such channel");<br> return 0;<br> }<br> }</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"> res = pbx_builtin_setvar_helper(c, varname, S_OR(varval, ""));</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"> if (c) {<br> c = ast_channel_unref(c);<br> }<br> if (res == 0) {<br> astman_send_ack(s, m, "Variable Set");<br> } else {<br> astman_send_error(s, m, "Variable not set");<br> }<br> return 0;<br>}</pre><p style="white-space: pre-wrap; word-wrap: break-word;">There is nothing preventing a system interacting with AMI from setting a variable on an arbitrary channel. What's the main reason for not allowing dialplan to do the same?</p><p style="white-space: pre-wrap; word-wrap: break-word;">Back in ~2007 I wrote EXTERNAL() and pushed it up for review and got feedback that this might lead to deadlocks. We've been using EXTERNAL() which is just about identical to the review here since that timeframe across many Asterisk versions and workloads and not once triggered a deadlock related to setting a variable on a channel we don't "own" either via Set(EXTERNAL(<channel>,<var>)=...) or AMI Setvar.</p><p style="white-space: pre-wrap; word-wrap: break-word;">I've reviewed the code here and it is indeed in the exact same (safe) flow as action_setvar.</p></li></ul></li></ul><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/15893">change 15893</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/+/15893"/><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: I7492645ae4307553d0f586d78e13a4f586231fdf </div>
<div style="display:none"> Gerrit-Change-Number: 15893 </div>
<div style="display:none"> Gerrit-PatchSet: 7 </div>
<div style="display:none"> Gerrit-Owner: N A <mail@interlinked.x10host.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: Kevin Harwell <kharwell@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Mark Murawski <markm@intellasoft.net> </div>
<div style="display:none"> Gerrit-Reviewer: Richard Mudgett <rmudgett@digium.com> </div>
<div style="display:none"> Gerrit-Attention: N A <mail@interlinked.x10host.com> </div>
<div style="display:none"> Gerrit-Comment-Date: Thu, 10 Feb 2022 00:32:39 +0000 </div>
<div style="display:none"> Gerrit-HasComments: Yes </div>
<div style="display:none"> Gerrit-Has-Labels: No </div>
<div style="display:none"> Gerrit-MessageType: comment </div>