[Asterisk-code-review] pbx_builtins: Remove deprecated and defunct functionality. (asterisk[master])

Friendly Automation asteriskteam at digium.com
Tue Dec 20 09:54:02 CST 2022


Friendly Automation has submitted this change. ( https://gerrit.asterisk.org/c/asterisk/+/19610 )

Change subject: pbx_builtins: Remove deprecated and defunct functionality.
......................................................................

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
---
A doc/UPGRADE-staging/pbx_builtins.txt
M main/pbx_builtins.c
2 files changed, 25 insertions(+), 110 deletions(-)

Approvals:
  George Joseph: Looks good to me, approved
  Friendly Automation: Approved for Submit




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

-- 
To view, visit https://gerrit.asterisk.org/c/asterisk/+/19610
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Change-Id: I749520c7b08d4c9d5eebbf640d4fbc81950eda8d
Gerrit-Change-Number: 19610
Gerrit-PatchSet: 4
Gerrit-Owner: N A <asterisk at phreaknet.org>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Joshua Colp <jcolp at sangoma.com>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20221220/01322c62/attachment-0001.html>


More information about the asterisk-code-review mailing list