From 554387c8dc53b0e3a8b9d530a799d681cef5e6e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hunyadv=C3=A1ri=20P=C3=A9ter?= Date: Tue, 20 Mar 2018 09:32:47 +0100 Subject: [PATCH] Skip holding b leg only if it is on hold FS-8579 --resolve --- src/include/switch_types.h | 2 ++ src/switch_ivr.c | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/include/switch_types.h b/src/include/switch_types.h index 652836b17c..2cc5be4fe9 100644 --- a/src/include/switch_types.h +++ b/src/include/switch_types.h @@ -1346,6 +1346,7 @@ CF_ACCEPT_CNG - Channel will accept CNG frames CF_REDIRECT - Channel is being redirected CF_BRIDGED - Channel in a bridge CF_HOLD - Channel is on hold +CF_HOLD_BLEG - B leg is on hold CF_SERVICE - Channel has a service thread CF_TAGGED - Channel is tagged CF_WINNER - Channel is the winner @@ -1397,6 +1398,7 @@ typedef enum { CF_REDIRECT, CF_BRIDGED, CF_HOLD, + CF_HOLD_BLEG, CF_SERVICE, CF_TAGGED, CF_WINNER, diff --git a/src/switch_ivr.c b/src/switch_ivr.c index 770c3bb81f..f5b5d1ba64 100644 --- a/src/switch_ivr.c +++ b/src/switch_ivr.c @@ -572,7 +572,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_parse_event(switch_core_session_t *se switch_channel_clear_flag(channel, CF_STOP_BROADCAST); - if (!switch_channel_test_flag(channel, CF_BRIDGED) || switch_channel_test_flag(channel, CF_BROADCAST)) { + if (!switch_channel_test_flag(channel, CF_BRIDGED) || switch_channel_test_flag(channel, CF_HOLD_BLEG)) { inner++; hold_bleg = NULL; } @@ -597,6 +597,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_parse_event(switch_core_session_t *se if ((b_session = switch_core_session_locate(b_uuid))) { switch_channel_t *b_channel = switch_core_session_get_channel(b_session); switch_status_t st; + switch_channel_set_flag(channel, CF_HOLD_BLEG); switch_ivr_broadcast(b_uuid, stream, SMF_ECHO_ALEG | SMF_LOOP); st = switch_channel_wait_for_flag(b_channel, CF_BROADCAST, SWITCH_TRUE, 5000, NULL); @@ -649,6 +650,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_parse_event(switch_core_session_t *se if (b_uuid) { if ((b_session = switch_core_session_locate(b_uuid))) { switch_channel_t *b_channel = switch_core_session_get_channel(b_session); + switch_channel_clear_flag(channel, CF_HOLD_BLEG); switch_channel_stop_broadcast(b_channel); switch_channel_wait_for_flag(b_channel, CF_BROADCAST, SWITCH_FALSE, 5000, NULL); switch_core_session_rwunlock(b_session);