[svn-commits] tzafrir: branch tzafrir/monitor-rtp-14 r222540 - /team/tzafrir/monitor-rtp-14...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Wed Oct 7 12:32:04 CDT 2009


Author: tzafrir
Date: Wed Oct  7 12:32:01 2009
New Revision: 222540

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=222540
Log:
More diff reduction; also get hostname

* Some leftover diff reduction from the (trunk) monitor-rtp branch.
* Also get the default hostname if our hostname was not set explicitly.

Modified:
    team/tzafrir/monitor-rtp-14/res/res_monitor.c

Modified: team/tzafrir/monitor-rtp-14/res/res_monitor.c
URL: http://svnview.digium.com/svn/asterisk/team/tzafrir/monitor-rtp-14/res/res_monitor.c?view=diff&rev=222540&r1=222539&r2=222540
==============================================================================
--- team/tzafrir/monitor-rtp-14/res/res_monitor.c (original)
+++ team/tzafrir/monitor-rtp-14/res/res_monitor.c Wed Oct  7 12:32:01 2009
@@ -78,7 +78,9 @@
 static int rtp_mon_start = 9000;
 /*! Last port for RTP monitoring sessions (set in monitor.conf) */
 static int rtp_mon_end = 9999;
-#define	PCM_FORMAT	"rtpmonitor"
+
+/* FIXME: Should be moved to some header file: */
+#define PCM_FORMAT "rtpmonitor"
 
 /* Simplify backporting */
 #ifndef ast_debug
@@ -1062,7 +1064,7 @@
 {
 	return do_pause_or_unpause(s, m, MONITOR_ACTION_UNPAUSE);
 }
-	
+
 static int reload_config(enum channelreloadreason reason, int startup)
 {
 	struct ast_config *cfg;
@@ -1071,7 +1073,8 @@
 	ast_log(LOG_DEBUG, "%s [%s]\n", channelreloadreason2txt(reason), config_file);
 	cfg = ast_config_load(config_file);
 	if (!cfg) {
-		ast_log(LOG_NOTICE, "Unable to load config %s. No monitoring to RTP\n", config_file);
+		ast_log(LOG_NOTICE, "Unable to load config %s. No monitoring to RTP\n",
+				config_file);
 		return 0;
 	}
 	if (startup) {
@@ -1107,12 +1110,17 @@
 		} 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 (startup && rtp_server_name[0] && !reporting_host[0]) {
+			gethostname(reporting_host, sizeof(reporting_host) - 1);
+			
+		}
 	}
 	/* FIXME: check that rtp_mon_end > rtp_mon_start */
-	ast_log(LOG_DEBUG, "monitor to %s [RX=%d, TX=%d]\n",
+	ast_log(LOG_DEBUG, "monitor to %s [start=%d, end=%d]\n",
 			rtp_server_name, rtp_mon_start, rtp_mon_end);
 	ast_config_destroy(cfg);
 	return 0;
@@ -1132,7 +1140,6 @@
 	if (rtp_server_name[0] != '\0') {
 		if ((sip_socket = sip_stream(rtp_server_name, 5060, &sip_server_addr)) < 0) {
 			ast_log(LOG_WARNING,
-				"Failed to create SIP stream to '%s:%d'\n",
 				rtp_server_name, 5060);
 			return AST_MODULE_LOAD_DECLINE;
 		}




More information about the svn-commits mailing list