]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
add heartbeat apps
authorAnthony Minessale <anthony.minessale@gmail.com>
Fri, 6 Mar 2009 20:16:48 +0000 (20:16 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Fri, 6 Mar 2009 20:16:48 +0000 (20:16 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@12491 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/mod/applications/mod_commands/mod_commands.c
src/mod/applications/mod_dptools/mod_dptools.c

index 50759fe607a7f32b1a8c3ecded6bc44aa159ff73..94ad9639d3250b8b1f2df33965d5585091410a29 100644 (file)
@@ -2743,7 +2743,7 @@ SWITCH_STANDARD_API(help_function)
        return SWITCH_STATUS_SUCCESS;
 }
 
-#define HEARTBEAT_SYNTAX "<uuid> [sched] <on|off|<seconds>>"
+#define HEARTBEAT_SYNTAX "<uuid> [sched] [0|<seconds>]"
 SWITCH_STANDARD_API(uuid_session_heartbeat_function)
 {
        char *mycmd = NULL, *argv[3] = { 0 };
index 91689834583e1930964de372aea59e331517be54..d833b46ba1f74b32623ae592b27d9566c9c0bf9c 100644 (file)
@@ -111,6 +111,42 @@ SWITCH_STANDARD_APP(detect_speech_function)
        }
 }
 
+
+#define SCHED_HEARTBEAT_SYNTAX "[0|<seconds>]"
+SWITCH_STANDARD_APP(sched_heartbeat_function)
+{
+       int seconds = 0;
+
+       if (data) {
+               seconds = atoi(data);
+               if (seconds >= 0) {
+                       switch_core_session_sched_heartbeat(session, seconds);
+                       return;
+               }
+       }
+
+       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Usage: %s\n", SCHED_HEARTBEAT_SYNTAX);
+
+}
+
+
+#define HEARTBEAT_SYNTAX "[0|<seconds>]"
+SWITCH_STANDARD_APP(heartbeat_function)
+{
+       int seconds = 0;
+
+       if (data) {
+               seconds = atoi(data);
+               if (seconds >= 0) {
+                       switch_core_session_enable_heartbeat(session, seconds);
+                       return;
+               }
+       }
+
+       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Usage: %s\n", HEARTBEAT_SYNTAX);
+
+}
+
 #define EXE_SYNTAX "<extension> <dialplan> <context>"
 SWITCH_STANDARD_APP(exe_function)
 {
@@ -2605,6 +2641,10 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_dptools_load)
        SWITCH_ADD_APP(app_interface, "sched_transfer", SCHED_TRANSF_DESCR, SCHED_TRANSF_DESCR, sched_transfer_function,
                                   "[+]<time> <extension> <dialplan> <context>", SAF_SUPPORT_NOMEDIA);
        SWITCH_ADD_APP(app_interface, "execute_extension", "Execute an extension", "Execute an extension", exe_function, EXE_SYNTAX, SAF_SUPPORT_NOMEDIA);
+       SWITCH_ADD_APP(app_interface, "sched_heartbeat", "Enable Scheduled Heartbeat", "Enable Scheduled Heartbeat", 
+                                  sched_heartbeat_function, SCHED_HEARTBEAT_SYNTAX, SAF_SUPPORT_NOMEDIA);
+       SWITCH_ADD_APP(app_interface, "enable_heartbeat", "Enable Media Heartbeat", "Enable Media Heartbeat", 
+                                  heartbeat_function, HEARTBEAT_SYNTAX, SAF_SUPPORT_NOMEDIA);
        SWITCH_ADD_APP(app_interface, "mkdir", "Create a directory", "Create a directory", mkdir_function, MKDIR_SYNTAX, SAF_SUPPORT_NOMEDIA);
        SWITCH_ADD_APP(app_interface, "soft_hold", "Put a bridged channel on hold", "Put a bridged channel on hold", soft_hold_function, SOFT_HOLD_SYNTAX,
                                   SAF_NONE);