[Freeswitch-svn] [commit] r13570 - in freeswitch/branches/brian/trunk: conf/autoload_configs src/mod/applications/mod_cluechoo src/mod/event_handlers/mod_event_socket

FreeSWITCH SVN brian at freeswitch.org
Wed Jun 3 08:05:27 PDT 2009


Author: brian
Date: Wed Jun  3 10:05:27 2009
New Revision: 13570

Log:
 trunk 

Modified:
   freeswitch/branches/brian/trunk/conf/autoload_configs/event_socket.conf.xml
   freeswitch/branches/brian/trunk/src/mod/applications/mod_cluechoo/mod_cluechoo.c
   freeswitch/branches/brian/trunk/src/mod/event_handlers/mod_event_socket/mod_event_socket.c

Modified: freeswitch/branches/brian/trunk/conf/autoload_configs/event_socket.conf.xml
==============================================================================
--- freeswitch/branches/brian/trunk/conf/autoload_configs/event_socket.conf.xml	(original)
+++ freeswitch/branches/brian/trunk/conf/autoload_configs/event_socket.conf.xml	Wed Jun  3 10:05:27 2009
@@ -1,5 +1,6 @@
 <configuration name="event_socket.conf" description="Socket Client">
   <settings>
+    <param name="nat-map" value="false"/>
     <param name="listen-ip" value="127.0.0.1"/>
     <param name="listen-port" value="8021"/>
     <param name="password" value="ClueCon"/>

Modified: freeswitch/branches/brian/trunk/src/mod/applications/mod_cluechoo/mod_cluechoo.c
==============================================================================
--- freeswitch/branches/brian/trunk/src/mod/applications/mod_cluechoo/mod_cluechoo.c	(original)
+++ freeswitch/branches/brian/trunk/src/mod/applications/mod_cluechoo/mod_cluechoo.c	Wed Jun  3 10:05:27 2009
@@ -42,10 +42,10 @@
  */
 SWITCH_MODULE_DEFINITION(mod_cluechoo, mod_cluechoo_load, mod_cluechoo_shutdown, NULL);
 
-int add_D51();
-int add_sl();
-int add_man();
-int add_smoke();
+int add_D51(int x);
+int add_sl(int x);
+int add_man(int y, int x);
+int add_smoke(int y, int x);
 int go(int i);
 int vgo(int i, switch_core_session_t *session);
 

Modified: freeswitch/branches/brian/trunk/src/mod/event_handlers/mod_event_socket/mod_event_socket.c
==============================================================================
--- freeswitch/branches/brian/trunk/src/mod/event_handlers/mod_event_socket/mod_event_socket.c	(original)
+++ freeswitch/branches/brian/trunk/src/mod/event_handlers/mod_event_socket/mod_event_socket.c	Wed Jun  3 10:05:27 2009
@@ -115,6 +115,7 @@
 	char *acl[MAX_ACL];
 	uint32_t acl_count;
 	uint32_t id;
+	int nat_map;
 } prefs;
 
 
@@ -2211,6 +2212,10 @@
 					set_pref_ip(val);
 				} else if (!strcmp(var, "debug")) {
 					globals.debug = atoi(val);
+				} else if (!strcmp(var, "nat-map")) {
+					if (switch_true(val)) {
+						prefs.nat_map = 1;
+					}
 				} else if (!strcmp(var, "listen-port")) {
 					prefs.port = (uint16_t) atoi(val);
 				} else if (!strcmp(var, "password")) {
@@ -2235,6 +2240,10 @@
 		set_pref_pass("ClueCon");
 	}
 
+	if (!prefs.nat_map) {
+		prefs.nat_map = 0;
+	}
+
 	if (!prefs.port) {
 		prefs.port = 8021;
 	}
@@ -2276,6 +2285,11 @@
 		if (rv)
 			goto sock_fail;
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Socket up listening on %s:%u\n", prefs.ip, prefs.port);
+
+		if (prefs.nat_map) {
+			switch_nat_add_mapping(prefs.port, SWITCH_NAT_TCP);
+		}
+
 		break;
 	  sock_fail:
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Socket Error! Could not listen on %s:%u\n", prefs.ip, prefs.port);
@@ -2326,6 +2340,10 @@
 	}
 
 	close_socket(&listen_list.sock);
+	
+	if (prefs.nat_map) {
+		switch_nat_del_mapping(prefs.port, SWITCH_NAT_TCP);
+	}
 
 	if (pool) {
 		switch_core_destroy_memory_pool(&pool);



More information about the Freeswitch-svn mailing list