[Freeswitch-trunk] [commit] r12491 - in freeswitch/trunk/src/mod/applications: mod_commands mod_dptools

FreeSWITCH SVN anthm at freeswitch.org
Fri Mar 6 12:16:48 PST 2009


Author: anthm
Date: Fri Mar  6 14:16:48 2009
New Revision: 12491

Log:
add heartbeat apps

Modified:
   freeswitch/trunk/src/mod/applications/mod_commands/mod_commands.c
   freeswitch/trunk/src/mod/applications/mod_dptools/mod_dptools.c

Modified: freeswitch/trunk/src/mod/applications/mod_commands/mod_commands.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_commands/mod_commands.c	(original)
+++ freeswitch/trunk/src/mod/applications/mod_commands/mod_commands.c	Fri Mar  6 14:16:48 2009
@@ -2743,7 +2743,7 @@
 	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 };

Modified: freeswitch/trunk/src/mod/applications/mod_dptools/mod_dptools.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_dptools/mod_dptools.c	(original)
+++ freeswitch/trunk/src/mod/applications/mod_dptools/mod_dptools.c	Fri Mar  6 14:16:48 2009
@@ -111,6 +111,42 @@
 	}
 }
 
+
+#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_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);



More information about the Freeswitch-trunk mailing list