app_macro: Remove deprecated module.

For most modules that interacted with app_macro, this change is limited
to no longer looking for the current context from the macrocontext when
set.  Additionally, the following modules are impacted:

app_dial - no longer supports M^ connected/redirecting macro
app_minivm - samples written using macro will no longer work.
The sample needs a re-write

app_queue - can no longer a macro on the called party's channel.
Use gosub which is currently supported

ccss - no callback macro, gosub only

app_voicemail - no macro support

channel  - remove macrocontext and priority, no connected line or
redirection macro options
options - stdexten is deprecated to gosub as the default and only
pbx - removed macrolock
pbx_dundi - no longer look for macro

snmp - removed macro context, exten, and priority

ASTERISK-30304

Change-Id: I830daab293117179b8d61bd4df0d971a1b3d07f6
This commit is contained in:
Mike Bradeen
2022-12-12 10:12:57 -07:00
committed by Friendly Automation
parent 6ecec51e6a
commit e8f548c155
52 changed files with 143 additions and 1615 deletions

View File

@@ -177,7 +177,7 @@
the current extension and <emphasis>start</emphasis> execution at that location.</para>
<para>NOTE: Any channel variables you want the called channel to inherit from the caller channel must be
prefixed with one or two underbars ('_').</para>
<para>NOTE: Using this option from a Macro() or GoSub() might not make sense as there would be no return points.</para>
<para>NOTE: Using this option from a GoSub() might not make sense as there would be no return points.</para>
</option>
<option name="h">
<para>Allow <emphasis>callee</emphasis> to hang up by pressing <literal>*</literal>.</para>
@@ -259,10 +259,6 @@
<para>Will setup an AGI script to be executed on the calling party's channel once they are
connected to a queue member.</para>
</parameter>
<parameter name="macro">
<para>Will run a macro on the called party's channel (the queue member) once the parties are connected.</para>
<para>NOTE: Macros are deprecated, GoSub should be used instead.</para>
</parameter>
<parameter name="gosub">
<para>Will run a gosub on the called party's channel (the queue member)
once the parties are connected. The subroutine execution starts in the
@@ -1800,8 +1796,6 @@ struct call_queue {
AST_STRING_FIELD(announce);
/*! Exit context */
AST_STRING_FIELD(context);
/*! Macro to run upon member connection */
AST_STRING_FIELD(membermacro);
/*! Gosub to run upon member connection */
AST_STRING_FIELD(membergosub);
/*! Default rule to use if none specified in call to Queue() */
@@ -3345,8 +3339,6 @@ static void queue_set_param(struct call_queue *q, const char *param, const char
q->setqueueentryvar = ast_true(val);
} else if (!strcasecmp(param, "monitor-format")) {
ast_copy_string(q->monfmt, val, sizeof(q->monfmt));
} else if (!strcasecmp(param, "membermacro")) {
ast_string_field_set(q, membermacro, val);
} else if (!strcasecmp(param, "membergosub")) {
ast_string_field_set(q, membergosub, val);
} else if (!strcasecmp(param, "queue-youarenext")) {
@@ -4687,7 +4679,6 @@ static int ring_entry(struct queue_ent *qe, struct callattempt *tmp, int *busies
int status;
char tech[256];
char *location;
const char *macrocontext, *macroexten;
struct ast_format_cap *nativeformats;
RAII_VAR(struct ast_json *, blob, NULL, ast_json_unref);
@@ -4748,8 +4739,8 @@ static int ring_entry(struct queue_ent *qe, struct callattempt *tmp, int *busies
ast_channel_set_caller_event(tmp->chan, &caller, NULL);
} else if (!ast_strlen_zero(ast_channel_dialed(qe->chan)->number.str)) {
ast_set_callerid(tmp->chan, ast_channel_dialed(qe->chan)->number.str, NULL, NULL);
} else if (!ast_strlen_zero(S_OR(ast_channel_macroexten(qe->chan), ast_channel_exten(qe->chan)))) {
ast_set_callerid(tmp->chan, S_OR(ast_channel_macroexten(qe->chan), ast_channel_exten(qe->chan)), NULL, NULL);
} else if (!ast_strlen_zero(ast_channel_exten(qe->chan))) {
ast_set_callerid(tmp->chan, ast_channel_exten(qe->chan), NULL, NULL);
}
tmp->dial_callerid_absent = 1;
}
@@ -4769,14 +4760,8 @@ static int ring_entry(struct queue_ent *qe, struct callattempt *tmp, int *busies
ast_channel_adsicpe_set(tmp->chan, ast_channel_adsicpe(qe->chan));
/* Inherit context and extension */
macrocontext = pbx_builtin_getvar_helper(qe->chan, "MACRO_CONTEXT");
ast_channel_dialcontext_set(tmp->chan, ast_strlen_zero(macrocontext) ? ast_channel_context(qe->chan) : macrocontext);
macroexten = pbx_builtin_getvar_helper(qe->chan, "MACRO_EXTEN");
if (!ast_strlen_zero(macroexten)) {
ast_channel_exten_set(tmp->chan, macroexten);
} else {
ast_channel_exten_set(tmp->chan, ast_channel_exten(qe->chan));
}
ast_channel_dialcontext_set(tmp->chan, ast_channel_context(qe->chan));
ast_channel_exten_set(tmp->chan, ast_channel_exten(qe->chan));
/* Save the original channel name to detect call pickup masquerading in. */
tmp->orig_chan_name = ast_strdup(ast_channel_name(tmp->chan));
@@ -5120,8 +5105,7 @@ static void update_connected_line_from_peer(struct ast_channel *chan, struct ast
ast_connected_line_copy_from_caller(&connected_caller, ast_channel_caller(peer));
ast_channel_unlock(peer);
connected_caller.source = AST_CONNECTED_LINE_UPDATE_SOURCE_ANSWER;
if (ast_channel_connected_line_sub(peer, chan, &connected_caller, 0)
&& ast_channel_connected_line_macro(peer, chan, &connected_caller, is_caller, 0)) {
if (ast_channel_connected_line_sub(peer, chan, &connected_caller, 0)) {
ast_channel_update_connected_line(chan, &connected_caller, NULL);
}
ast_party_connected_line_free(&connected_caller);
@@ -5241,8 +5225,7 @@ static struct callattempt *wait_for_answer(struct queue_ent *qe, struct callatte
update_connected_line_from_peer(in, o->chan, 1);
} else if (!o->block_connected_update) {
if (o->pending_connected_update) {
if (ast_channel_connected_line_sub(o->chan, in, &o->connected, 0) &&
ast_channel_connected_line_macro(o->chan, in, &o->connected, 1, 0)) {
if (ast_channel_connected_line_sub(o->chan, in, &o->connected, 0)) {
ast_channel_update_connected_line(in, &o->connected, NULL);
}
} else if (!o->dial_callerid_absent) {
@@ -5352,7 +5335,7 @@ static struct callattempt *wait_for_answer(struct queue_ent *qe, struct callatte
ast_party_number_init(&ast_channel_redirecting(o->chan)->from.number);
ast_channel_redirecting(o->chan)->from.number.valid = 1;
ast_channel_redirecting(o->chan)->from.number.str =
ast_strdup(S_OR(ast_channel_macroexten(in), ast_channel_exten(in)));
ast_strdup(ast_channel_exten(in));
}
ast_channel_dialed(o->chan)->transit_network_select = ast_channel_dialed(in)->transit_network_select;
@@ -5371,17 +5354,13 @@ static struct callattempt *wait_for_answer(struct queue_ent *qe, struct callatte
* Redirecting updates to the caller make sense only on single
* call at a time strategies.
*
* We must unlock o->chan before calling
* ast_channel_redirecting_macro, because we put o->chan into
* autoservice there. That is pretty much a guaranteed
* deadlock. This is why the handling of o->chan's lock may
* seem a bit unusual here.
* Need to re-evaluate if calling unlock is still required as we no longer
* use macro.
*/
ast_party_redirecting_init(&redirecting);
ast_party_redirecting_copy(&redirecting, ast_channel_redirecting(o->chan));
ast_channel_unlock(o->chan);
if (ast_channel_redirecting_sub(o->chan, in, &redirecting, 0) &&
ast_channel_redirecting_macro(o->chan, in, &redirecting, 1, 0)) {
if (ast_channel_redirecting_sub(o->chan, in, &redirecting, 0)) {
ast_channel_update_redirecting(in, &redirecting, NULL);
}
ast_party_redirecting_free(&redirecting);
@@ -5430,8 +5409,7 @@ static struct callattempt *wait_for_answer(struct queue_ent *qe, struct callatte
update_connected_line_from_peer(in, o->chan, 1);
} else if (!o->block_connected_update) {
if (o->pending_connected_update) {
if (ast_channel_connected_line_sub(o->chan, in, &o->connected, 0) &&
ast_channel_connected_line_macro(o->chan, in, &o->connected, 1, 0)) {
if (ast_channel_connected_line_sub(o->chan, in, &o->connected, 0)) {
ast_channel_update_connected_line(in, &o->connected, NULL);
}
} else if (!o->dial_callerid_absent) {
@@ -5523,8 +5501,7 @@ static struct callattempt *wait_for_answer(struct queue_ent *qe, struct callatte
*/
o->dial_callerid_absent = 1;
if (ast_channel_connected_line_sub(o->chan, in, f, 1) &&
ast_channel_connected_line_macro(o->chan, in, f, 1, 1)) {
if (ast_channel_connected_line_sub(o->chan, in, f, 1)) {
ast_indicate_data(in, AST_CONTROL_CONNECTED_LINE, f->data.ptr, f->datalen);
}
break;
@@ -5554,8 +5531,7 @@ static struct callattempt *wait_for_answer(struct queue_ent *qe, struct callatte
}
ast_verb(3, "%s redirecting info has changed, passing it to %s\n",
ochan_name, inchan_name);
if (ast_channel_redirecting_sub(o->chan, in, f, 1) &&
ast_channel_redirecting_macro(o->chan, in, f, 1, 1)) {
if (ast_channel_redirecting_sub(o->chan, in, f, 1)) {
ast_indicate_data(in, AST_CONTROL_REDIRECTING, f->data.ptr, f->datalen);
}
break;
@@ -5636,8 +5612,7 @@ static struct callattempt *wait_for_answer(struct queue_ent *qe, struct callatte
ast_verb(3, "Connected line update to %s prevented.\n", ast_channel_name(o->chan));
break;
}
if (ast_channel_connected_line_sub(in, o->chan, f, 1) &&
ast_channel_connected_line_macro(in, o->chan, f, 0, 1)) {
if (ast_channel_connected_line_sub(in, o->chan, f, 1)) {
ast_indicate_data(o->chan, f->subclass.integer, f->data.ptr, f->datalen);
}
break;
@@ -5646,8 +5621,7 @@ static struct callattempt *wait_for_answer(struct queue_ent *qe, struct callatte
ast_verb(3, "Redirecting update to %s prevented.\n", ast_channel_name(o->chan));
break;
}
if (ast_channel_redirecting_sub(in, o->chan, f, 1) &&
ast_channel_redirecting_macro(in, o->chan, f, 0, 1)) {
if (ast_channel_redirecting_sub(in, o->chan, f, 1)) {
ast_indicate_data(o->chan, f->subclass.integer, f->data.ptr, f->datalen);
}
break;
@@ -6921,11 +6895,10 @@ static void setup_mixmonitor(struct queue_ent *qe, const char *filename)
* \param[in,out] tries the number of times we have tried calling queue members
* \param[out] noption set if the call to Queue() has the 'n' option set.
* \param[in] agi the agi passed as the fifth parameter to the Queue() application
* \param[in] macro the macro passed as the sixth parameter to the Queue() application
* \param[in] gosub the gosub passed as the seventh parameter to the Queue() application
* \param[in] ringing 1 if the 'r' option is set, otherwise 0
*/
static int try_calling(struct queue_ent *qe, struct ast_flags opts, char **opt_args, char *announceoverride, const char *url, int *tries, int *noption, const char *agi, const char *macro, const char *gosub, int ringing)
static int try_calling(struct queue_ent *qe, struct ast_flags opts, char **opt_args, char *announceoverride, const char *url, int *tries, int *noption, const char *agi, const char *gosub, int ringing)
{
struct member *cur;
struct callattempt *outgoing = NULL; /* the list of calls we are building */
@@ -6947,7 +6920,6 @@ static int try_calling(struct queue_ent *qe, struct ast_flags opts, char **opt_a
struct ast_bridge_config bridge_config;
char nondataquality = 1;
char *agiexec = NULL;
char *macroexec = NULL;
char *gosubexec = NULL;
const char *monitorfilename;
char tmpid[256];
@@ -7314,21 +7286,6 @@ static int try_calling(struct queue_ent *qe, struct ast_flags opts, char **opt_a
ast_channel_sendurl(peer, url);
}
/* run a macro for this connection if defined. The macro simply returns, no action is taken on the result */
/* use macro from dialplan if passed as a option, otherwise use the default queue macro */
if (!ast_strlen_zero(macro)) {
macroexec = ast_strdupa(macro);
} else {
if (qe->parent->membermacro) {
macroexec = ast_strdupa(qe->parent->membermacro);
}
}
if (!ast_strlen_zero(macroexec)) {
ast_debug(1, "app_queue: macro=%s.\n", macroexec);
ast_app_exec_macro(qe->chan, peer, macroexec);
}
/* run a gosub for this connection if defined. The gosub simply returns, no action is taken on the result */
/* use gosub from dialplan if passed as a option, otherwise use the default queue gosub */
if (!ast_strlen_zero(gosub)) {
@@ -8463,7 +8420,6 @@ static int queue_exec(struct ast_channel *chan, const char *data)
AST_APP_ARG(announceoverride);
AST_APP_ARG(queuetimeoutstr);
AST_APP_ARG(agi);
AST_APP_ARG(macro);
AST_APP_ARG(gosub);
AST_APP_ARG(rule);
AST_APP_ARG(position);
@@ -8475,7 +8431,7 @@ static int queue_exec(struct ast_channel *chan, const char *data)
int max_forwards;
if (ast_strlen_zero(data)) {
ast_log(LOG_WARNING, "Queue requires an argument: queuename[,options[,URL[,announceoverride[,timeout[,agi[,macro[,gosub[,rule[,position]]]]]]]]]\n");
ast_log(LOG_WARNING, "Queue requires an argument: queuename[,options[,URL[,announceoverride[,timeout[,agi[,gosub[,rule[,position]]]]]]]]\n");
return -1;
}
@@ -8491,14 +8447,13 @@ static int queue_exec(struct ast_channel *chan, const char *data)
parse = ast_strdupa(data);
AST_STANDARD_APP_ARGS(args, parse);
ast_debug(1, "queue: %s, options: %s, url: %s, announce: %s, timeout: %s, agi: %s, macro: %s, gosub: %s, rule: %s, position: %s\n",
ast_debug(1, "queue: %s, options: %s, url: %s, announce: %s, timeout: %s, agi: %s, gosub: %s, rule: %s, position: %s\n",
args.queuename,
S_OR(args.options, ""),
S_OR(args.url, ""),
S_OR(args.announceoverride, ""),
S_OR(args.queuetimeoutstr, ""),
S_OR(args.agi, ""),
S_OR(args.macro, ""),
S_OR(args.gosub, ""),
S_OR(args.rule, ""),
S_OR(args.position, ""));
@@ -8719,7 +8674,7 @@ check_turns:
}
/* Try calling all queue members for 'timeout' seconds */
res = try_calling(&qe, opts, opt_args, args.announceoverride, args.url, &tries, &noption, args.agi, args.macro, args.gosub, ringing);
res = try_calling(&qe, opts, opt_args, args.announceoverride, args.url, &tries, &noption, args.agi, args.gosub, ringing);
if (res) {
goto stop;
}