]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-5935 --resolve this was broken from the initial check in FS-5524
authorAnthony Minessale <anthm@freeswitch.org>
Fri, 1 Nov 2013 21:33:41 +0000 (16:33 -0500)
committerAnthony Minessale <anthm@freeswitch.org>
Fri, 1 Nov 2013 21:34:14 +0000 (16:34 -0500)
src/mod/languages/mod_lua/mod_lua.cpp

index a21643bc97ed0a0a1f6f76cde3871185c9dd8f96..9715f0dc7416f19fb39870c131d1396757e51e44 100644 (file)
@@ -45,7 +45,6 @@ SWITCH_MODULE_DEFINITION_EX(mod_lua, mod_lua_load, mod_lua_shutdown, NULL, SMODF
 static struct {
        switch_memory_pool_t *pool;
        char *xml_handler;
-       switch_event_node_t *node;
 } globals;
 
 int luaopen_freeswitch(lua_State * L);
@@ -339,12 +338,16 @@ static switch_status_t do_config(void)
                        char *script = (char *) switch_xml_attr_soft(hook, "script");
                        switch_event_types_t evtype;
 
+                       if (!zstr(script)) {
+                               script = switch_core_strdup(globals.pool, script);
+                       }
+
                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "hook params: '%s' | '%s' | '%s'\n", event, subclass, script);
 
                        if (switch_name_event(event,&evtype) == SWITCH_STATUS_SUCCESS) {
                                if (!zstr(script)) {
-                                       if (switch_event_bind_removable(modname, evtype, !zstr(subclass) ? subclass : SWITCH_EVENT_SUBCLASS_ANY,
-                                                       lua_event_handler, script, &globals.node) == SWITCH_STATUS_SUCCESS) {
+                                       if (switch_event_bind(modname, evtype, !zstr(subclass) ? subclass : SWITCH_EVENT_SUBCLASS_ANY,
+                                                       lua_event_handler, script) == SWITCH_STATUS_SUCCESS) {
                                                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "event handler for '%s' set to '%s'\n", switch_event_name(evtype), script);
                                        } else {
                                                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "cannot set event handler: unsuccessful bind\n");
@@ -691,7 +694,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_lua_load)
 
 SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_lua_shutdown)
 {
-       switch_event_unbind(&globals.node);
+       switch_event_unbind_callback(lua_event_handler);
 
        return SWITCH_STATUS_SUCCESS;
 }