提交 ccbf3936 authored 作者: Brian West's avatar Brian West

add startup-script to mod_lua

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@9075 d0543943-73ff-0310-b7d9-9358b9ac24b2
上级 e23ce1f5
...@@ -2,5 +2,14 @@ ...@@ -2,5 +2,14 @@
<settings> <settings>
<!--<param name="xml-handler-script" value="/dp.lua"/>--> <!--<param name="xml-handler-script" value="/dp.lua"/>-->
<!--<param name="xml-handler-bindings" value="dialplan"/>--> <!--<param name="xml-handler-bindings" value="dialplan"/>-->
<!--
The following options identifies a lua script that is launched
at startup and may live forever in the background.
You can define multiple lines, one for each script you
need to run.
-->
<!--<param name="startup-script" value="startup_script_1.lua"/>-->
<!--<param name="startup-script" value="startup_script_2.lua"/>-->
</settings> </settings>
</configuration> </configuration>
...@@ -49,6 +49,7 @@ static struct { ...@@ -49,6 +49,7 @@ static struct {
} globals; } globals;
int luaopen_freeswitch(lua_State * L); int luaopen_freeswitch(lua_State * L);
int lua_thread(const char *text);
static int panic(lua_State * L) static int panic(lua_State * L)
{ {
...@@ -274,6 +275,10 @@ static switch_status_t do_config(void) ...@@ -274,6 +275,10 @@ static switch_status_t do_config(void)
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "binding '%s' to '%s'\n", globals.xml_handler, val); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "binding '%s' to '%s'\n", globals.xml_handler, val);
switch_xml_bind_search_function(lua_fetch, switch_xml_parse_section_string(val), NULL); switch_xml_bind_search_function(lua_fetch, switch_xml_parse_section_string(val), NULL);
} }
} else if (!strcmp(var, "startup-script")) {
if (val) {
lua_thread(val);
}
} }
} }
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论