Skip to content

Commit f86d2a2

Browse files
InterLinked1Friendly Automation
authored and
Friendly Automation
committed
pbx_builtins: Remove deprecated and defunct functionality.
This removes the ImportVar and SetAMAFlags applications which have been deprecated since Asterisk 12, but were never removed previously. Additionally, it removes remnants of defunct options that themselves were removed years ago. ASTERISK-30335 #close Change-Id: I749520c7b08d4c9d5eebbf640d4fbc81950eda8d
1 parent 1adefb8 commit f86d2a2

File tree

2 files changed

+7
-110
lines changed

2 files changed

+7
-110
lines changed

doc/UPGRADE-staging/pbx_builtins.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Subject: pbx_builtins
2+
Master-Only: True
3+
4+
The previously deprecated ImportVar and SetAMAFlags
5+
applications have now been removed.

main/pbx_builtins.c

Lines changed: 2 additions & 110 deletions
Original file line numberDiff line numberDiff line change
@@ -310,28 +310,6 @@
310310
<ref type="function">TESTTIME</ref>
311311
</see-also>
312312
</application>
313-
<application name="ImportVar" language="en_US">
314-
<synopsis>
315-
Import a variable from a channel into a new variable.
316-
</synopsis>
317-
<syntax argsep="=">
318-
<parameter name="newvar" required="true" />
319-
<parameter name="vardata" required="true">
320-
<argument name="channelname" required="true" />
321-
<argument name="variable" required="true" />
322-
</parameter>
323-
</syntax>
324-
<description>
325-
<para>This application imports a <replaceable>variable</replaceable> from the specified
326-
<replaceable>channel</replaceable> (as opposed to the current one) and stores it as a variable
327-
(<replaceable>newvar</replaceable>) in the current channel (the channel that is calling this
328-
application). Variables created by this application have the same inheritance properties as those
329-
created with the <literal>Set</literal> application.</para>
330-
</description>
331-
<see-also>
332-
<ref type="application">Set</ref>
333-
</see-also>
334-
</application>
335313
<application name="Hangup" language="en_US">
336314
<synopsis>
337315
Hang up the calling channel.
@@ -629,22 +607,6 @@
629607
<ref type="function">SAYFILES</ref>
630608
</see-also>
631609
</application>
632-
<application name="SetAMAFlags" language="en_US">
633-
<synopsis>
634-
Set the AMA Flags.
635-
</synopsis>
636-
<syntax>
637-
<parameter name="flag" />
638-
</syntax>
639-
<description>
640-
<para>This application will set the channel's AMA Flags for billing purposes.</para>
641-
<warning><para>This application is deprecated. Please use the CHANNEL function instead.</para></warning>
642-
</description>
643-
<see-also>
644-
<ref type="function">CDR</ref>
645-
<ref type="function">CHANNEL</ref>
646-
</see-also>
647-
</application>
648610
<application name="Wait" language="en_US">
649611
<synopsis>
650612
Waits for some time.
@@ -830,7 +792,7 @@ static int pbx_builtin_answer(struct ast_channel *chan, const char *data)
830792
char *parse;
831793
AST_DECLARE_APP_ARGS(args,
832794
AST_APP_ARG(delay);
833-
AST_APP_ARG(answer_cdr);
795+
AST_APP_ARG(options);
834796
);
835797

836798
if (ast_strlen_zero(data)) {
@@ -848,15 +810,10 @@ static int pbx_builtin_answer(struct ast_channel *chan, const char *data)
848810
delay = 0;
849811
}
850812

851-
if (!ast_strlen_zero(args.answer_cdr) && !strcmp(args.answer_cdr, "i")) {
852-
/*! \todo We will remove the nocdr stuff for 21 entirely, as part of another review. */
813+
if (!ast_strlen_zero(args.options) && !strcmp(args.options, "i")) {
853814
return ast_raw_answer(chan);
854815
}
855816

856-
if (!ast_strlen_zero(args.answer_cdr) && !strcasecmp(args.answer_cdr, "nocdr")) {
857-
ast_log(AST_LOG_WARNING, "The nocdr option for the Answer application has been removed and is no longer supported.\n");
858-
}
859-
860817
return __ast_answer(chan, delay);
861818
}
862819

@@ -882,34 +839,6 @@ static int pbx_builtin_incomplete(struct ast_channel *chan, const char *data)
882839
return AST_PBX_INCOMPLETE;
883840
}
884841

