diff --git a/src/include/switch_types.h b/src/include/switch_types.h index f9f5a492d7..65b395959c 100644 --- a/src/include/switch_types.h +++ b/src/include/switch_types.h @@ -1405,6 +1405,7 @@ typedef enum { CF_AUDIO_PAUSE, CF_VIDEO_PAUSE, CF_BYPASS_MEDIA_AFTER_HOLD, + CF_HANGUP_HELD, /* WARNING: DO NOT ADD ANY FLAGS BELOW THIS LINE */ /* IF YOU ADD NEW ONES CHECK IF THEY SHOULD PERSIST OR ZERO THEM IN switch_core_session.c switch_core_session_request_xml() */ CF_FLAG_MAX diff --git a/src/switch_channel.c b/src/switch_channel.c index 7351fc691b..8c338cf8cb 100644 --- a/src/switch_channel.c +++ b/src/switch_channel.c @@ -3160,6 +3160,7 @@ SWITCH_DECLARE(switch_channel_state_t) switch_channel_perform_hangup(switch_chan if (switch_channel_test_flag(channel, CF_LEG_HOLDING)) { switch_channel_mark_hold(channel, SWITCH_FALSE); + switch_channel_set_flag(channel, CF_HANGUP_HELD); } if (!ok) { diff --git a/src/switch_ivr_bridge.c b/src/switch_ivr_bridge.c index 60c74e281b..19d6099a33 100644 --- a/src/switch_ivr_bridge.c +++ b/src/switch_ivr_bridge.c @@ -646,12 +646,11 @@ static void *audio_bridge_thread(switch_thread_t *thread, void *obj) switch_channel_set_variable(chan_a, SWITCH_BRIDGE_VARIABLE, NULL); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session_a), SWITCH_LOG_DEBUG, "BRIDGE THREAD DONE [%s]\n", switch_channel_get_name(chan_a)); switch_channel_clear_flag(chan_a, CF_BRIDGED); - - if (switch_channel_test_flag(chan_a, CF_LEG_HOLDING)) { - + + if (switch_channel_test_flag(chan_a, CF_LEG_HOLDING) || switch_channel_test_flag(chan_a, CF_HANGUP_HELD)) { if (switch_channel_ready(chan_b) && switch_channel_get_state(chan_b) != CS_PARK) { const char *ext = switch_channel_get_variable(chan_a, "hold_hangup_xfer_exten"); - + switch_channel_stop_broadcast(chan_b); if (zstr(ext)) { @@ -664,7 +663,10 @@ static void *audio_bridge_thread(switch_thread_t *thread, void *obj) switch_channel_set_variable(chan_b, SWITCH_TRANSFER_AFTER_BRIDGE_VARIABLE, ext); } } - switch_channel_mark_hold(chan_a, SWITCH_FALSE); + + if (switch_channel_test_flag(chan_a, CF_LEG_HOLDING)) { + switch_channel_mark_hold(chan_a, SWITCH_FALSE); + } } if (switch_channel_test_flag(chan_a, CF_INTERCEPTED)) {