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

N A asteriskteam at digium.com
Tue Nov 29 15:48:10 CST 2022


N A has uploaded this change for review. ( 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, 24 insertions(+), 88 deletions(-)



  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/10/19610/1

diff --git a/doc/UPGRADE-staging/pbx_builtins.txt b/doc/UPGRADE-staging/pbx_builtins.txt
new file mode 100644
index 0000000..fa79ede
--- /dev/null
+++ b/doc/UPGRADE-staging/pbx_builtins.txt
@@ -0,0 +1,4 @@
+Subject: pbx_builtins
+
+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..f7d4bc2 100644
--- a/main/pbx_builtins.c
+++ b/main/pbx_builtins.c
@@ -629,22 +629,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 +814,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 +832,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 +864,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 +1482,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 +1499,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 +1513,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: 1
Gerrit-Owner: N A <asterisk at phreaknet.org>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20221129/969d6395/attachment-0001.html>


More information about the asterisk-code-review mailing list