From f86d2a211c5178eb49a615b414d296bd1a694e66 Mon Sep 17 00:00:00 2001 From: Naveen Albert Date: Tue, 29 Nov 2022 21:44:28 +0000 Subject: [PATCH] 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 --- doc/UPGRADE-staging/pbx_builtins.txt | 5 ++ main/pbx_builtins.c | 112 +-------------------------- 2 files changed, 7 insertions(+), 110 deletions(-) create mode 100644 doc/UPGRADE-staging/pbx_builtins.txt diff --git a/doc/UPGRADE-staging/pbx_builtins.txt b/doc/UPGRADE-staging/pbx_builtins.txt new file mode 100644 index 0000000000..9aeb70c769 --- /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 fa6e63d184..8611cc57d7 100644 --- a/main/pbx_builtins.c +++ b/main/pbx_builtins.c @@ -310,28 +310,6 @@ TESTTIME - - - Import a variable from a channel into a new variable. - - - - - - - - - - This application imports a variable from the specified - channel (as opposed to the current one) and stores it as a variable - (newvar) 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 Set application. - - - Set - - Hang up the calling channel. @@ -629,22 +607,6 @@ SAYFILES - - - Set the AMA Flags. - - - - - - This application will set the channel's AMA Flags for billing purposes. - This application is deprecated. Please use the CHANNEL function instead. - - - CDR - CHANNEL - - Waits for some time. @@ -830,7 +792,7 @@ static int pbx_builtin_answer(struct ast_channel *chan, const char *data) 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 @@ static int pbx_builtin_answer(struct ast_channel *chan, const char *data) 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); } @@ -882,34 +839,6 @@ static int pbx_builtin_incomplete(struct ast_channel *chan, const char *data) return AST_PBX_INCOMPLETE; } -/*! - * \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 */ @@ -1531,41 +1460,6 @@ static int pbx_builtin_sayphonetic(struct ast_channel *chan, const char *data) 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 @@ struct pbx_builtin { { "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 @@ struct pbx_builtin { { "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 }