[Asterisk-cvs] asterisk/res res_monitor.c,1.5,1.6

jeremy at lists.digium.com jeremy at lists.digium.com
Sun Jan 11 00:06:24 CST 2004


Update of /usr/cvsroot/asterisk/res
In directory mongoose.digium.com:/tmp/cvs-serv24145

Modified Files:
	res_monitor.c 
Log Message:
use a default file name for res_monitor, if none was given. Bug #704


Index: res_monitor.c
===================================================================
RCS file: /usr/cvsroot/asterisk/res/res_monitor.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- res_monitor.c	10 Sep 2003 05:24:49 -0000	1.5
+++ res_monitor.c	11 Jan 2004 05:58:10 -0000	1.6
@@ -283,6 +283,8 @@
 	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 @@
 		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");




More information about the svn-commits mailing list