[asterisk-commits] murf: branch 1.2 r40220 - /branches/1.2/apps/app_macro.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Thu Aug 17 09:07:21 MST 2006


Author: murf
Date: Thu Aug 17 11:07:21 2006
New Revision: 40220

URL: http://svn.digium.com/view/asterisk?rev=40220&view=rev
Log:
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.

Modified:
    branches/1.2/apps/app_macro.c

Modified: branches/1.2/apps/app_macro.c
URL: http://svn.digium.com/view/asterisk/branches/1.2/apps/app_macro.c?rev=40220&r1=40219&r2=40220&view=diff
==============================================================================
--- branches/1.2/apps/app_macro.c (original)
+++ branches/1.2/apps/app_macro.c Thu Aug 17 11:07:21 2006
@@ -102,7 +102,7 @@
 	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 @@
 
 	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 @@
 		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;



More information about the asterisk-commits mailing list