[asterisk-commits] jpeeler: branch 1.4 r248757 - /branches/1.4/res/res_monitor.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Thu Feb 25 12:06:57 CST 2010
Author: jpeeler
Date: Thu Feb 25 12:06:54 2010
New Revision: 248757
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=248757
Log:
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
Modified:
branches/1.4/res/res_monitor.c
Modified: branches/1.4/res/res_monitor.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.4/res/res_monitor.c?view=diff&rev=248757&r1=248756&r2=248757
==============================================================================
--- branches/1.4/res/res_monitor.c (original)
+++ branches/1.4/res/res_monitor.c Thu Feb 25 12:06:54 2010
@@ -157,20 +157,20 @@
/* 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",
More information about the asterisk-commits
mailing list