885-
/*!
886-
* \ingroup applications
887-
*/
888-
static int pbx_builtin_setamaflags(struct ast_channel *chan, const char *data)
889-
{
890-
ast_log(AST_LOG_WARNING, "The SetAMAFlags application is deprecated. Please use the CHANNEL function instead.\n");
891-
892-
if (ast_strlen_zero(data)) {
893-
ast_log(AST_LOG_WARNING, "No parameter passed to SetAMAFlags\n");
894-
return 0;
895-
}
896-
/* Copy the AMA Flags as specified */
897-
ast_channel_lock(chan);
898-
if (isdigit(data[0])) {
899-
int amaflags;
900-
if (sscanf(data, "%30d", &amaflags) != 1) {
901-
ast_log(AST_LOG_WARNING, "Unable to set AMA flags on channel %s\n", ast_channel_name(chan));
902-
ast_channel_unlock(chan);
903-
return 0;
904-
}
905-
ast_channel_amaflags_set(chan, amaflags);
906-
} else {
907-
ast_channel_amaflags_set(chan, ast_channel_string2amaflag(data));
908-
}
909-
ast_channel_unlock(chan);
910-
return 0;
911-
}
912-
913842
/*!
914843
* \ingroup applications
915844
*/
@@ -1531,41 +1460,6 @@ static int pbx_builtin_sayphonetic(struct ast_channel *chan, const char *data)
15311460
return res;
15321461
}
15331462

1534-
static int pbx_builtin_importvar(struct ast_channel *chan, const char *data)
1535-
{
1536-
char *name;
1537-
char *value;
1538-
char *channel;
1539-
char tmp[VAR_BUF_SIZE];
1540-
static int deprecation_warning = 0;
1541-
1542-
if (ast_strlen_zero(data)) {
1543-
ast_log(LOG_WARNING, "Ignoring, since there is no variable to set\n");
1544-
return 0;
1545-
}
1546-
tmp[0] = 0;
1547-
if (!deprecation_warning) {
1548-
ast_log(LOG_WARNING, "ImportVar is deprecated. Please use Set(varname=${IMPORT(channel,variable)}) instead.\n");
1549-
deprecation_warning = 1;
1550-
}
1551-
1552-
value = ast_strdupa(data);
1553-
name = strsep(&value,"=");
1554-
channel = strsep(&value,",");
1555-
if (channel && value && name) { /*! \todo XXX should do !ast_strlen_zero(..) of the args ? */
1556-
struct ast_channel *chan2 = ast_channel_get_by_name(channel);
1557-
if (chan2) {
1558-
char *s = ast_alloca(strlen(value) + 4);
1559-
sprintf(s, "${%s}", value);
1560-
pbx_substitute_variables_helper(chan2, s, tmp, sizeof(tmp) - 1);
1561-
chan2 = ast_channel_unref(chan2);
1562-
}
1563-
pbx_builtin_setvar_helper(chan, name, tmp);
1564-
}
1565-
1566-
return(0);
1567-
}
1568-
15691463
/*! \brief Declaration of builtin applications */
15701464
struct pbx_builtin {
15711465
char name[AST_MAX_APP];
@@ -1583,7 +1477,6 @@ struct pbx_builtin {
15831477
{ "Goto", pbx_builtin_goto },
15841478
{ "GotoIf", pbx_builtin_gotoif },
15851479
{ "GotoIfTime", pbx_builtin_gotoiftime },
1586-
{ "ImportVar", pbx_builtin_importvar },
15871480
{ "Hangup", pbx_builtin_hangup },
15881481
{ "Incomplete", pbx_builtin_incomplete },
15891482
{ "NoOp", pbx_builtin_noop },
@@ -1598,7 +1491,6 @@ struct pbx_builtin {
15981491
{ "SayNumber", pbx_builtin_saynumber },
15991492
{ "SayOrdinal", pbx_builtin_sayordinal },
16001493
{ "SayPhonetic", pbx_builtin_sayphonetic },
1601-
{ "SetAMAFlags", pbx_builtin_setamaflags },
16021494
{ "Wait", pbx_builtin_wait },
16031495
{ "WaitDigit", pbx_builtin_waitdigit },
16041496
{ "WaitExten", pbx_builtin_waitexten }

0 commit comments

Comments
 (0)