]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
launch perl scripts on startup (MODLANG-72)
authorMichael Jerris <mike@jerris.com>
Thu, 17 Jul 2008 20:01:53 +0000 (20:01 +0000)
committerMichael Jerris <mike@jerris.com>
Thu, 17 Jul 2008 20:01:53 +0000 (20:01 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@9074 d0543943-73ff-0310-b7d9-9358b9ac24b2

conf/autoload_configs/perl.conf.xml
src/mod/languages/mod_perl/mod_perl.c

index 83732890c61d5d125a3058765997c013cf577a86..b2435000ffa838e512e4aa48ac52b1307e0296fa 100644 (file)
@@ -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>
index fa750f9d30cad82648d1fb8dd1b667c158fd5cb9..c68da54aef6e5392c95084375349666e636972a3 100644 (file)
@@ -450,6 +450,9 @@ static switch_status_t do_config(void)
                                        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 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_perl_load)
        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");