[Home]

Summary:ASTERISK-09987: On outgoing calls, failed reason does not get put into a variable
Reporter:Benjamin Koenig (phsdshft)Labels:
Date Opened:2007-07-31 01:42:14Date Closed:2007-08-19 16:35:18
Priority:MinorRegression?No
Status:Closed/CompleteComponents:PBX/NewFeature
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:
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);      
Comments:By: Jason Parker (jparker) 2007-07-31 10:16:37

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 1) above)



By: Clod Patry (junky) 2007-08-19 16:35:18

Apparently, reporter has lost interest.
Feel free to re-open when doing what qwell has requested.

Thanks.