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
This commit is contained in:
parent
3ce661a751
commit
868a76f897
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue