From 634490495f401740e0125b5a375c874061a879be Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 20 Dec 2016 11:08:17 -0600 Subject: [PATCH] FS-9806: [mod_loopback] mod_loopback: bowout is always done even if set to false loopback_bowout_on_execute=false,loopback_bowout=false #resolve --- src/mod/endpoints/mod_loopback/mod_loopback.c | 5 ++-- src/switch_core_media.c | 25 ++++++++----------- 2 files changed, 14 insertions(+), 16 deletions(-) diff --git a/src/mod/endpoints/mod_loopback/mod_loopback.c b/src/mod/endpoints/mod_loopback/mod_loopback.c index 3a01377c10..dfd97b900b 100644 --- a/src/mod/endpoints/mod_loopback/mod_loopback.c +++ b/src/mod/endpoints/mod_loopback/mod_loopback.c @@ -293,6 +293,7 @@ static switch_status_t channel_on_init(switch_core_session_t *session) switch_channel_set_flag(channel, CF_ACCEPT_CNG); + switch_channel_set_flag(channel, CF_AUDIO); if ((vars = (switch_event_t *) switch_channel_get_private(channel, "__loopback_vars__"))) { switch_event_header_t *h; @@ -1085,7 +1086,7 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi switch_event_t *clone = NULL; switch_core_session_add_stream(*new_session, NULL); - + if ((tech_pvt = (loopback_private_t *) switch_core_session_alloc(*new_session, sizeof(loopback_private_t))) != 0) { channel = switch_core_session_get_channel(*new_session); switch_snprintf(name, sizeof(name), "loopback/%s-a", outbound_profile->destination_number); @@ -1172,7 +1173,7 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi } switch_channel_set_state(channel, CS_INIT); - + switch_channel_set_flag(channel, CF_AUDIO); return SWITCH_CAUSE_SUCCESS; } diff --git a/src/switch_core_media.c b/src/switch_core_media.c index c4e9b66b04..94ba63dc4d 100644 --- a/src/switch_core_media.c +++ b/src/switch_core_media.c @@ -6162,24 +6162,21 @@ static switch_status_t perform_write(switch_core_session_t *session, switch_fram { switch_io_event_hook_write_frame_t *ptr; switch_status_t status = SWITCH_STATUS_FALSE; - switch_rtp_engine_t *a_engine; switch_media_handle_t *smh; switch_assert(session != NULL); - if (!(smh = session->media_handle)) { - return SWITCH_STATUS_FALSE; - } + if ((smh = session->media_handle)) { + switch_rtp_engine_t *a_engine = &smh->engines[SWITCH_MEDIA_TYPE_AUDIO]; - a_engine = &smh->engines[SWITCH_MEDIA_TYPE_AUDIO]; - - if (a_engine && a_engine->write_fb && !(flags & SWITCH_IO_FLAG_QUEUED)) { - switch_frame_t *dupframe = NULL; - - if (switch_frame_buffer_dup(a_engine->write_fb, frame, &dupframe) == SWITCH_STATUS_SUCCESS) { - switch_frame_buffer_push(a_engine->write_fb, dupframe); - dupframe = NULL; - return SWITCH_STATUS_SUCCESS; + if (a_engine && a_engine->write_fb && !(flags & SWITCH_IO_FLAG_QUEUED)) { + switch_frame_t *dupframe = NULL; + + if (switch_frame_buffer_dup(a_engine->write_fb, frame, &dupframe) == SWITCH_STATUS_SUCCESS) { + switch_frame_buffer_push(a_engine->write_fb, dupframe); + dupframe = NULL; + return SWITCH_STATUS_SUCCESS; + } } } @@ -14305,7 +14302,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_write_frame(switch_core_sess switch_assert(session != NULL); switch_assert(frame != NULL); - if (!switch_channel_ready(session->channel)) { + if (!switch_channel_up_nosig(session->channel)) { return SWITCH_STATUS_FALSE; }