Asterisk will now issue 422 if recording is requested against channels
or bridges with an unknown format
(closes issue ASTERISK-22626)
Reported by: Joshua Colp
Review: https://reviewboard.asterisk.org/r/2939/
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/12@402001
65c4cc65-6c06-0410-ace0-
fbb531ad65f3
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) {
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) {
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:
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:
{
"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"
+ }
]
}
]
{
"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"
}
]
}