Index: app_system.c =================================================================== RCS file: /usr/cvsroot/asterisk/apps/app_system.c,v retrieving revision 1.6 diff -u -r1.6 app_system.c --- app_system.c 19 Oct 2003 11:06:59 -0000 1.6 +++ app_system.c 11 Jan 2004 15:10:57 -0000 @@ -36,7 +36,12 @@ "failure to execute the specified command. If the command itself executes\n" "but is in error, and if there exists a priority n + 101, where 'n' is the\n" "priority of the current instance, then the channel will be setup to\n" -"continue at that priority level. Otherwise, System returns 0.\n"; +"continue at that priority level. Otherwise, System returns 0.\n" +"\n" +"One optional argument can be given; if the command ends with |0, then a 0\n" +"return status will be given, no matter what the results of the command execution, and\n" +"the normal progression to next priority will not be affected."; + STANDARD_LOCAL_USER; @@ -45,25 +50,40 @@ static int system_exec(struct ast_channel *chan, void *data) { int res=0; + int check_results = 1; + char *p = data; + struct localuser *u; if (!data) { ast_log(LOG_WARNING, "System requires an argument(command)\n"); return -1; } + if( p[strlen(data)-1] == '0' && p[strlen(data)-2] == '|' ) + { + check_results = 0; + p[strlen(data)-2] = 0; + } + LOCAL_USER_ADD(u); /* Do our thing here */ res = system((char *)data); - if (res < 0) { - ast_log(LOG_WARNING, "Unable to execute '%s'\n", (char *)data); - res = -1; - } else if (res == 127) { - ast_log(LOG_WARNING, "Unable to execute '%s'\n", (char *)data); - res = -1; - } else { - if (res && ast_exists_extension(chan, chan->context, chan->exten, chan->priority + 101, chan->callerid)) - chan->priority+=100; - res = 0; + if( check_results ) + { + if (res < 0) { + ast_log(LOG_WARNING, "Unable to execute '%s'\n", (char *)data); + res = -1; + } else if (res == 127) { + ast_log(LOG_WARNING, "Unable to execute '%s'\n", (char *)data); + res = -1; + } else { + if (res && ast_exists_extension(chan, chan->context, chan->exten, chan->priority + 101, chan->callerid)) + chan->priority+=100; + res = 0; + } } + else + res = 0; + LOCAL_USER_REMOVE(u); return res; }