add dp apps for setting audio level and muting

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@15993 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale 2009-12-17 23:08:38 +00:00
parent 093c43ec91
commit 6ece392d46
2 changed files with 53 additions and 0 deletions

View File

@ -134,6 +134,8 @@ SWITCH_DECLARE(void) switch_core_session_unsched_heartbeat(switch_core_session_t
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

View File

@ -419,6 +419,54 @@ SWITCH_STANDARD_APP(set_user_function)
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_MODULE_LOAD_FUNCTION(mod_dptools_load)
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);