Make ${ACCOUNTCODE} available and document (bug #459)
authorMark Spencer <markster@digium.com>
Thu, 13 Nov 2003 20:42:17 +0000 (20:42 +0000)
committerMark Spencer <markster@digium.com>
Thu, 13 Nov 2003 20:42:17 +0000 (20:42 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@1743 65c4cc65-6c06-0410-ace0-fbb531ad65f3

README.variables
doc/README.variables
pbx.c

index 95485ba..dab5fac 100755 (executable)
@@ -44,6 +44,8 @@ ${UNIQUEID}   Current call unique identifier
 ${DNID}         Dialed Number Identifier
 ${RDNIS}        Redirected Dial Number ID Service
 ${HANGUPCAUSE} Hangup cause on last PRI hangup
+${ACCOUNTCODE}  Account code (if specified)
+
 ${SIPDOMAIN}    SIP destination domain of an inbound call (if appropriate)
 
 There are two reference modes - reference by value and reference by name. 
index 95485ba..dab5fac 100755 (executable)
@@ -44,6 +44,8 @@ ${UNIQUEID}   Current call unique identifier
 ${DNID}         Dialed Number Identifier
 ${RDNIS}        Redirected Dial Number ID Service
 ${HANGUPCAUSE} Hangup cause on last PRI hangup
+${ACCOUNTCODE}  Account code (if specified)
+
 ${SIPDOMAIN}    SIP destination domain of an inbound call (if appropriate)
 
 There are two reference modes - reference by value and reference by name. 
diff --git a/pbx.c b/pbx.c
index 0ed1fd0..10a890d 100755 (executable)
--- a/pbx.c
+++ b/pbx.c
@@ -865,6 +865,9 @@ static void pbx_substitute_variables_temp(struct ast_channel *c,const char *var,
         } else if (c && !strcmp(var, "HANGUPCAUSE")) {
           snprintf(workspace, workspacelen -1, "%i", c->hangupcause);
           *ret = workspace;
+        } else if (c && !strcmp(var, "ACCOUNTCODE")) {
+          strncpy(workspace, c->accountcode, workspacelen - 1);
+          *ret = workspace;
        } else {
                if (c) {
                        AST_LIST_TRAVERSE(headp,variables,entries) {