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

</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">pbx_builtins: Remove deprecated and defunct functionality.<br><br>This removes the ImportVar and SetAMAFlags applications<br>which have been deprecated since Asterisk 12, but were<br>never removed previously.<br><br>Additionally, it removes remnants of defunct options<br>that themselves were removed years ago.<br><br>ASTERISK-30335 #close<br><br>Change-Id: I749520c7b08d4c9d5eebbf640d4fbc81950eda8d<br>---<br>A doc/UPGRADE-staging/pbx_builtins.txt<br>M main/pbx_builtins.c<br>2 files changed, 25 insertions(+), 110 deletions(-)<br><br></pre>
<pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/doc/UPGRADE-staging/pbx_builtins.txt b/doc/UPGRADE-staging/pbx_builtins.txt</span><br><span>new file mode 100644</span><br><span>index 0000000..9aeb70c</span><br><span>--- /dev/null</span><br><span>+++ b/doc/UPGRADE-staging/pbx_builtins.txt</span><br><span>@@ -0,0 +1,5 @@</span><br><span style="color: hsl(120, 100%, 40%);">+Subject: pbx_builtins</span><br><span style="color: hsl(120, 100%, 40%);">+Master-Only: True</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+The previously deprecated ImportVar and SetAMAFlags</span><br><span style="color: hsl(120, 100%, 40%);">+applications have now been removed.</span><br><span>diff --git a/main/pbx_builtins.c b/main/pbx_builtins.c</span><br><span>index fa6e63d..8611cc5 100644</span><br><span>--- a/main/pbx_builtins.c</span><br><span>+++ b/main/pbx_builtins.c</span><br><span>@@ -310,28 +310,6 @@</span><br><span>                      <ref type="function">TESTTIME</ref></span><br><span>            </see-also></span><br><span>    </application></span><br><span style="color: hsl(0, 100%, 40%);">-    <application name="ImportVar" language="en_US"></span><br><span style="color: hsl(0, 100%, 40%);">-               <synopsis></span><br><span style="color: hsl(0, 100%, 40%);">-                        Import a variable from a channel into a new variable.</span><br><span style="color: hsl(0, 100%, 40%);">-           </synopsis></span><br><span style="color: hsl(0, 100%, 40%);">-               <syntax argsep="="></span><br><span style="color: hsl(0, 100%, 40%);">-                     <parameter name="newvar" required="true" /></span><br><span style="color: hsl(0, 100%, 40%);">-                   <parameter name="vardata" required="true"></span><br><span style="color: hsl(0, 100%, 40%);">-                            <argument name="channelname" required="true" /></span><br><span style="color: hsl(0, 100%, 40%);">-                               <argument name="variable" required="true" /></span><br><span style="color: hsl(0, 100%, 40%);">-                  </parameter></span><br><span style="color: hsl(0, 100%, 40%);">-              </syntax></span><br><span style="color: hsl(0, 100%, 40%);">-         <description></span><br><span style="color: hsl(0, 100%, 40%);">-                     <para>This application imports a <replaceable>variable</replaceable> from the specified</span><br><span style="color: hsl(0, 100%, 40%);">-                       <replaceable>channel</replaceable> (as opposed to the current one) and stores it as a variable</span><br><span style="color: hsl(0, 100%, 40%);">-                      (<replaceable>newvar</replaceable>) in the current channel (the channel that is calling this</span><br><span style="color: hsl(0, 100%, 40%);">-                        application). Variables created by this application have the same inheritance properties as those</span><br><span style="color: hsl(0, 100%, 40%);">-                       created with the <literal>Set</literal> application.</para></span><br><span style="color: hsl(0, 100%, 40%);">-           </description></span><br><span style="color: hsl(0, 100%, 40%);">-            <see-also></span><br><span style="color: hsl(0, 100%, 40%);">-                        <ref type="application">Set</ref></span><br><span style="color: hsl(0, 100%, 40%);">-         </see-also></span><br><span style="color: hsl(0, 100%, 40%);">-       </application></span><br><span>         <application name="Hangup" language="en_US"></span><br><span>               <synopsis></span><br><span>                     Hang up the calling channel.</span><br><span>@@ -629,22 +607,6 @@</span><br><span>                  <ref type="function">SAYFILES</ref></span><br><span>            </see-also></span><br><span>    </application></span><br><span style="color: hsl(0, 100%, 40%);">-    <application name="SetAMAFlags" language="en_US"></span><br><span style="color: hsl(0, 100%, 40%);">-             <synopsis></span><br><span style="color: hsl(0, 100%, 40%);">-                        Set the AMA Flags.</span><br><span style="color: hsl(0, 100%, 40%);">-              </synopsis></span><br><span style="color: hsl(0, 100%, 40%);">-               <syntax></span><br><span style="color: hsl(0, 100%, 40%);">-                  <parameter name="flag" /></span><br><span style="color: hsl(0, 100%, 40%);">-               </syntax></span><br><span style="color: hsl(0, 100%, 40%);">-         <description></span><br><span style="color: hsl(0, 100%, 40%);">-                     <para>This application will set the channel's AMA Flags for billing purposes.</para></span><br><span style="color: hsl(0, 100%, 40%);">-                    <warning><para>This application is deprecated. Please use the CHANNEL function instead.</para></warning></span><br><span style="color: hsl(0, 100%, 40%);">-                </description></span><br><span style="color: hsl(0, 100%, 40%);">-            <see-also></span><br><span style="color: hsl(0, 100%, 40%);">-                        <ref type="function">CDR</ref></span><br><span style="color: hsl(0, 100%, 40%);">-                    <ref type="function">CHANNEL</ref></span><br><span style="color: hsl(0, 100%, 40%);">-                </see-also></span><br><span style="color: hsl(0, 100%, 40%);">-       </application></span><br><span>         <application name="Wait" language="en_US"></span><br><span>                 <synopsis></span><br><span>                     Waits for some time.</span><br><span>@@ -830,7 +792,7 @@</span><br><span>   char *parse;</span><br><span>         AST_DECLARE_APP_ARGS(args,</span><br><span>           AST_APP_ARG(delay);</span><br><span style="color: hsl(0, 100%, 40%);">-             AST_APP_ARG(answer_cdr);</span><br><span style="color: hsl(120, 100%, 40%);">+              AST_APP_ARG(options);</span><br><span>        );</span><br><span> </span><br><span>       if (ast_strlen_zero(data)) {</span><br><span>@@ -848,15 +810,10 @@</span><br><span>                 delay = 0;</span><br><span>   }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-   if (!ast_strlen_zero(args.answer_cdr) && !strcmp(args.answer_cdr, "i")) {</span><br><span style="color: hsl(0, 100%, 40%);">-             /*! \todo We will remove the nocdr stuff for 21 entirely, as part of another review. */</span><br><span style="color: hsl(120, 100%, 40%);">+       if (!ast_strlen_zero(args.options) && !strcmp(args.options, "i")) {</span><br><span>                return ast_raw_answer(chan);</span><br><span>         }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-   if (!ast_strlen_zero(args.answer_cdr) && !strcasecmp(args.answer_cdr, "nocdr")) {</span><br><span style="color: hsl(0, 100%, 40%);">-             ast_log(AST_LOG_WARNING, "The nocdr option for the Answer application has been removed and is no longer supported.\n");</span><br><span style="color: hsl(0, 100%, 40%);">-       }</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span>    return __ast_answer(chan, delay);</span><br><span> }</span><br><span> </span><br><span>@@ -885,34 +842,6 @@</span><br><span> /*!</span><br><span>  * \ingroup applications</span><br><span>  */</span><br><span style="color: hsl(0, 100%, 40%);">-static int pbx_builtin_setamaflags(struct ast_channel *chan, const char *data)</span><br><span style="color: hsl(0, 100%, 40%);">-{</span><br><span style="color: hsl(0, 100%, 40%);">-      ast_log(AST_LOG_WARNING, "The SetAMAFlags application is deprecated. Please use the CHANNEL function instead.\n");</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-    if (ast_strlen_zero(data)) {</span><br><span style="color: hsl(0, 100%, 40%);">-            ast_log(AST_LOG_WARNING, "No parameter passed to SetAMAFlags\n");</span><br><span style="color: hsl(0, 100%, 40%);">-             return 0;</span><br><span style="color: hsl(0, 100%, 40%);">-       }</span><br><span style="color: hsl(0, 100%, 40%);">-       /* Copy the AMA Flags as specified */</span><br><span style="color: hsl(0, 100%, 40%);">-   ast_channel_lock(chan);</span><br><span style="color: hsl(0, 100%, 40%);">- if (isdigit(data[0])) {</span><br><span style="color: hsl(0, 100%, 40%);">-         int amaflags;</span><br><span style="color: hsl(0, 100%, 40%);">-           if (sscanf(data, "%30d", &amaflags) != 1) {</span><br><span style="color: hsl(0, 100%, 40%);">-                       ast_log(AST_LOG_WARNING, "Unable to set AMA flags on channel %s\n", ast_channel_name(chan));</span><br><span style="color: hsl(0, 100%, 40%);">-                  ast_channel_unlock(chan);</span><br><span style="color: hsl(0, 100%, 40%);">-                       return 0;</span><br><span style="color: hsl(0, 100%, 40%);">-               }</span><br><span style="color: hsl(0, 100%, 40%);">-               ast_channel_amaflags_set(chan, amaflags);</span><br><span style="color: hsl(0, 100%, 40%);">-       } else {</span><br><span style="color: hsl(0, 100%, 40%);">-                ast_channel_amaflags_set(chan, ast_channel_string2amaflag(data));</span><br><span style="color: hsl(0, 100%, 40%);">-       }</span><br><span style="color: hsl(0, 100%, 40%);">-       ast_channel_unlock(chan);</span><br><span style="color: hsl(0, 100%, 40%);">-       return 0;</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%);">-/*!</span><br><span style="color: hsl(0, 100%, 40%);">- * \ingroup applications</span><br><span style="color: hsl(0, 100%, 40%);">- */</span><br><span> static int pbx_builtin_hangup(struct ast_channel *chan, const char *data)</span><br><span> {</span><br><span>   int cause;</span><br><span>@@ -1531,41 +1460,6 @@</span><br><span>  return res;</span><br><span> }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-static int pbx_builtin_importvar(struct ast_channel *chan, const char *data)</span><br><span style="color: hsl(0, 100%, 40%);">-{</span><br><span style="color: hsl(0, 100%, 40%);">-       char *name;</span><br><span style="color: hsl(0, 100%, 40%);">-     char *value;</span><br><span style="color: hsl(0, 100%, 40%);">-    char *channel;</span><br><span style="color: hsl(0, 100%, 40%);">-  char tmp[VAR_BUF_SIZE];</span><br><span style="color: hsl(0, 100%, 40%);">- static int deprecation_warning = 0;</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-     if (ast_strlen_zero(data)) {</span><br><span style="color: hsl(0, 100%, 40%);">-            ast_log(LOG_WARNING, "Ignoring, since there is no variable to set\n");</span><br><span style="color: hsl(0, 100%, 40%);">-                return 0;</span><br><span style="color: hsl(0, 100%, 40%);">-       }</span><br><span style="color: hsl(0, 100%, 40%);">-       tmp[0] = 0;</span><br><span style="color: hsl(0, 100%, 40%);">-     if (!deprecation_warning) {</span><br><span style="color: hsl(0, 100%, 40%);">-             ast_log(LOG_WARNING, "ImportVar is deprecated.  Please use Set(varname=${IMPORT(channel,variable)}) instead.\n");</span><br><span style="color: hsl(0, 100%, 40%);">-             deprecation_warning = 1;</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%);">-       value = ast_strdupa(data);</span><br><span style="color: hsl(0, 100%, 40%);">-      name = strsep(&value,"=");</span><br><span style="color: hsl(0, 100%, 40%);">-        channel = strsep(&value,",");</span><br><span style="color: hsl(0, 100%, 40%);">-     if (channel && value && name) { /*! \todo XXX should do !ast_strlen_zero(..) of the args ? */</span><br><span style="color: hsl(0, 100%, 40%);">-           struct ast_channel *chan2 = ast_channel_get_by_name(channel);</span><br><span style="color: hsl(0, 100%, 40%);">-           if (chan2) {</span><br><span style="color: hsl(0, 100%, 40%);">-                    char *s = ast_alloca(strlen(value) + 4);</span><br><span style="color: hsl(0, 100%, 40%);">-                        sprintf(s, "${%s}", value);</span><br><span style="color: hsl(0, 100%, 40%);">-                   pbx_substitute_variables_helper(chan2, s, tmp, sizeof(tmp) - 1);</span><br><span style="color: hsl(0, 100%, 40%);">-                        chan2 = ast_channel_unref(chan2);</span><br><span style="color: hsl(0, 100%, 40%);">-               }</span><br><span style="color: hsl(0, 100%, 40%);">-               pbx_builtin_setvar_helper(chan, name, tmp);</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%);">-       return(0);</span><br><span style="color: hsl(0, 100%, 40%);">-}</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span> /*! \brief Declaration of builtin applications */</span><br><span> struct pbx_builtin {</span><br><span>     char name[AST_MAX_APP];</span><br><span>@@ -1583,7 +1477,6 @@</span><br><span>      { "Goto",           pbx_builtin_goto },</span><br><span>    { "GotoIf",         pbx_builtin_gotoif },</span><br><span>  { "GotoIfTime",     pbx_builtin_gotoiftime },</span><br><span style="color: hsl(0, 100%, 40%);">- { "ImportVar",      pbx_builtin_importvar },</span><br><span>       { "Hangup",         pbx_builtin_hangup },</span><br><span>  { "Incomplete",     pbx_builtin_incomplete },</span><br><span>      { "NoOp",           pbx_builtin_noop },</span><br><span>@@ -1598,7 +1491,6 @@</span><br><span>    { "SayNumber",      pbx_builtin_saynumber },</span><br><span>       { "SayOrdinal",     pbx_builtin_sayordinal },</span><br><span>      { "SayPhonetic",    pbx_builtin_sayphonetic },</span><br><span style="color: hsl(0, 100%, 40%);">-        { "SetAMAFlags",    pbx_builtin_setamaflags },</span><br><span>     { "Wait",           pbx_builtin_wait },</span><br><span>    { "WaitDigit",      pbx_builtin_waitdigit },</span><br><span>       { "WaitExten",      pbx_builtin_waitexten }</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/19610">change 19610</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/+/19610"/><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: I749520c7b08d4c9d5eebbf640d4fbc81950eda8d </div>
<div style="display:none"> Gerrit-Change-Number: 19610 </div>
<div style="display:none"> Gerrit-PatchSet: 4 </div>
<div style="display:none"> Gerrit-Owner: N A <asterisk@phreaknet.org> </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>