Add the ability to pass options to the Dial application when using the DUNDi
authorRussell Bryant <russell@russellbryant.com>
Wed, 1 Nov 2006 18:40:13 +0000 (18:40 +0000)
committerRussell Bryant <russell@russellbryant.com>
Wed, 1 Nov 2006 18:40:13 +0000 (18:40 +0000)
switch in the dialplan by setting the DUNDIDIALARGS channel variable.
(issue #8084, patch by bluecrow76, with small modifications and documentation
updates)

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@46781 65c4cc65-6c06-0410-ace0-fbb531ad65f3

doc/channelvariables.txt
pbx/pbx_dundi.c

index 0a859ef..b9b355b 100644 (file)
@@ -696,6 +696,12 @@ DUNDiLookup() uses the following variables
 ${DUNDTECH}    * The Technology of the result from a call to DUNDiLookup()
 ${DUNDDEST}    * The Destination of the result from a call to DUNDiLookup()
 
+The DUNDi dialplan switch uses the following variables
+---------------------------------------------------------
+${DUNDIDIALARGS}   Settings this variable allows you to provide options to be
+                   passed to the Dial application for calls being placed using
+                  the DUNDi switch.
+
 The Zaptel channel sets the following variables:
 ---------------------------------------------------------
 ${ANI2}                        * The ANI2 Code provided by the network on the incoming call. 
index dba8607..e947e56 100644 (file)
@@ -4276,6 +4276,7 @@ static int dundi_exec(struct ast_channel *chan, const char *context, const char
        int res;
        int x=0;
        char req[1024];
+       const char *dundiargs;
        struct ast_app *dial;
        
        if (!strncasecmp(context, "macro-", 6)) {
@@ -4313,7 +4314,9 @@ static int dundi_exec(struct ast_channel *chan, const char *context, const char
        }
        if (x < res) {
                /* Got a hit! */
-               snprintf(req, sizeof(req), "%s/%s", results[x].tech, results[x].dest);
+               dundiargs = pbx_builtin_getvar_helper(chan, "DUNDIDIALARGS");
+               snprintf(req, sizeof(req), "%s/%s||%s", results[x].tech, results[x].dest, 
+                       S_OR(dundiargs, ""));
                dial = pbx_findapp("Dial");
                if (dial)
                        res = pbx_exec(chan, dial, req);