mirror of
https://github.com/asterisk/asterisk.git
synced 2026-07-22 22:44:58 -07:00
Ensure that monitor recordings are written to the correct location (again)
This is an extension to 248757. As such the dialplan test has been extended: 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) exten => 5043, 1, monitor(wav,tmp/jeff/monitor_test3,m) exten => 5043, n, changemonitor(monitor_test4) exten => 5043, n, dial(sip/5001) exten => 5044, 1, monitor(wav,monitor_test4,m) exten => 5044, n, changemonitor(tmp/jeff/monitor_test5) ; this looks to fail by design and emits a warning exten => 5044, n, dial(sip/5001) git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@248860 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
+3
-3
@@ -377,12 +377,12 @@ int ast_monitor_change_fname(struct ast_channel *chan, const char *fname_base, i
|
||||
|
||||
if (chan->monitor) {
|
||||
int directory = strchr(fname_base, '/') ? 1 : 0;
|
||||
const char *absolute = *fname_base == '/' ? "" : "/";
|
||||
const char *absolute = *fname_base == '/' ? "" : ast_config_AST_MONITOR_DIR;
|
||||
char tmpstring[sizeof(chan->monitor->filename_base)] = "";
|
||||
int i, fd[2] = { -1, -1 }, doexit = 0;
|
||||
|
||||
/* before continuing, see if we're trying to rename the file to itself... */
|
||||
snprintf(tmpstring, sizeof(tmpstring), "%s%s%s", directory ? "" : ast_config_AST_MONITOR_DIR, absolute, fname_base);
|
||||
snprintf(tmpstring, sizeof(tmpstring), "%s/%s", absolute, fname_base);
|
||||
|
||||
/*!\note We cannot just compare filenames, due to symlinks, relative
|
||||
* paths, and other possible filesystem issues. We could use
|
||||
@@ -427,7 +427,7 @@ int ast_monitor_change_fname(struct ast_channel *chan, const char *fname_base, i
|
||||
/* 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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user