]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
add bgsystem for background system calls
authorMichael Jerris <mike@jerris.com>
Fri, 3 May 2013 20:22:15 +0000 (16:22 -0400)
committerMichael Jerris <mike@jerris.com>
Fri, 3 May 2013 20:23:35 +0000 (16:23 -0400)
src/mod/applications/mod_dptools/mod_dptools.c

index 67c799b4cfb784819c1b2c0b556ae2d22dc43e03..5818bd0752b12c4584591afa3e0142ba14181db2 100755 (executable)
@@ -1920,6 +1920,14 @@ SWITCH_STANDARD_APP(system_session_function)
        }
 }
 
+SWITCH_STANDARD_APP(bgsystem_session_function)
+{
+       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_NOTICE, "Executing command: %s\n", data);
+       if (switch_system(data, SWITCH_FALSE) < 0) {
+               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_NOTICE, "Failed to execute command: %s\n", data);
+       }
+}
+
 SWITCH_STANDARD_APP(tone_detect_session_function)
 {
        char *argv[7] = { 0 };
@@ -5720,6 +5728,8 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_dptools_load)
                                   SAF_SUPPORT_NOMEDIA);
        SWITCH_ADD_APP(app_interface, "system", "Execute a system command", "Execute a system command", system_session_function, "<command>",
                                   SAF_SUPPORT_NOMEDIA | SAF_ZOMBIE_EXEC);
+       SWITCH_ADD_APP(app_interface, "bgsystem", "Execute a system command in the background", "Execute a background system command", bgsystem_session_function, "<command>",
+                                  SAF_SUPPORT_NOMEDIA | SAF_ZOMBIE_EXEC);
        SWITCH_ADD_APP(app_interface, "say", "say", "say", say_function, SAY_SYNTAX, SAF_NONE);
 
        SWITCH_ADD_APP(app_interface, "wait_for_silence", "wait_for_silence", "wait_for_silence", wait_for_silence_function, WAIT_FOR_SILENCE_SYNTAX,