diff options
author | Richard Mudgett <rmudgett@digium.com> | 2013-10-16 21:22:25 +0000 |
---|---|---|
committer | Richard Mudgett <rmudgett@digium.com> | 2013-10-16 21:22:25 +0000 |
commit | 868a76f897595c988225014e1c70a1ce1dafcc4b (patch) | |
tree | c16fb01fdf32bdc6dade600a6b5aa3ab47c4783f | |
parent | 3ce661a751147d2ce1adbbd1d2e6a7bc645fae9a (diff) |
ARI: Fix crash when POST /playback/{id}/control does not have an operation parameter.
(closes issue ASTERISK-22680)
Reported by: John Bigelow
........
Merged revisions 401107 from http://svn.asterisk.org/svn/asterisk/branches/12
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@401108 65c4cc65-6c06-0410-ace0-fbb531ad65f3
-rw-r--r-- | res/ari/resource_playback.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/res/ari/resource_playback.c b/res/ari/resource_playback.c index 64afe10c1..7cb1d281c 100644 --- a/res/ari/resource_playback.c +++ b/res/ari/resource_playback.c @@ -68,7 +68,6 @@ void ast_ari_stop_playback(struct ast_variable *headers, } res = stasis_app_playback_operation(playback, STASIS_PLAYBACK_STOP); - switch (res) { case STASIS_PLAYBACK_OPER_OK: ast_ari_response_no_content(response); @@ -93,6 +92,11 @@ void ast_ari_control_playback(struct ast_variable *headers, enum stasis_app_playback_media_operation oper; enum stasis_playback_oper_results res; + if (!args->operation) { + ast_ari_response_error(response, 400, + "Bad Request", "Missing operation"); + return; + } if (strcmp(args->operation, "unpause") == 0) { oper = STASIS_PLAYBACK_UNPAUSE; } else if (strcmp(args->operation, "pause") == 0) { @@ -108,7 +112,6 @@ void ast_ari_control_playback(struct ast_variable *headers, "Bad Request", "Invalid operation %s", args->operation); return; - } playback = stasis_app_playback_find_by_id(args->playback_id); @@ -119,7 +122,6 @@ void ast_ari_control_playback(struct ast_variable *headers, } res = stasis_app_playback_operation(playback, oper); - switch (res) { case STASIS_PLAYBACK_OPER_OK: ast_ari_response_no_content(response); |