From 35bc42a9178d450ff4e8d41df8bc236907316d5d Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 16 Aug 2012 12:10:10 -0500 Subject: [PATCH] FS-4539 please test this and post new logs if necessary --- src/switch_ivr_bridge.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/switch_ivr_bridge.c b/src/switch_ivr_bridge.c index 3ca4dd2715..f2aec42fdd 100644 --- a/src/switch_ivr_bridge.c +++ b/src/switch_ivr_bridge.c @@ -761,7 +761,7 @@ static switch_status_t uuid_bridge_on_hibernate(switch_core_session_t *session) static switch_status_t uuid_bridge_on_soft_execute(switch_core_session_t *session) { switch_channel_t *channel = switch_core_session_get_channel(session); - switch_core_session_t *other_session; + switch_core_session_t *other_session = NULL; const char *other_uuid = NULL; switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s CUSTOM SOFT_EXECUTE\n", switch_channel_get_name(channel)); @@ -818,7 +818,6 @@ static switch_status_t uuid_bridge_on_soft_execute(switch_core_session_t *sessio switch_core_session_reset(session, SWITCH_TRUE, SWITCH_TRUE); if (switch_ivr_wait_for_answer(session, other_session) != SWITCH_STATUS_SUCCESS) { - switch_core_session_rwunlock(other_session); if (switch_true(switch_channel_get_variable(channel, "uuid_bridge_continue_on_cancel"))) { switch_channel_set_state(channel, CS_EXECUTE); } else if (!switch_channel_test_flag(channel, CF_TRANSFER)) { @@ -843,7 +842,6 @@ static switch_status_t uuid_bridge_on_soft_execute(switch_core_session_t *sessio switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); } } - switch_core_session_rwunlock(other_session); goto done; } @@ -869,13 +867,17 @@ static switch_status_t uuid_bridge_on_soft_execute(switch_core_session_t *sessio !switch_channel_test_flag(channel, CF_REDIRECT) && state < CS_HANGUP && state != CS_ROUTING && state != CS_PARK) { switch_channel_set_state(channel, CS_EXECUTE); } - switch_core_session_rwunlock(other_session); } else { switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); } done: + if (other_session) { + switch_core_session_rwunlock(other_session); + other_session = NULL; + } + switch_channel_clear_flag_recursive(channel, CF_BRIDGE_ORIGINATOR); return SWITCH_STATUS_FALSE;