summaryrefslogtreecommitdiff
path: root/res/res_stasis_recording.c
diff options
context:
space:
mode:
authorJonathan Rose <jrose@digium.com>2013-10-25 21:28:32 +0000
committerJonathan Rose <jrose@digium.com>2013-10-25 21:28:32 +0000
commitd8a760307e43031033b5607264f7edd8ecfe73a4 (patch)
tree782649b82cc96f634615d872044764497caec482 /res/res_stasis_recording.c
parent7b42a6828a1f98862b673f9e1c2b9a5c105231db (diff)
ARI recordings: Issue HTTP failures for recording requests with file conflicts
If a file already exists in the recordings directory with the same name as what we would record, issue a 422 instead of relying on the internal failure and issuing success. (closes issue ASTERISK-22623) Reported by: Joshua Colp Review: https://reviewboard.asterisk.org/r/2922/ ........ Merged revisions 401973 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@401999 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'res/res_stasis_recording.c')
-rw-r--r--res/res_stasis_recording.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/res/res_stasis_recording.c b/res/res_stasis_recording.c
index 49044c443..bd2177a76 100644
--- a/res/res_stasis_recording.c
+++ b/res/res_stasis_recording.c
@@ -348,6 +348,14 @@ struct stasis_app_recording *stasis_app_control_record(
recording->control = control;
recording->state = STASIS_APP_RECORDING_STATE_QUEUED;
+ if ((recording->options->if_exists == AST_RECORD_IF_EXISTS_FAIL) &&
+ (ast_fileexists(recording->absolute_name, NULL, NULL))) {
+ ast_log(LOG_WARNING, "Recording file '%s' already exists and ifExists option is failure.\n",
+ recording->absolute_name);
+ errno = EEXIST;
+ return NULL;
+ }
+
{
RAII_VAR(struct stasis_app_recording *, old_recording, NULL,
ao2_cleanup);