[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
Tue Jul 31 10:16:37 CDT 2007


A NOTE has been added to this issue. 
====================================================================== 
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:                     new
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:              
====================================================================== 
Date Submitted:             07-31-2007 01:42 CDT
Last Modified:              07-31-2007 10:16 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);      
====================================================================== 

---------------------------------------------------------------------- 
 qwell - 07-31-07 10:16  
---------------------------------------------------------------------- 
1) Please read the coding guidelines.
2) Please only post patches as attachments.
3) Since this is a new feature, it can only go into svn trunk (this goes
back to http://bugs.digium.com/view.php?id=2 above) 

Issue History 
Date Modified   Username       Field                    Change               
====================================================================== 
07-31-07 10:16  qwell          Note Added: 0068122                          
======================================================================




More information about the asterisk-bugs mailing list