[core] Transfer with rtp_pass_codecs_on_stream_change one way audio

This commit is contained in:
Anthony Minessale 2019-08-01 05:16:27 +00:00 committed by Andrey Volk
parent d945566bbd
commit 6b35e576fc
4 changed files with 29 additions and 12 deletions

View 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

View 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,

View 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);

View 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);