summaryrefslogtreecommitdiff
path: root/apps/app_macro.c
diff options
context:
space:
mode:
authorSteve Murphy <murf@digium.com>2006-08-17 15:48:49 +0000
committerSteve Murphy <murf@digium.com>2006-08-17 15:48:49 +0000
commit8078aea52b98402c33099c52636caf248df42b1a (patch)
tree3d7fd933284aa93ba11f3a85157adc33073bf64a /apps/app_macro.c
parentbd43525f3f23378e1c81a66bffa3179c42772321 (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.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@40200 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'apps/app_macro.c')
-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 ed496e312..13db5ce8a 100644
--- a/apps/app_macro.c
+++ b/apps/app_macro.c
@@ -112,7 +112,7 @@ static int _macro_exec(struct ast_channel *chan, void *data, int exclusive)
int oldpriority;
char pc[80], depthc[12];
char oldcontext[AST_MAX_CONTEXT] = "";
- int offset, depth = 0;
+ int offset, depth = 0, maxdepth = 7;
int setmacrocontext=0;
int autoloopflag, dead = 0;
@@ -129,11 +129,16 @@ static int _macro_exec(struct ast_channel *chan, void *data, int exclusive)
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 */
s = pbx_builtin_getvar_helper(chan, "MACRO_DEPTH");
if (s)
sscanf(s, "%d", &depth);
- if (depth >= 20) {
+ if (depth >= maxdepth) {
ast_log(LOG_ERROR, "Macro(): possible infinite loop detected. Returning early.\n");
LOCAL_USER_REMOVE(u);
return 0;