mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-12 15:45:18 +00:00
Make sure ExecIf stuff returns properly (bug #3864)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@5297 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -37,7 +37,7 @@ static char *exec_descrip =
|
||||
"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 @@ static int exec_exec(struct ast_channel *chan, void *data)
|
||||
res = pbx_exec(chan, app, args, 1);
|
||||
} else {
|
||||
ast_log(LOG_WARNING, "Could not find application (%s)\n", appname);
|
||||
res = -2;
|
||||
res = -1;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
@@ -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 @@ static int execif_exec(struct ast_channel *chan, void *data) {
|
||||
} 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");
|
||||
|
Reference in New Issue
Block a user