[Freeswitch-svn] [commit] r9075 - in freeswitch/trunk: conf/autoload_configs src/mod/languages/mod_lua

Freeswitch SVN brian at freeswitch.org
Thu Jul 17 16:31:49 EDT 2008


Author: brian
Date: Thu Jul 17 16:31:49 2008
New Revision: 9075

Modified:
   freeswitch/trunk/conf/autoload_configs/lua.conf.xml
   freeswitch/trunk/src/mod/languages/mod_lua/mod_lua.cpp

Log:
add startup-script to mod_lua

Modified: freeswitch/trunk/conf/autoload_configs/lua.conf.xml
==============================================================================
--- freeswitch/trunk/conf/autoload_configs/lua.conf.xml	(original)
+++ freeswitch/trunk/conf/autoload_configs/lua.conf.xml	Thu Jul 17 16:31:49 2008
@@ -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>

Modified: freeswitch/trunk/src/mod/languages/mod_lua/mod_lua.cpp
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_lua/mod_lua.cpp	(original)
+++ freeswitch/trunk/src/mod/languages/mod_lua/mod_lua.cpp	Thu Jul 17 16:31:49 2008
@@ -49,6 +49,7 @@
 } globals;
 
 int luaopen_freeswitch(lua_State * L);
+int lua_thread(const char *text);
 
 static int panic(lua_State * L)
 {
@@ -274,6 +275,10 @@
 					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);
+				}
 			}
 		}
 	}



More information about the Freeswitch-svn mailing list