aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormurf <murf@f38db490-d61c-443f-a65b-d21fe96a405b>2006-08-17 16:07:21 +0000
committermurf <murf@f38db490-d61c-443f-a65b-d21fe96a405b>2006-08-17 16:07:21 +0000
commitb0bb261c55f5d8ce95bf36f03adbc3c5a0882533 (patch)
tree3d39ce424ec869900e1887fd5ba69a2b5069fe12
parent3d2c202d6356b29e2bf4fa43afb4a9aad6f64b27 (diff)
In app_macro, changed the previously changed upper recursion depth limit to a variable, default of the original val of 7. MACRO_RECURSION is a channel variable that will override the limit, but until I can understand and fix why this limit is neccessary, I am not advertising this variable in the docs. This fix mirrors the changes made in r40200 in trunk.
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.2@40220 f38db490-d61c-443f-a65b-d21fe96a405b
-rw-r--r--apps/app_macro.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/apps/app_macro.c b/apps/app_macro.c
index 4fb336025..43f11c6d2 100644
--- a/apps/app_macro.c
+++ b/apps/app_macro.c
@@ -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;