summaryrefslogtreecommitdiff
path: root/res/ari/resource_bridges.c
diff options
context:
space:
mode:
authorJonathan Rose <jrose@digium.com>2013-10-25 22:01:43 +0000
committerJonathan Rose <jrose@digium.com>2013-10-25 22:01:43 +0000
commit5c696bde67411848e4bbbc2cc18c2f881a0a7ead (patch)
tree48cb93ea327e770c325918b84d21c78352dd2981 /res/ari/resource_bridges.c
parentd8a760307e43031033b5607264f7edd8ecfe73a4 (diff)
ARI: channel/bridge recording errors when invalid format specified
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/ ........ Merged revisions 402001 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@402002 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'res/ari/resource_bridges.c')
-rw-r--r--res/ari/resource_bridges.c21
1 files changed, 21 insertions, 0 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) {