[svn-commits] tzafrir: branch tzafrir/monitor-rtp r222220 - in /team/tzafrir/monitor-rtp: c...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Tue Oct 6 05:41:00 CDT 2009


Author: tzafrir
Date: Tue Oct  6 05:40:58 2009
New Revision: 222220

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=222220
Log:
Support reload. Well, of the non-important stuff.

Support reloading configuration. However only rtp_mon_start and
rtp_mon_end can be changed on reload. Which means we cannot
enable/diable rtp monitoring on reload yet.

Modified:
    team/tzafrir/monitor-rtp/configs/monitor.conf.sample
    team/tzafrir/monitor-rtp/doc/monitor-rtp.txt
    team/tzafrir/monitor-rtp/res/res_monitor.c

Modified: team/tzafrir/monitor-rtp/configs/monitor.conf.sample
URL: http://svnview.digium.com/svn/asterisk/team/tzafrir/monitor-rtp/configs/monitor.conf.sample?view=diff&rev=222220&r1=222219&r2=222220
==============================================================================
--- team/tzafrir/monitor-rtp/configs/monitor.conf.sample (original)
+++ team/tzafrir/monitor-rtp/configs/monitor.conf.sample Tue Oct  6 05:40:58 2009
@@ -9,14 +9,19 @@
 ;
 [general]
 ; 
-; The following two values are required for RTP monitoring:
-; Recording server: hostname (FIXME: also support IP address) for the target
-; recording server.
+; If the following is set, recorded audio is sent as RTP streams to a
+; remote server rather than saving it to local files. The file name /
+; pattern parameter of Monitor is likewise ignored.
+; The parameter is the hostname (FIXME: also support IP addresses) of
+; the server to which we send the streams.
+; This value can not be changed on reload.
 ;rtp_server = newton
 ;
 ; My local host name. Use it to override the system default, if needed.
 ; This should be the name of the IP address from which the packets are
 ; sent.
+; As with rtp_server, it can't be an IP address and can't change on
+; reload.
 ;reporting_host  = myhostname
 
 ; The rang of RTP ports to use. Similar to rtpstart and rtpend in rtp.conf .

Modified: team/tzafrir/monitor-rtp/doc/monitor-rtp.txt
URL: http://svnview.digium.com/svn/asterisk/team/tzafrir/monitor-rtp/doc/monitor-rtp.txt?view=diff&rev=222220&r1=222219&r2=222220
==============================================================================
--- team/tzafrir/monitor-rtp/doc/monitor-rtp.txt (original)
+++ team/tzafrir/monitor-rtp/doc/monitor-rtp.txt Tue Oct  6 05:40:58 2009
@@ -73,12 +73,12 @@
 
  [rtp-monitor]
  exten => genrec,1,Answer
- exten => genrec,n,Set(AUTO_MONITOR=wav)
+ exten => genrec,n,Monitor(wav,,b)
  exten => genrec,n,Dial(Local/answer-rec at rtp-monitor/n)
  exten => genrec,n,Hangup
 
  exten => answer-rec,1,Answer
- exten => answer-rec,n,Set(AUTO_MONITOR=wav)
+ exten => answer-rec,n,Monitor(wav,,b)
  exten => answer-rec,n,Playback(demo-thanks)
  exten => answer-rec,n,Hangup
      
@@ -92,11 +92,11 @@
 ----
 Many. Did I mention work in progress?
 
-* It takes restarting Asterisk or so to re-read monitor.conf .
-* Starting a monitoring with Monitor() can crash Asterisk. Didn't look
-  into it yet.
+* We can't change the monitor host (and hence enable/disable monitoring)
+  on reload.
 * In a normal Hangup, the channel's CDR gets destroyed before the
   channel's monitors are destroyed. Which means that the CDR data is not
   availalable when we send the BYE. This was not the case in 1.4 .
   There is an ugly and very partial workaround in the code for that.
+* Support IP addresses for rtp_server and reporting_host
 

Modified: team/tzafrir/monitor-rtp/res/res_monitor.c
URL: http://svnview.digium.com/svn/asterisk/team/tzafrir/monitor-rtp/res/res_monitor.c?view=diff&rev=222220&r1=222219&r2=222220
==============================================================================
--- team/tzafrir/monitor-rtp/res/res_monitor.c (original)
+++ team/tzafrir/monitor-rtp/res/res_monitor.c Tue Oct  6 05:40:58 2009
@@ -1256,7 +1256,7 @@
 	return do_pause_or_unpause(s, m, MONITOR_ACTION_UNPAUSE);
 }
 
-static int reload_config(enum channelreloadreason reason)
+static int reload_config(enum channelreloadreason reason, int startup)
 {
 	struct ast_config *cfg;
 	struct ast_variable *v;
@@ -1270,7 +1270,9 @@
 				config_file);
 		return 0;
 	}
-	rtp_server_name[0] = '\0';
+	if (startup) {
+		rtp_server_name[0] = '\0';
+	}
 	for (v = ast_variable_browse(cfg, "general"); v; v = v->next) {
 		if (!strcasecmp(v->name, "rtp_server")) {
 			ast_copy_string(rtp_server_name, v->value, sizeof(rtp_server_name));
@@ -1298,13 +1300,14 @@
 			} else {
 				rtp_mon_end = port_value;
 			}
-		} else if (!strcasecmp(v->name, "reporting_host")) {
+		} else if (startup && !strcasecmp(v->name, "reporting_host")) {
 			ast_copy_string(reporting_host, v->value, sizeof(reporting_host));
 		} else {
+			/* FIXME: what about valid config options on reload? */
 			ast_log(LOG_NOTICE, "%s:%d: Bad config option '%s' - (ignoring)\n",
 					config_file, v->lineno, v->name);
 		}
-		if (rtp_server_name[0] && !reporting_host[0]) {
+		if (startup && rtp_server_name[0] && !reporting_host[0]) {
 			gethostname(reporting_host, sizeof(reporting_host) - 1);
 			
 		}
@@ -1316,9 +1319,15 @@
 	return 0;
 }
 
+static int reload_module(void)
+{
+	reload_config(CHANNEL_MODULE_LOAD, 0);
+	return 0;
+}
+
 static int load_module(void)
 {
-	if (reload_config(CHANNEL_MODULE_LOAD))
+	if (reload_config(CHANNEL_MODULE_LOAD, 1))
 		return AST_MODULE_LOAD_DECLINE;
 	if (rtp_server_name[0] != '\0') {
 		if ((sip_socket = sip_stream(rtp_server_name, 5060, &sip_server_addr)) < 0) {
@@ -1363,4 +1372,5 @@
 AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_GLOBAL_SYMBOLS, "Call Monitoring Resource",
 		.load = load_module,
 		.unload = unload_module,
+		.reload = reload_module,
 		);




More information about the svn-commits mailing list