]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
[core] Transfer with rtp_pass_codecs_on_stream_change one way audio 618/head
authorAnthony Minessale <anthm@freeswitch.org>
Thu, 1 Aug 2019 05:16:27 +0000 (05:16 +0000)
committerAndrey Volk <andywolk@gmail.com>
Thu, 7 May 2020 21:40:21 +0000 (01:40 +0400)
src/include/switch_ivr.h
src/switch_core_media.c
src/switch_ivr.c
src/switch_ivr_bridge.c

index 39e915edc5392eaeee91db8003a1dfd008748d77..34d6625541b593fb7d98a5f521e3c8e471f63635 100644 (file)
@@ -559,6 +559,9 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_bridge_bleg(switch_core_session_t *se
 */
 SWITCH_DECLARE(switch_status_t) switch_ivr_signal_bridge(switch_core_session_t *session, switch_core_session_t *peer_session);
 
+SWITCH_DECLARE(void) switch_ivr_check_hold(switch_core_session_t *session);                                                            
+
+
 /*!
   \brief Transfer an existing session to another location
   \param session the session to transfer
index 5e73a328620f6d19176b5aa6188b96aea6f06700..65ea2f3a6bb6d27d79b54f36fb36d2ae6e2d72ae 100644 (file)
@@ -10341,7 +10341,7 @@ SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *sess
 
                        switch_core_session_get_partner(session, &orig_session);
 
-                       if (orig_session) {
+                       if (orig_session && !switch_channel_test_flag(session->channel, CF_ANSWERED)) {
                                switch_core_media_set_smode(smh->session, SWITCH_MEDIA_TYPE_AUDIO,
                                                                                        switch_core_session_remote_media_flow(orig_session, SWITCH_MEDIA_TYPE_AUDIO), sdp_type);
                                switch_core_media_set_smode(smh->session, SWITCH_MEDIA_TYPE_VIDEO,
index 63237ed0631f49c207ad04ceed55a5a920e0b8e7..c1d232e1b7bd6636e01214225466fb668d783447 100644 (file)
@@ -2093,6 +2093,26 @@ SWITCH_DECLARE(void) switch_ivr_bg_media(const char *uuid, switch_media_flag_t f
 
 }
 
+SWITCH_DECLARE(void) switch_ivr_check_hold(switch_core_session_t *session)
+{
+       switch_channel_t *channel = switch_core_session_get_channel(session);
+       switch_media_flow_t flow;
+
+       if (switch_channel_test_flag(channel, CF_ANSWERED) &&
+               (flow = switch_core_session_media_flow(session, SWITCH_MEDIA_TYPE_AUDIO)) != SWITCH_MEDIA_FLOW_SENDRECV) {
+               switch_core_session_message_t msg = { 0 };
+
+               msg.message_id = SWITCH_MESSAGE_INDICATE_MEDIA_RENEG;
+               msg.from = __FILE__;
+
+               switch_core_media_set_smode(session, SWITCH_MEDIA_TYPE_AUDIO, SWITCH_MEDIA_FLOW_SENDRECV, SDP_TYPE_REQUEST);
+               switch_core_session_receive_message(session, &msg);
+       }
+
+       if (switch_channel_test_flag(channel, CF_HOLD)) {
+               switch_ivr_unhold(session);
+       }
+}
 
 SWITCH_DECLARE(switch_status_t) switch_ivr_session_transfer(switch_core_session_t *session, const char *extension, const char *dialplan,
                                                                                                                        const char *context)
@@ -2108,7 +2128,6 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_session_transfer(switch_core_session_
        const char *forwardvar = switch_channel_get_variable(channel, forwardvar_name);
        int forwardval = 70;
        const char *use_dialplan = dialplan, *use_context = context;
-       switch_media_flow_t flow;
        
        if (zstr(forwardvar)) {
                forwardvar_name = SWITCH_MAX_FORWARDS_VARIABLE; /* fall back to max_forwards variable for setting maximum */
@@ -2122,16 +2141,8 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_session_transfer(switch_core_session_
                return SWITCH_STATUS_FALSE;
        }
 
-       if (switch_channel_test_flag(channel, CF_ANSWERED) &&
-               (flow = switch_core_session_media_flow(session, SWITCH_MEDIA_TYPE_AUDIO)) != SWITCH_MEDIA_FLOW_SENDRECV) {
-               switch_core_session_message_t msg = { 0 };
-
-               msg.message_id = SWITCH_MESSAGE_INDICATE_MEDIA_RENEG;
-               msg.from = __FILE__;
-
-               switch_core_media_set_smode(session, SWITCH_MEDIA_TYPE_AUDIO, SWITCH_MEDIA_FLOW_SENDRECV, SDP_TYPE_REQUEST);
-               switch_core_session_receive_message(session, &msg);
-       }
+       switch_ivr_check_hold(session);
+       
        
        max_forwards = switch_core_session_sprintf(session, "%d", forwardval);
        switch_channel_set_variable(channel, forwardvar_name, max_forwards);
index d90ae88f89e18feed479392f239a240cbf64b7e8..3e5e2145be510f2a4b7a14d73c8f0e57d55a0f86 100644 (file)
@@ -2017,6 +2017,9 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_uuid_bridge(const char *originator_uu
                        originator_channel = switch_core_session_get_channel(originator_session);
                        originatee_channel = switch_core_session_get_channel(originatee_session);
 
+                       switch_ivr_check_hold(originator_session);
+                       switch_ivr_check_hold(originatee_session);
+       
 
                        if (switch_channel_test_flag(originator_channel, CF_LEG_HOLDING)) {
                                switch_channel_set_flag(originator_channel, CF_HOLD_ON_BRIDGE);