提交 456f69a6 authored 作者: Anthony Minessale's avatar Anthony Minessale

FS-5935 --resolve this was broken from the initial check in FS-5524

上级 0657ce7c
...@@ -45,7 +45,6 @@ SWITCH_MODULE_DEFINITION_EX(mod_lua, mod_lua_load, mod_lua_shutdown, NULL, SMODF ...@@ -45,7 +45,6 @@ SWITCH_MODULE_DEFINITION_EX(mod_lua, mod_lua_load, mod_lua_shutdown, NULL, SMODF
static struct { static struct {
switch_memory_pool_t *pool; switch_memory_pool_t *pool;
char *xml_handler; char *xml_handler;
switch_event_node_t *node;
} globals; } globals;
int luaopen_freeswitch(lua_State * L); int luaopen_freeswitch(lua_State * L);
...@@ -339,12 +338,16 @@ static switch_status_t do_config(void) ...@@ -339,12 +338,16 @@ static switch_status_t do_config(void)
char *script = (char *) switch_xml_attr_soft(hook, "script"); char *script = (char *) switch_xml_attr_soft(hook, "script");
switch_event_types_t evtype; 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); 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 (switch_name_event(event,&evtype) == SWITCH_STATUS_SUCCESS) {
if (!zstr(script)) { if (!zstr(script)) {
if (switch_event_bind_removable(modname, evtype, !zstr(subclass) ? subclass : SWITCH_EVENT_SUBCLASS_ANY, if (switch_event_bind(modname, evtype, !zstr(subclass) ? subclass : SWITCH_EVENT_SUBCLASS_ANY,
lua_event_handler, script, &globals.node) == SWITCH_STATUS_SUCCESS) { 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); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "event handler for '%s' set to '%s'\n", switch_event_name(evtype), script);
} else { } else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "cannot set event handler: unsuccessful bind\n"); 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) ...@@ -691,7 +694,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_lua_load)
SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_lua_shutdown) SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_lua_shutdown)
{ {
switch_event_unbind(&globals.node); switch_event_unbind_callback(lua_event_handler);
return SWITCH_STATUS_SUCCESS; return SWITCH_STATUS_SUCCESS;
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论