[asterisk-bugs] [Asterisk 0010340]: On outgoing calls, failed reason does not get put into a variable

noreply at bugs.digium.com noreply at bugs.digium.com
Sun Aug 19 16:35:18 CDT 2007


The following issue has been CLOSED 
====================================================================== 
http://bugs.digium.com/view.php?id=10340 
====================================================================== 
Reported By:                phsdshft
Assigned To:                
====================================================================== 
Project:                    Asterisk
Issue ID:                   10340
Category:                   PBX/NewFeature
Reproducibility:            N/A
Severity:                   tweak
Priority:                   normal
Status:                     closed
Asterisk Version:            1.2.18  
SVN Branch (only for SVN checkouts, not tarball releases): N/A  
SVN Revision (number only!):  
Disclaimer on File?:        N/A 
Request Review:              
Resolution:                 open
Fixed in Version:           
====================================================================== 
Date Submitted:             07-31-2007 01:42 CDT
Last Modified:              08-19-2007 16:35 CDT
====================================================================== 
Summary:                    On outgoing calls, failed reason does not get put
into a variable
Description: 
When making outbound calls and there is a failure (thereby going to a
failed extension if it exists), the 'reason' is not put into a variable.
This means that you can't tell why it failed (i.e. busy signal, etc). The
attach patch puts 'reason' into the channel variable 'FAILCODE' so you can
now get the reason for failure.

diff -rNu asterisk-1.2.18.orig/pbx.c asterisk-1.2.18/pbx.c
--- asterisk-1.2.18.orig/pbx.c  2007-03-05 09:53:57.000000000 -0500
+++ asterisk-1.2.18/pbx.c       2007-07-31 02:45:47.000000000 -0400
@@ -5011,6 +5011,11 @@
        int res = -1, cdr_res = -1;
        struct outgoing_helper oh;
        pthread_attr_t attr;
+       char *value = (char *) malloc(1); // Added by Nate K.
+       const char *name = "FAILCODE"; // Added by Nate K.
+       struct varshead *headp; // Added by Nate K. to support FAILCODE
var
+       struct ast_var_t *newvariable; // Added by Nate K. to support
FAILCODE var
+       int value1 = -1;
 
        if (sync) {
                LOAD_OH(oh);
@@ -5101,7 +5106,23 @@
                                               
ast_copy_string(chan->context, context, sizeof(chan->context));
                                        ast_copy_string(chan->exten,
"failed", sizeof(chan->exten));
                                        chan->priority = 1;
+
+                                       // Added by Nate K. to allow for
FAILCODE variable
+
+                                       if (option_verbose > 3)
+                                              
ast_verbose(VERBOSE_PREFIX_4 "Testing Reason %d was received.\n", value1);
+
+
+                                       headp = (chan) ? &chan->varshead :
&globals;
+
+                                      
sprintf((char*)value,"%d",(int)*reason);
+
+                                       newvariable = ast_var_assign(name,
value);
+                                       AST_LIST_INSERT_HEAD(headp,
newvariable, entries);
+
                                        ast_set_variables(chan, vars);
+
+
                                        if (account)
                                                ast_cdr_setaccount(chan,
account);
                                        ast_pbx_run(chan);      
====================================================================== 

---------------------------------------------------------------------- 
 junky - 08-19-07 16:35  
---------------------------------------------------------------------- 
Apparently, reporter has lost interest.
Feel free to re-open when doing what qwell has requested.

Thanks. 

Issue History 
Date Modified   Username       Field                    Change               
====================================================================== 
08-19-07 16:35  junky          Status                   feedback => closed  
08-19-07 16:35  junky          Note Added: 0069063                          
======================================================================




More information about the asterisk-bugs mailing list