[Asterisk-cvs] asterisk/apps app_exec.c, 1.2, 1.3 app_while.c, 1.4, 1.5

markster at lists.digium.com markster at lists.digium.com
Tue Mar 29 00:25:18 CST 2005


Update of /usr/cvsroot/asterisk/apps
In directory mongoose.digium.com:/tmp/cvs-serv7485/apps

Modified Files:
	app_exec.c app_while.c 
Log Message:
Make sure ExecIf stuff returns properly (bug #3864)


Index: app_exec.c
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/app_exec.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- app_exec.c	21 Jan 2005 07:06:24 -0000	1.2
+++ app_exec.c	29 Mar 2005 06:18:58 -0000	1.3
@@ -37,7 +37,7 @@
 "Exec(appname(arguments))\n"
 "  Allows an arbitrary application to be invoked even when not\n"
 "hardcoded into the dialplan.  Returns whatever value the\n"
-"app returns or -2 when the app cannot be found.\n";
+"app returns or a non-zero value when the app cannot be found.\n";
 
 STANDARD_LOCAL_USER;
 
@@ -71,7 +71,7 @@
 					res = pbx_exec(chan, app, args, 1);
 				} else {
 					ast_log(LOG_WARNING, "Could not find application (%s)\n", appname);
-					res = -2;
+					res = -1;
 				}
 			}
 		} else {

Index: app_while.c
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/app_while.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- app_while.c	30 Jan 2005 18:39:35 -0000	1.4
+++ app_while.c	29 Mar 2005 06:18:58 -0000	1.5
@@ -29,7 +29,9 @@
 
 static char *exec_app = "ExecIf";
 static char *exec_desc = "  ExecIF (<expr>|<app>|<data>)\n"
-"If <expr> is true, execute and return the result of <app>(<data>)\n\n";
+"If <expr> is true, execute and return the result of <app>(<data>).\n"
+"If <expr> is true, but <app> is not found, then the application\n"
+"will return a non-zero value.";
 static char *exec_synopsis = "ExecIF (<expr>|<app>|<data>)";
 
 static char *start_app = "While";
@@ -73,8 +75,13 @@
 		} else
 			mydata = "";
 
-		if(ast_true(expr) && (app = pbx_findapp(myapp))) {
-			res = pbx_exec(chan, app, mydata, 1);
+		if (ast_true(expr)) { 
+			if ((app = pbx_findapp(myapp))) {
+				res = pbx_exec(chan, app, mydata, 1);
+			} else {
+				ast_log(LOG_WARNING, "Count not find application! (%s)\n", myapp);
+				res = -1;
+			}
 		}
 	} else {
 		ast_log(LOG_ERROR,"Invalid Syntax.\n");




More information about the svn-commits mailing list