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

Freeswitch SVN mikej at freeswitch.org
Thu Jul 17 16:01:53 EDT 2008


Author: mikej
Date: Thu Jul 17 16:01:53 2008
New Revision: 9074

Modified:
   freeswitch/trunk/conf/autoload_configs/perl.conf.xml
   freeswitch/trunk/src/mod/languages/mod_perl/mod_perl.c

Log:
launch perl scripts on startup (MODLANG-72)

Modified: freeswitch/trunk/conf/autoload_configs/perl.conf.xml
==============================================================================
--- freeswitch/trunk/conf/autoload_configs/perl.conf.xml	(original)
+++ freeswitch/trunk/conf/autoload_configs/perl.conf.xml	Thu Jul 17 16:01:53 2008
@@ -2,5 +2,15 @@
   <settings>
     <!--<param name="xml-handler-script" value="/tmp/xml.pl"/>-->
     <!--<param name="xml-handler-bindings" value="dialplan"/>-->
+
+    <!--
+	The following options identifies a perl 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.pl"/-->
+    <!--param name="startup-script" value="startup_script_2.pl"/-->
+
   </settings>
 </configuration>

Modified: freeswitch/trunk/src/mod/languages/mod_perl/mod_perl.c
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_perl/mod_perl.c	(original)
+++ freeswitch/trunk/src/mod/languages/mod_perl/mod_perl.c	Thu Jul 17 16:01:53 2008
@@ -450,6 +450,9 @@
 					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "binding '%s' to '%s'\n", globals.xml_handler, var);
 					switch_xml_bind_search_function(perl_fetch, switch_xml_parse_section_string(val), NULL);
 				}
+			} else if (!strcmp(var, "startup-script")) {
+				if ( val )
+					perl_thread(val);
 			}
 		}
 	}
@@ -469,7 +472,7 @@
 	globals.pool = pool;
 
 	if (!(my_perl = perl_alloc())) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not allocate perl intrepreter\n");
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not allocate perl interpreter\n");
 		return SWITCH_STATUS_MEMERR;
 	}
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Allocated perl intrepreter.\n");



More information about the Freeswitch-svn mailing list