Fix an issue with PLAYBACKSTATUS not being set under certain circumstances.

Fix a minor issue, to make it use the filenames that were parsed, instead of the entire argument string.
Fix Background() to return -1 like Playback(), if no args are specified.


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@43803 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Jason Parker
2006-09-27 19:44:02 +00:00
parent a65a888802
commit 482c18499e
2 changed files with 7 additions and 4 deletions

View File

@@ -380,6 +380,7 @@ static struct ast_cli_entry cli_playback[] = {
static int playback_exec(struct ast_channel *chan, void *data) static int playback_exec(struct ast_channel *chan, void *data)
{ {
int res = 0; int res = 0;
int mres = 0;
struct ast_module_user *u; struct ast_module_user *u;
char *tmp; char *tmp;
int option_skip=0; int option_skip=0;
@@ -422,11 +423,11 @@ static int playback_exec(struct ast_channel *chan, void *data)
res = ast_answer(chan); res = ast_answer(chan);
} }
if (!res) { if (!res) {
int mres = 0; char *back = args.filenames;
char *front; char *front;
ast_stopstream(chan); ast_stopstream(chan);
while (!res && (front = strsep(&tmp, "&"))) { while (!res && (front = strsep(&back, "&"))) {
if (option_say) if (option_say)
res = say_full(chan, front, "", chan->language, NULL, -1, -1); res = say_full(chan, front, "", chan->language, NULL, -1, -1);
else else
@@ -442,9 +443,9 @@ static int playback_exec(struct ast_channel *chan, void *data)
mres = 1; mres = 1;
} }
} }
pbx_builtin_setvar_helper(chan, "PLAYBACKSTATUS", mres ? "FAILED" : "SUCCESS");
} }
done: done:
pbx_builtin_setvar_helper(chan, "PLAYBACKSTATUS", mres ? "FAILED" : "SUCCESS");
ast_module_user_remove(u); ast_module_user_remove(u);
return res; return res;
} }

View File

@@ -5591,8 +5591,10 @@ static int pbx_builtin_background(struct ast_channel *chan, void *data)
AST_APP_ARG(context); AST_APP_ARG(context);
); );
if (ast_strlen_zero(data)) if (ast_strlen_zero(data)) {
ast_log(LOG_WARNING, "Background requires an argument (filename)\n"); ast_log(LOG_WARNING, "Background requires an argument (filename)\n");
return -1;
}
parse = ast_strdupa(data); parse = ast_strdupa(data);