]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
mod_erlang_event: optionally allow compatability with nodes running older OTP release...
authorAndrew Thompson <andrew@hijacked.us>
Wed, 21 Oct 2009 20:57:46 +0000 (20:57 +0000)
committerAndrew Thompson <andrew@hijacked.us>
Wed, 21 Oct 2009 20:57:46 +0000 (20:57 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@15189 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/mod/event_handlers/mod_erlang_event/erlang_event.conf.xml
src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c
src/mod/event_handlers/mod_erlang_event/mod_erlang_event.h

index c4b73bfae7aa3d2db2d6dc0c20fa9ca2755758fc..ec14e21a25beb3266bfb49845da8d32fce929198 100644 (file)
@@ -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>
index 8dafdc3c4fbd5e25359a9ec5eb6211155762a2c9..f292f15c2953f4908253cc64962ada038887249f 100644 (file)
@@ -982,6 +982,7 @@ static int config(void)
 
        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 @@ static int config(void)
                                        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 @@ session_elem_t *session_elem_create(listener_t* listener, switch_core_session_t
                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_MODULE_RUNTIME_FUNCTION(mod_erlang_event_runtime)
                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;
index 0debebe943b8e06decdc6b15a3c6e9cfecc90fb6..ad9344c82aaa57a9ba6061cd335ce528d2007079 100644 (file)
@@ -181,6 +181,7 @@ struct prefs_struct {
        uint32_t acl_count;
        uint32_t id;
        erlang_encoding_t encoding;
+       int compat_rel;
 };
 typedef struct prefs_struct prefs_t;