From: Jeff Peeler Date: Thu, 25 Feb 2010 18:06:54 +0000 (+0000) Subject: Ensure that monitor recordings are written to the correct location. X-Git-Tag: 1.4.30-rc3~19 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3371a165f5ef13e54dd87242a4af027577ea5ca9;p=thirdparty%2Fasterisk.git Ensure that monitor recordings are written to the correct location. Recordings should be placed in the monitor directory when a non-absolute path is used. Exact dialplan used for testing: exten => 5040, 1, monitor(wav,tmp/jeff/monitor_test,b) exten => 5040, n, dial(sip/5001) exten => 5041, 1, monitor(wav,/tmp/jeff/monitor_test2,b) exten => 5041, n, dial(sip/5001) exten => 5042, 1, monitor(wav,monitor_test3,b) exten => 5042, n, dial(sip/5001) ABE-2101 git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@248757 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/res/res_monitor.c b/res/res_monitor.c index 30aa8105a2..f5e0911f75 100644 --- a/res/res_monitor.c +++ b/res/res_monitor.c @@ -157,20 +157,20 @@ int ast_monitor_start( struct ast_channel *chan, const char *format_spec, /* Determine file names */ if (!ast_strlen_zero(fname_base)) { int directory = strchr(fname_base, '/') ? 1 : 0; - const char *absolute = *fname_base == '/' ? "" : "/"; + const char *absolute = *fname_base == '/' ? "" : ast_config_AST_MONITOR_DIR; /* try creating the directory just in case it doesn't exist */ if (directory) { char *name = strdup(fname_base); - snprintf(tmp, sizeof(tmp), "mkdir -p \"%s\"",dirname(name)); + snprintf(tmp, sizeof(tmp), "mkdir -p \"%s/%s\"", absolute, dirname(name)); free(name); ast_safe_system(tmp); } - snprintf(monitor->read_filename, FILENAME_MAX, "%s%s%s-in", - directory ? "" : ast_config_AST_MONITOR_DIR, absolute, fname_base); - snprintf(monitor->write_filename, FILENAME_MAX, "%s%s%s-out", - directory ? "" : ast_config_AST_MONITOR_DIR, absolute, fname_base); - snprintf(monitor->filename_base, FILENAME_MAX, "%s%s%s", - directory ? "" : ast_config_AST_MONITOR_DIR, absolute, fname_base); + snprintf(monitor->read_filename, FILENAME_MAX, "%s/%s-in", + absolute, fname_base); + snprintf(monitor->write_filename, FILENAME_MAX, "%s/%s-out", + absolute, fname_base); + snprintf(monitor->filename_base, FILENAME_MAX, "%s/%s", + absolute, fname_base); } else { ast_mutex_lock(&monitorlock); snprintf(monitor->read_filename, FILENAME_MAX, "%s/audio-in-%ld",