Make HANGUPCAUSE accessible
authorMark Spencer <markster@digium.com>
Sat, 25 Oct 2003 18:00:00 +0000 (18:00 +0000)
committerMark Spencer <markster@digium.com>
Sat, 25 Oct 2003 18:00:00 +0000 (18:00 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@1669 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channels/chan_zap.c
include/asterisk/causes.h
pbx.c

index 2391734..77f1fc0 100755 (executable)
@@ -514,6 +514,12 @@ static int hangup_pri2cause(int cause)
                        return AST_CAUSE_BUSY;
                case PRI_CAUSE_NORMAL_CLEARING:
                        return AST_CAUSE_NORMAL;
+               case PRI_CAUSE_NORMAL_CIRCUIT_CONGESTION:
+               case PRI_CAUSE_REQUESTED_CHAN_UNAVAIL:
+                       return AST_CAUSE_CONGESTION;
+               case PRI_CAUSE_UNALLOCATED:
+               case PRI_CAUSE_NUMBER_CHANGED:
+                       return AST_CAUSE_UNALLOCATED;
                default:
                        return AST_CAUSE_FAILURE;
        }
index 8513628..e700690 100755 (executable)
@@ -16,5 +16,6 @@
 #define AST_CAUSE_NORMAL       1
 #define AST_CAUSE_BUSY         2
 #define AST_CAUSE_FAILURE      3
-
+#define AST_CAUSE_CONGESTION   4
+#define AST_CAUSE_UNALLOCATED  5
 
diff --git a/pbx.c b/pbx.c
index 98e1ade..cda3dd0 100755 (executable)
--- a/pbx.c
+++ b/pbx.c
@@ -862,6 +862,9 @@ static void pbx_substitute_variables_temp(struct ast_channel *c,const char *var,
        } else if (c && !strcmp(var, "UNIQUEID")) {
          snprintf(workspace, workspacelen -1, "%s", c->uniqueid);
          *ret = workspace;
+        } else if (c && !strcmp(var, "HANGUPCAUSE")) {
+          snprintf(workspace, workspacelen -1, "%i", c->hangupcause);
+          *ret = workspace;
        } else {
                if (c) {
                        AST_LIST_TRAVERSE(headp,variables,entries) {