]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
(closes issue #10603)
authorJoshua Colp <jcolp@digium.com>
Thu, 30 Aug 2007 14:53:43 +0000 (14:53 +0000)
committerJoshua Colp <jcolp@digium.com>
Thu, 30 Aug 2007 14:53:43 +0000 (14:53 +0000)
Reported by: jmls
Patches:
      pbx.diff uploaded by jmls (license 141)
Backport changes from 81372. 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/branches/1.4@81375 65c4cc65-6c06-0410-ace0-fbb531ad65f3

main/pbx.c

index f3dcea8c7c10db1fcf5c9d6e314eedc312d7d3a9..1adb4da8e749669d3e39fb6a7eee447881226d2f 100644 (file)
@@ -5034,10 +5034,13 @@ int ast_pbx_outgoing_exten(const char *type, int format, void *data, int timeout
                        if (ast_exists_extension(chan, context, "failed", 1, NULL)) {
                                chan = ast_channel_alloc(0, AST_STATE_DOWN, 0, 0, "", "", "", 0, "OutgoingSpoolFailed");
                                if (chan) {
+                                       char failed_reason[4] = "";
                                        if (!ast_strlen_zero(context))
                                                ast_copy_string(chan->context, context, sizeof(chan->context));
                                        set_ext_pri(chan, "failed", 1);
                                        ast_set_variables(chan, vars);
+                                       snprintf(failed_reason, sizeof(failed_reason), "%d", *reason);
+                                       pbx_builtin_setvar_helper(chan, "REASON", failed_reason);
                                        if (account)
                                                ast_cdr_setaccount(chan, account);
                                        ast_pbx_run(chan);