]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
add startup-script to mod_lua
authorBrian West <brian@freeswitch.org>
Thu, 17 Jul 2008 20:31:49 +0000 (20:31 +0000)
committerBrian West <brian@freeswitch.org>
Thu, 17 Jul 2008 20:31:49 +0000 (20:31 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@9075 d0543943-73ff-0310-b7d9-9358b9ac24b2

conf/autoload_configs/lua.conf.xml
src/mod/languages/mod_lua/mod_lua.cpp

index 118b3d891354e9c4cf1f1e807fb5aa27022922f3..0dd13d87af3e119f0667cd0131a1d0f947917030 100644 (file)
@@ -2,5 +2,14 @@
   <settings>
     <!--<param name="xml-handler-script" value="/dp.lua"/>-->
     <!--<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>
 </configuration>
index 3512c59a49424f64ec26999934cc432403d34270..76b472b89b00f346226fd435428a104216ca3ab9 100644 (file)
@@ -49,6 +49,7 @@ static struct {
 } globals;
 
 int luaopen_freeswitch(lua_State * L);
+int lua_thread(const char *text);
 
 static int panic(lua_State * L)
 {
@@ -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_xml_bind_search_function(lua_fetch, switch_xml_parse_section_string(val), NULL);
                                }
+                       } else if (!strcmp(var, "startup-script")) {
+                               if (val) {
+                                       lua_thread(val);
+                               }
                        }
                }
        }