mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-30 18:40:46 +00:00
(closes issue #10603)
Reported by: jmls Patches: pbx.diff uploaded by jmls (license 141) Add REASON dialplan variable for when an originated call fails and the failed extension is executed. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@81372 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
2
CHANGES
2
CHANGES
@@ -272,3 +272,5 @@ Miscellaneous
|
|||||||
* The device state functionality in the Local channel driver has been updated
|
* The device state functionality in the Local channel driver has been updated
|
||||||
to indicate INUSE or NOT_INUSE when a Local channel is being used as opposed
|
to indicate INUSE or NOT_INUSE when a Local channel is being used as opposed
|
||||||
to just UNKNOWN if the extension exists.
|
to just UNKNOWN if the extension exists.
|
||||||
|
* When originating a call using AMI or pbx_spool that fails the reason for failure
|
||||||
|
will now be available in the failed extension using the REASON dialplan variable.
|
||||||
|
@@ -5053,10 +5053,13 @@ int ast_pbx_outgoing_exten(const char *type, int format, void *data, int timeout
|
|||||||
if (ast_exists_extension(chan, context, "failed", 1, NULL)) {
|
if (ast_exists_extension(chan, context, "failed", 1, NULL)) {
|
||||||
chan = ast_channel_alloc(0, AST_STATE_DOWN, 0, 0, "", "", "", 0, "OutgoingSpoolFailed");
|
chan = ast_channel_alloc(0, AST_STATE_DOWN, 0, 0, "", "", "", 0, "OutgoingSpoolFailed");
|
||||||
if (chan) {
|
if (chan) {
|
||||||
|
char failed_reason[4] = "";
|
||||||
if (!ast_strlen_zero(context))
|
if (!ast_strlen_zero(context))
|
||||||
ast_copy_string(chan->context, context, sizeof(chan->context));
|
ast_copy_string(chan->context, context, sizeof(chan->context));
|
||||||
set_ext_pri(chan, "failed", 1);
|
set_ext_pri(chan, "failed", 1);
|
||||||
ast_set_variables(chan, vars);
|
ast_set_variables(chan, vars);
|
||||||
|
snprintf(failed_reason, sizeof(failed_reason), "%d", *reason);
|
||||||
|
pbx_builtin_setvar_helper(chan, "REASON", failed_reason);
|
||||||
if (account)
|
if (account)
|
||||||
ast_cdr_setaccount(chan, account);
|
ast_cdr_setaccount(chan, account);
|
||||||
ast_pbx_run(chan);
|
ast_pbx_run(chan);
|
||||||
|
Reference in New Issue
Block a user