]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
%FEATURE add bypass_media_resume_on_hold and bypass_media_after_hold variables to...
authorAnthony Minessale <anthm@freeswitch.org>
Thu, 2 Oct 2014 22:49:09 +0000 (17:49 -0500)
committerAnthony Minessale <anthm@freeswitch.org>
Thu, 2 Oct 2014 22:49:09 +0000 (17:49 -0500)
src/mod/endpoints/mod_sofia/sofia.c
src/switch_core_media.c

index 01230c4029b106b082c5b95d906b4cdf5054ffc1..6d83a8191d2468c5e04ed48658c2e2b9eda4abcf 100644 (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) {
                                                switch_core_session_message_t *msg;
                                                private_object_t *other_tech_pvt;
-
-                                               if (switch_channel_test_flag(channel, CF_PROXY_MODE) && !is_t38 && (profile->media_options & MEDIA_OPT_MEDIA_ON_HOLD)) {
+                                               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) || media_on_hold)) {
                                                        if (switch_stristr("sendonly", r_sdp) || switch_stristr("0.0.0.0", r_sdp)) {
                                                                tech_pvt->mparams.hold_laps = 1;
                                                                switch_channel_set_variable(channel, SWITCH_R_SDP_VARIABLE, r_sdp);
index b0b5ee4ec3b2fc9654a06740ed4ac9e11035074d..9163fb1a2b0fc65c35a626e47f92ed887f871b8c 100644 (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)) {
                        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);
 
                        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 */
                                switch_ivr_nomedia(switch_core_session_get_uuid(session), SMF_REBRIDGE);
                        }