Merge anthm's monitor fixes (better default path, set variable for monitor) (bug #3266)

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@4745 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Mark Spencer
2005-01-10 04:29:33 +00:00
parent b629af806e
commit 34ff765820
2 changed files with 15 additions and 7 deletions

View File

@@ -104,6 +104,9 @@ ${QUEUE_PRIO} Queue priority
The following variables can be set to change certian behaviour: The following variables can be set to change certian behaviour:
${TOUCH_MONITOR} The filename base to use with Touch Monitor (auto record) ${TOUCH_MONITOR} The filename base to use with Touch Monitor (auto record)
The monitor application sets the following variable:
${MONITOR} Set to "true" if the channel is/has been monitored.
There are two reference modes - reference by value and reference by name. There are two reference modes - reference by value and reference by name.
To refer to a variable with its name (as an argument to a function that To refer to a variable with its name (as an argument to a function that
requires a variable), just write the name. To refer to the variable's value, requires a variable), just write the name. To refer to the variable's value,

View File

@@ -122,14 +122,17 @@ int ast_monitor_start( struct ast_channel *chan, const char *format_spec,
seq++; seq++;
ast_mutex_unlock(&monitorlock); ast_mutex_unlock(&monitorlock);
channel_name = strdup(chan->name); if((channel_name = ast_strdupa(chan->name))) {
while((p = strchr(channel_name, '/'))) { while((p = strchr(channel_name, '/'))) {
*p = '-'; *p = '-';
} }
snprintf(monitor->filename_base, FILENAME_MAX, "%s/%s", snprintf(monitor->filename_base, FILENAME_MAX, "%s/%ld-%s",
AST_MONITOR_DIR, channel_name); AST_MONITOR_DIR, time(NULL),channel_name);
monitor->filename_changed = 1; monitor->filename_changed = 1;
free(channel_name); } else {
ast_log(LOG_ERROR,"Failed to allocate Memory\n");
return -1;
}
} }
monitor->stop = ast_monitor_stop; monitor->stop = ast_monitor_stop;
@@ -168,6 +171,8 @@ int ast_monitor_start( struct ast_channel *chan, const char *format_spec,
return -1; return -1;
} }
chan->monitor = monitor; chan->monitor = monitor;
/* so we know this call has been monitored in case we need to bill for it or something */
pbx_builtin_setvar_helper(chan, "__MONITORED","true");
} else { } else {
ast_log(LOG_DEBUG,"Cannot start monitoring %s, already monitored\n", ast_log(LOG_DEBUG,"Cannot start monitoring %s, already monitored\n",
chan->name); chan->name);