Revision
15993
Author
anthm
Date
2009-12-17 17:08:38 -0600 (Thu, 17 Dec 2009)

Log Message

add dp apps for setting audio level and muting

Modified Paths

Diff

Modified: freeswitch/trunk/src/include/switch_core.h (15992 => 15993)


--- freeswitch/trunk/src/include/switch_core.h	2009-12-17 21:06:49 UTC (rev 15992)
+++ freeswitch/trunk/src/include/switch_core.h	2009-12-17 23:08:38 UTC (rev 15993)
@@ -134,6 +134,8 @@
 SWITCH_DECLARE(void) switch_core_session_enable_heartbeat(switch_core_session_t *session, uint32_t seconds);
 SWITCH_DECLARE(void) switch_core_session_disable_heartbeat(switch_core_session_t *session);
 
+#define switch_core_session_get_name(_s) switch_channel_get_name(switch_core_session_get_channel(_s))
+
 /*!
   \brief Add a media bug to the session
   \param session the session to add the bug to

Modified: freeswitch/trunk/src/mod/applications/mod_dptools/mod_dptools.c (15992 => 15993)


--- freeswitch/trunk/src/mod/applications/mod_dptools/mod_dptools.c	2009-12-17 21:06:49 UTC (rev 15992)
+++ freeswitch/trunk/src/mod/applications/mod_dptools/mod_dptools.c	2009-12-17 23:08:38 UTC (rev 15993)
@@ -419,6 +419,54 @@
 	switch_ivr_set_user(session, data);
 }
 
+#define SET_AUDIO_LEVEL_SYNTAX "[read|write] <vol>"
+SWITCH_STANDARD_APP(set_audio_level_function)
+{
+	char *argv[2] = { 0 };
+	int argc = 0;
+	char *mydata;
+	int level = 0;
+
+	mydata = switch_core_session_strdup(session, data);
+	argc = switch_split(mydata, ' ', argv);
+	
+	if (argc != 2) {
+		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s Error. USAGE: %s\n", 
+						  switch_core_session_get_name(session), SET_AUDIO_LEVEL_SYNTAX);
+		return;
+	}
+
+	level = atoi(argv[1]);
+
+	switch_ivr_session_audio(session, "level", argv[0], level);
+	
+	
+}
+
+#define SET_MUTE_SYNTAX "[read|write] [true|false]"
+SWITCH_STANDARD_APP(set_mute_function)
+{
+	char *argv[2] = { 0 };
+	int argc = 0;
+	char *mydata;
+	int level = 0;
+
+	mydata = switch_core_session_strdup(session, data);
+	argc = switch_split(mydata, ' ', argv);
+	
+	if (argc != 2) {
+		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s Error. USAGE: %s\n", 
+						  switch_core_session_get_name(session), SET_MUTE_SYNTAX);
+		return;
+	}
+
+	level = switch_true(argv[1]);
+	
+	switch_ivr_session_audio(session, "mute", argv[0], level);
+	
+}
+
+
 SWITCH_STANDARD_APP(ring_ready_function)
 {
 	switch_channel_ring_ready(switch_core_session_get_channel(session));
@@ -2945,6 +2993,9 @@
 	SWITCH_ADD_APP(app_interface, "privacy", "Set privacy on calls", "Set caller privacy on calls.", privacy_function, "off|on|name|full|number",
 				   SAF_SUPPORT_NOMEDIA);
 
+	SWITCH_ADD_APP(app_interface, "set_audio_level", "set volume", "set volume", set_audio_level_function, "", SAF_NONE);
+	SWITCH_ADD_APP(app_interface, "set_mute", "set mute", "set mute", set_mute_function, "", SAF_NONE);
+
 	SWITCH_ADD_APP(app_interface, "flush_dtmf", "flush any queued dtmf", "flush any queued dtmf", flush_dtmf_function, "", SAF_SUPPORT_NOMEDIA);
 	SWITCH_ADD_APP(app_interface, "hold", "Send a hold message", "Send a hold message", hold_function, HOLD_SYNTAX, SAF_SUPPORT_NOMEDIA);
 	SWITCH_ADD_APP(app_interface, "unhold", "Send a un-hold message", "Send a un-hold message", unhold_function, UNHOLD_SYNTAX, SAF_SUPPORT_NOMEDIA);