diff options
author | markster <markster@f38db490-d61c-443f-a65b-d21fe96a405b> | 2005-01-10 04:29:33 +0000 |
---|---|---|
committer | markster <markster@f38db490-d61c-443f-a65b-d21fe96a405b> | 2005-01-10 04:29:33 +0000 |
commit | 1e9da76cb752f62fba811dae22c043e178c646eb (patch) | |
tree | 900297b03659a874c5661e3bf9f601e3c7577b1d | |
parent | 0b389a5a94c40f2d846d6f0040a4836b7e615ffe (diff) |
Merge anthm's monitor fixes (better default path, set variable for monitor) (bug #3266)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@4745 f38db490-d61c-443f-a65b-d21fe96a405b
-rwxr-xr-x | doc/README.variables | 3 | ||||
-rwxr-xr-x | res/res_monitor.c | 19 |
2 files changed, 15 insertions, 7 deletions
diff --git a/doc/README.variables b/doc/README.variables index 8ba423bbc..4cf42451b 100755 --- a/doc/README.variables +++ b/doc/README.variables @@ -104,6 +104,9 @@ ${QUEUE_PRIO} Queue priority The following variables can be set to change certian behaviour: ${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. 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, diff --git a/res/res_monitor.c b/res/res_monitor.c index 0603ad9f5..4c93517db 100755 --- a/res/res_monitor.c +++ b/res/res_monitor.c @@ -122,14 +122,17 @@ int ast_monitor_start( struct ast_channel *chan, const char *format_spec, seq++; ast_mutex_unlock(&monitorlock); - channel_name = strdup(chan->name); - while((p = strchr(channel_name, '/'))) { - *p = '-'; + if((channel_name = ast_strdupa(chan->name))) { + while((p = strchr(channel_name, '/'))) { + *p = '-'; + } + snprintf(monitor->filename_base, FILENAME_MAX, "%s/%ld-%s", + AST_MONITOR_DIR, time(NULL),channel_name); + monitor->filename_changed = 1; + } else { + ast_log(LOG_ERROR,"Failed to allocate Memory\n"); + return -1; } - snprintf(monitor->filename_base, FILENAME_MAX, "%s/%s", - AST_MONITOR_DIR, channel_name); - monitor->filename_changed = 1; - free(channel_name); } monitor->stop = ast_monitor_stop; @@ -168,6 +171,8 @@ int ast_monitor_start( struct ast_channel *chan, const char *format_spec, return -1; } 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 { ast_log(LOG_DEBUG,"Cannot start monitoring %s, already monitored\n", chan->name); |