Summary:ASTERISK-01972: HANGUPCAUSE not being set
Reporter:ewieling (ewieling)Labels:
Date Opened:2004-07-08 12:32:13Date Closed:2011-06-07 14:11:59
Versions:Frequency of
Description:   -- Executing Dial("IAX2[btel@btel]/7", "Zap/g1/w142www") in new stack
   -- Called g1/w142www
   -- Zap/g1/w142www-busy-1313636241 is busy
   -- Hungup 'Zap/g1/w142www-busy-1313636241'
 == Everyone is busy/congested at this time
   -- Executing NoOp("IAX2[btel@btel]/7", "HANGUPCAUSE is 0") in new stack
   -- Executing NoOp("IAX2[btel@btel]/7", "DIALSTATUS is BUSY") in new stack

Asterisk CVS-HEAD-06/18/04-23:22:05 built by root@voip-1.stirlingprop.com on a i686 running Linux

exten => _31XX,1,Dial(Zap/g1/w${EXTEN:1}www)
exten => _31XX,2,NoOp(HANGUPCAUSE is ${HANGUPCAUSE})
exten => _31XX,3,NoOp(DIALSTATUS is ${DIALSTATUS})
Comments:By: ewieling (ewieling) 2004-07-08 12:39:18

I think that if the analog zap port is in use then we should get a CONGESTION cause code back.

By: Mark Spencer (markster) 2004-07-08 12:41:38

You're ringing a busy FXO signalled interface, that's why HANGUPCAUSE isn't getting set.  HANGUPCAUSE only works on PRI.  If you have more questions find me on IRC.

By: Malcolm Davenport (mdavenport) 2004-07-08 13:11:25

Re-opening per request.

By: ewieling (ewieling) 2004-07-08 13:16:03

I can't seem to upload my patch to make this work.  It's not the Right Way, but it does work.

[root@pbx-1 asterisk]# diff -u apps/app_dial.c-orig apps/app_dial.c
--- apps/app_dial.c-orig        2004-07-08 12:47:05.000000000 -0500
+++ apps/app_dial.c     2004-07-08 12:50:31.000000000 -0500
@@ -26,6 +26,7 @@
#include <asterisk/callerid.h>
#include <asterisk/utils.h>
#include <asterisk/app.h>
+#include <asterisk/causes.h>
#include <stdlib.h>
#include <errno.h>
#include <unistd.h>
@@ -167,10 +168,14 @@
                       if (numlines == (numbusy + numcongestion + numnochan)) {
                               if (option_verbose > 2)
                                       ast_verbose( VERBOSE_PREFIX_2 "Everyone is busy/congested at this time\n");
-                               if (numbusy)
+                               if (numbusy) {
                                       strcpy(status, "BUSY");
-                               else if (numcongestion)
+                                       in->hangupcause = AST_CAUSE_BUSY;
+                               }
+                               else if (numcongestion) {
                                       strcpy(status, "CONGESTION");
+                                       in->hangupcause = AST_CAUSE_CONGESTION;
+                               }
                               else if (numnochan)
                                       strcpy(status, "CHANUNAVAIL");
                               /* See if there is a special busy message */

By: Mark Spencer (markster) 2004-07-09 03:42:21

You would on a PRI, but not on an FXO because an FXO is BUSY when it's off hook, not CONGESTED.  Like I said, if you have questions, find me on IRC and don't reopen this bug until you've talked to me.

By: Mark Spencer (markster) 2004-07-09 03:43:24

And just to clarify, HANGUPCAUSE is only set when we receive one on PRI.