Revision
15189
Author
andrew
Date
2009-10-21 15:57:46 -0500 (Wed, 21 Oct 2009)

Log Message

mod_erlang_event: optionally allow compatability with nodes running older OTP releases (R7 through current)

Modified Paths

Diff

Modified: freeswitch/trunk/src/mod/event_handlers/mod_erlang_event/erlang_event.conf.xml (15188 => 15189)


--- freeswitch/trunk/src/mod/event_handlers/mod_erlang_event/erlang_event.conf.xml	2009-10-21 20:26:12 UTC (rev 15188)
+++ freeswitch/trunk/src/mod/event_handlers/mod_erlang_event/erlang_event.conf.xml	2009-10-21 20:57:46 UTC (rev 15189)
@@ -3,10 +3,12 @@
     <param name="listen-ip" value="0.0.0.0"/>
     <param name="listen-port" value="8031"/>
     <param name="cookie" value="ClueCon"/>
-		<param name="shortname" value="true"/>
-		<!-- in additon to cookie, optionally restrict by ACL -->
-		<!--<param name="apply-inbound-acl" value="lan"/>-->
-		<!-- alternative is "binary" -->
-		<!--<param name="encoding" value="string"/>--> 
+    <param name="shortname" value="true"/>
+    <!-- in additon to cookie, optionally restrict by ACL -->
+    <!--<param name="apply-inbound-acl" value="lan"/>-->
+    <!-- alternative is "binary" -->
+    <!--<param name="encoding" value="string"/>--> 
+    <!-- provide compatability with previous OTP release (use with care) -->
+    <!--<param name="compat-rel" value="12"/> -->
   </settings>
 </configuration>

Modified: freeswitch/trunk/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c (15188 => 15189)


--- freeswitch/trunk/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c	2009-10-21 20:26:12 UTC (rev 15188)
+++ freeswitch/trunk/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c	2009-10-21 20:57:46 UTC (rev 15189)
@@ -982,6 +982,7 @@
 
 	prefs.shortname = SWITCH_TRUE;
 	prefs.encoding = ERLANG_STRING;
+	prefs.compat_rel = 0;
 
 	if (!(xml = switch_xml_open_cfg(cf, &cfg, NULL))) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Open of %s failed\n", cf);
@@ -999,6 +1000,11 @@
 					set_pref_cookie(val);
 				} else if (!strcmp(var, "nodename")) {
 					set_pref_nodename(val);
+				} else if (!strcmp(var, "compat-rel")) {
+					if (atoi(val) >= 7)
+						prefs.compat_rel = atoi(val);
+					else
+						switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid compatability release '%s' specified\n", val);
 				} else if (!strcmp(var, "shortname")) {
 						prefs.shortname = switch_true(val);
 				} else if (!strcmp(var, "encoding")) {
@@ -1129,7 +1135,7 @@
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "OH OH no pool\n");
 		return NULL;
 	}
-
+=
 	session_element = switch_core_alloc(session_elem_pool, sizeof(*session_element));
 
 	memset(session_element, 0, sizeof(*session_element));
@@ -1650,6 +1656,11 @@
 		switch_yield(100000);
 	}
 
+	if (prefs.compat_rel) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Compatability with OTP R%d requested\n", prefs.compat_rel);
+		ei_set_compat_rel(prefs.compat_rel);
+	}
+
 	if (SWITCH_STATUS_SUCCESS!=initialise_ei(&ec)) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to init ei connection\n");
 		goto init_failed;

Modified: freeswitch/trunk/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.h (15188 => 15189)


--- freeswitch/trunk/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.h	2009-10-21 20:26:12 UTC (rev 15188)
+++ freeswitch/trunk/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.h	2009-10-21 20:57:46 UTC (rev 15189)
@@ -181,6 +181,7 @@
 	uint32_t acl_count;
 	uint32_t id;
 	erlang_encoding_t encoding;
+	int compat_rel;
 };
 typedef struct prefs_struct prefs_t;