manager: Restore Originate failure behavior from Asterisk 11

In Asterisk 11, if the 'Originate' AMI command failed to connect the provided
Channel while in extension mode, a 'failed' extension would be looked up and
run. This was, I believe, unintentionally removed in 51b6c49. This patch
restores that behavior.

This also adds an enum for the various 'synchronous' modes in an attempt to
make them meaningful.

ASTERISK-26115 #close
Reported by: Nasir Iqbal

Change-Id: I8afbd06725e99610e02adb529137d4800c05345d
This commit is contained in:
Sean Bright
2017-02-09 11:01:22 -05:00
parent 648d181d2f
commit 0910773077
7 changed files with 53 additions and 25 deletions

View File

@@ -5130,13 +5130,15 @@ static void *fast_originate(void *data)
if (!ast_strlen_zero(in->app)) {
res = ast_pbx_outgoing_app(in->tech, in->cap, in->data,
in->timeout, in->app, in->appdata, &reason, 1,
in->timeout, in->app, in->appdata, &reason,
AST_OUTGOING_WAIT,
S_OR(in->cid_num, NULL),
S_OR(in->cid_name, NULL),
in->vars, in->account, &chan, &assignedids);
} else {
res = ast_pbx_outgoing_exten(in->tech, in->cap, in->data,
in->timeout, in->context, in->exten, in->priority, &reason, 1,
in->timeout, in->context, in->exten, in->priority, &reason,
AST_OUTGOING_WAIT,
S_OR(in->cid_num, NULL),
S_OR(in->cid_name, NULL),
in->vars, in->account, &chan, in->early_media, &assignedids);
@@ -5607,11 +5609,16 @@ static int action_originate(struct mansession *s, const struct message *m)
}
}
} else if (!ast_strlen_zero(app)) {
res = ast_pbx_outgoing_app(tech, cap, data, to, app, appdata, &reason, 1, l, n, vars, account, NULL, assignedids.uniqueid ? &assignedids : NULL);
res = ast_pbx_outgoing_app(tech, cap, data, to, app, appdata, &reason,
AST_OUTGOING_WAIT, l, n, vars, account, NULL,
assignedids.uniqueid ? &assignedids : NULL);
ast_variables_destroy(vars);
} else {
if (exten && context && pi) {
res = ast_pbx_outgoing_exten(tech, cap, data, to, context, exten, pi, &reason, 1, l, n, vars, account, NULL, bridge_early, assignedids.uniqueid ? &assignedids : NULL);
res = ast_pbx_outgoing_exten(tech, cap, data, to,
context, exten, pi, &reason, AST_OUTGOING_WAIT,
l, n, vars, account, NULL, bridge_early,
assignedids.uniqueid ? &assignedids : NULL);
ast_variables_destroy(vars);
} else {
astman_send_error(s, m, "Originate with 'Exten' requires 'Context' and 'Priority'");