]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
In app_macro, changed the previously changed upper recursion depth limit to a variabl...
authorSteve Murphy <murf@digium.com>
Thu, 17 Aug 2006 16:07:21 +0000 (16:07 +0000)
committerSteve Murphy <murf@digium.com>
Thu, 17 Aug 2006 16:07:21 +0000 (16:07 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.2@40220 65c4cc65-6c06-0410-ace0-fbb531ad65f3

apps/app_macro.c

index 4fb3360257c4190cb2b8aa15881763f86f24ba26..43f11c6d20bf46572d9fec467092a69e07e9b4bb 100644 (file)
@@ -102,7 +102,7 @@ static int macro_exec(struct ast_channel *chan, void *data)
        char pc[80], depthc[12];
        char oldcontext[AST_MAX_CONTEXT] = "";
        char *offsets;
-       int offset, depth;
+       int offset, depth = 0, maxdepth = 7;
        int setmacrocontext=0;
        int autoloopflag, dead = 0;
   
@@ -119,6 +119,11 @@ static int macro_exec(struct ast_channel *chan, void *data)
 
        LOCAL_USER_ADD(u);
 
+       /* does the user want a deeper rabbit hole? */
+       s = pbx_builtin_getvar_helper(chan, "MACRO_RECURSION");
+       if (s)
+               sscanf(s, "%d", &maxdepth);
+
        /* Count how many levels deep the rabbit hole goes */
        tmp = pbx_builtin_getvar_helper(chan, "MACRO_DEPTH");
        if (tmp) {
@@ -127,7 +132,7 @@ static int macro_exec(struct ast_channel *chan, void *data)
                depth = 0;
        }
 
-       if (depth >= 20) {
+       if (depth >= maxdepth) {
                ast_log(LOG_ERROR, "Macro():  possible infinite loop detected.  Returning early.\n");
                LOCAL_USER_REMOVE(u);
                return 0;