aboutsummaryrefslogtreecommitdiffstats
path: root/res/res_monitor.c
diff options
context:
space:
mode:
authorjeremy <jeremy@f38db490-d61c-443f-a65b-d21fe96a405b>2004-01-11 05:58:10 +0000
committerjeremy <jeremy@f38db490-d61c-443f-a65b-d21fe96a405b>2004-01-11 05:58:10 +0000
commite2093074c78cc9985dc2d0fc3d75a169cc1cb5c5 (patch)
treebb33645656e697c8abda84c0086a63713244a61d /res/res_monitor.c
parentd6b767d195f928b97241f349db0e2772dbf4abac (diff)
use a default file name for res_monitor, if none was given. Bug #704
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@1930 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'res/res_monitor.c')
-rwxr-xr-xres/res_monitor.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/res/res_monitor.c b/res/res_monitor.c
index 38f737bc6..7cf22e812 100755
--- a/res/res_monitor.c
+++ b/res/res_monitor.c
@@ -283,6 +283,8 @@ static int start_monitor_action(struct mansession *s, struct message *m)
char *name = astman_get_header(m, "Channel");
char *fname = astman_get_header(m, "File");
char *format = astman_get_header(m, "Format");
+ char *d;
+
if((!name)||(!strlen(name))) {
astman_send_error(s, m, "No channel specified");
return 0;
@@ -298,6 +300,16 @@ static int start_monitor_action(struct mansession *s, struct message *m)
astman_send_error(s, m, "No such channel");
return 0;
}
+
+ if( (!fname) || (!strlen(fname)) ) {
+ // No filename base specified, default to channel name as per CLI
+ fname = malloc (FILENAME_MAX);
+ memset( fname, 0, FILENAME_MAX);
+ strncpy( fname, c->name, FILENAME_MAX-1);
+ // Channels have the format technology/channel_name - have to replace that /
+ if( (d=strchr( fname, '/')) ) *d='-';
+ }
+
if( ast_monitor_start( c, format, fname, 1 ) ) {
if( ast_monitor_change_fname( c, fname, 1 ) ) {
astman_send_error(s, m, "Could not start monitoring channel");