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

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@15189 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Andrew Thompson 2009-10-21 20:57:46 +00:00
parent 0fd390de5b
commit e47f8215e9
3 changed files with 20 additions and 6 deletions

View 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>

View 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;

View 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;