diff options
-rw-r--r-- | res/ari/resource_bridges.c | 21 | ||||
-rw-r--r-- | res/ari/resource_channels.c | 7 | ||||
-rw-r--r-- | res/res_ari_bridges.c | 1 | ||||
-rw-r--r-- | res/res_ari_channels.c | 1 | ||||
-rw-r--r-- | rest-api/api-docs/bridges.json | 6 | ||||
-rw-r--r-- | rest-api/api-docs/channels.json | 4 |
6 files changed, 39 insertions, 1 deletions
diff --git a/res/ari/resource_bridges.c b/res/ari/resource_bridges.c index a036ce0f3..919171139 100644 --- a/res/ari/resource_bridges.c +++ b/res/ari/resource_bridges.c @@ -439,6 +439,27 @@ void ast_ari_record_bridge(struct ast_variable *headers, struct ast_record_bridg stasis_app_recording_if_exists_parse(args->if_exists); options->beep = args->beep; + if (options->terminate_on == STASIS_APP_RECORDING_TERMINATE_INVALID) { + ast_ari_response_error( + response, 400, "Bad Request", + "terminateOn invalid"); + return; + } + + if (options->if_exists == -1) { + ast_ari_response_error( + response, 400, "Bad Request", + "ifExists invalid"); + return; + } + + if (!ast_get_format_for_file_ext(options->format)) { + ast_ari_response_error( + response, 422, "Unprocessable Entity", + "specified format is unknown on this system"); + return; + } + recording = stasis_app_control_record(control, options); if (recording == NULL) { switch(errno) { diff --git a/res/ari/resource_channels.c b/res/ari/resource_channels.c index b8d59d38b..f1a9217af 100644 --- a/res/ari/resource_channels.c +++ b/res/ari/resource_channels.c @@ -407,6 +407,13 @@ void ast_ari_record_channel(struct ast_variable *headers, return; } + if (!ast_get_format_for_file_ext(options->format)) { + ast_ari_response_error( + response, 422, "Unprocessable Entity", + "specified format is unknown on this system"); + return; + } + recording = stasis_app_control_record(control, options); if (recording == NULL) { switch(errno) { diff --git a/res/res_ari_bridges.c b/res/res_ari_bridges.c index f6a3c1c1a..d34505e2b 100644 --- a/res/res_ari_bridges.c +++ b/res/res_ari_bridges.c @@ -745,6 +745,7 @@ static void ast_ari_record_bridge_cb( case 400: /* Invalid parameters */ case 404: /* Bridge not found */ case 409: /* Bridge is not in a Stasis application; A recording with the same name already exists on the system and can not be overwritten because it is in progress or ifExists=fail */ + case 422: /* The format specified is unknown on this system */ is_valid = 1; break; default: diff --git a/res/res_ari_channels.c b/res/res_ari_channels.c index 8ff4c065c..79aa88492 100644 --- a/res/res_ari_channels.c +++ b/res/res_ari_channels.c @@ -993,6 +993,7 @@ static void ast_ari_record_channel_cb( case 400: /* Invalid parameters */ case 404: /* Channel not found */ case 409: /* Channel is not in a Stasis application; the channel is currently bridged with other hcannels; A recording with the same name already exists on the system and can not be overwritten because it is in progress or ifExists=fail */ + case 422: /* The format specified is unknown on this system */ is_valid = 1; break; default: diff --git a/rest-api/api-docs/bridges.json b/rest-api/api-docs/bridges.json index 187522826..3174eaaa3 100644 --- a/rest-api/api-docs/bridges.json +++ b/rest-api/api-docs/bridges.json @@ -466,7 +466,11 @@ { "code": 409, "reason": "Bridge is not in a Stasis application; A recording with the same name already exists on the system and can not be overwritten because it is in progress or ifExists=fail" - } + }, + { + "code": 422, + "reason": "The format specified is unknown on this system" + } ] } ] diff --git a/rest-api/api-docs/channels.json b/rest-api/api-docs/channels.json index a9b55873a..39dc4e376 100644 --- a/rest-api/api-docs/channels.json +++ b/rest-api/api-docs/channels.json @@ -721,6 +721,10 @@ { "code": 409, "reason": "Channel is not in a Stasis application; the channel is currently bridged with other hcannels; A recording with the same name already exists on the system and can not be overwritten because it is in progress or ifExists=fail" + }, + { + "code": 422, + "reason": "The format specified is unknown on this system" } ] } |