%FEATURE add bypass_media_resume_on_hold and bypass_media_after_hold variables to be set to true to enable these functions on a per channel basis

This commit is contained in:
Anthony Minessale 2014-10-02 17:49:09 -05:00
parent 43733a6166
commit 10a3fa55ef
2 changed files with 17 additions and 3 deletions

View File

@ -6910,8 +6910,10 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status,
if (switch_core_session_get_partner(session, &other_session) == SWITCH_STATUS_SUCCESS) { if (switch_core_session_get_partner(session, &other_session) == SWITCH_STATUS_SUCCESS) {
switch_core_session_message_t *msg; switch_core_session_message_t *msg;
private_object_t *other_tech_pvt; private_object_t *other_tech_pvt;
int media_on_hold = switch_true(switch_channel_get_variable_dup(channel, "bypass_media_resume_on_hold", SWITCH_FALSE, -1));
if (switch_channel_test_flag(channel, CF_PROXY_MODE) && !is_t38 && (profile->media_options & MEDIA_OPT_MEDIA_ON_HOLD)) {
if (switch_channel_test_flag(channel, CF_PROXY_MODE) && !is_t38 &&
((profile->media_options & MEDIA_OPT_MEDIA_ON_HOLD) || media_on_hold)) {
if (switch_stristr("sendonly", r_sdp) || switch_stristr("0.0.0.0", r_sdp)) { if (switch_stristr("sendonly", r_sdp) || switch_stristr("0.0.0.0", r_sdp)) {
tech_pvt->mparams.hold_laps = 1; tech_pvt->mparams.hold_laps = 1;
switch_channel_set_variable(channel, SWITCH_R_SDP_VARIABLE, r_sdp); switch_channel_set_variable(channel, SWITCH_R_SDP_VARIABLE, r_sdp);

View File

@ -4073,11 +4073,23 @@ SWITCH_DECLARE(int) switch_core_media_toggle_hold(switch_core_session_t *session
if (switch_channel_test_flag(session->channel, CF_PROTO_HOLD)) { if (switch_channel_test_flag(session->channel, CF_PROTO_HOLD)) {
const char *val; const char *val;
int media_on_hold_a = switch_true(switch_channel_get_variable_dup(session->channel, "bypass_media_resume_on_hold", SWITCH_FALSE, -1));
int media_on_hold_b = switch_true(switch_channel_get_variable_dup(b_channel, "bypass_media_resume_on_hold", SWITCH_FALSE, -1));
int bypass_after_hold_a = 0;
int bypass_after_hold_b = 0;
if (media_on_hold_a) {
bypass_after_hold_a = switch_true(switch_channel_get_variable_dup(session->channel, "bypass_media_after_hold", SWITCH_FALSE, -1));
}
if (media_on_hold_b) {
bypass_after_hold_b = switch_true(switch_channel_get_variable_dup(b_channel, "bypass_media_after_hold", SWITCH_FALSE, -1));
}
switch_yield(250000); switch_yield(250000);
if (b_channel && (switch_channel_test_flag(session->channel, CF_BYPASS_MEDIA_AFTER_HOLD) || if (b_channel && (switch_channel_test_flag(session->channel, CF_BYPASS_MEDIA_AFTER_HOLD) ||
switch_channel_test_flag(b_channel, CF_BYPASS_MEDIA_AFTER_HOLD))) { switch_channel_test_flag(b_channel, CF_BYPASS_MEDIA_AFTER_HOLD) || bypass_after_hold_a || bypass_after_hold_b)) {
/* try to stay out from media stream */ /* try to stay out from media stream */
switch_ivr_nomedia(switch_core_session_get_uuid(session), SMF_REBRIDGE); switch_ivr_nomedia(switch_core_session_get_uuid(session), SMF_REBRIDGE);
} }