diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index cd197beabb..28ca4ca061 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -3705,14 +3705,13 @@ static void sip_i_refer(nua_t *nua, switch_core_session_t *bsession; if ((bsession = switch_core_session_locate(br))) { - channel = switch_core_session_get_channel(bsession); switch_channel_set_variable(channel, "TRANSFER_FALLBACK", (char *) from->a_user); switch_ivr_session_transfer(bsession, exten, profile->dialplan, profile->context); switch_core_session_rwunlock(bsession); } - + switch_channel_set_variable(channel, "endpoint_disposition", "BLIND_TRANSFER"); - + nua_notify(tech_pvt->nh, SIPTAG_CONTENT_TYPE_STR("message/sipfrag"), SIPTAG_PAYLOAD_STR("SIP/2.0 200 OK"), SIPTAG_EVENT_STR(etmp), @@ -4008,8 +4007,8 @@ static void sip_i_invite(nua_t *nua, } attach_private(session, profile, tech_pvt, username); - switch_core_session_read_lock(session); - switch_set_flag(tech_pvt, TFLAG_RWLOCK); + //switch_core_session_read_lock(session); + //switch_set_flag(tech_pvt, TFLAG_RWLOCK); channel = switch_core_session_get_channel(session); switch_channel_set_variable(channel, "endpoint_disposition", "INBOUND CALL"); set_chat_hash(tech_pvt, sip); diff --git a/src/switch_ivr.c b/src/switch_ivr.c index 186d600a91..b7b557983d 100644 --- a/src/switch_ivr.c +++ b/src/switch_ivr.c @@ -3286,10 +3286,19 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_multi_threaded_bridge(switch_core_ses switch_channel_event_set_data(caller_channel, event); switch_event_fire(&event); } + + if (switch_channel_get_state(caller_channel) != CS_EXECUTE && !switch_channel_test_flag(caller_channel, CF_TRANSFER)) { switch_channel_hangup(caller_channel, SWITCH_CAUSE_NORMAL_CLEARING); } + if (switch_channel_test_flag(caller_channel, CF_TRANSFER) && !switch_channel_test_flag(peer_channel, CF_TRANSFER)) { + switch_channel_hangup(peer_channel, SWITCH_CAUSE_NORMAL_CLEARING); + } + if (!switch_channel_test_flag(caller_channel, CF_TRANSFER) && switch_channel_test_flag(peer_channel, CF_TRANSFER)) { + switch_channel_hangup(caller_channel, SWITCH_CAUSE_NORMAL_CLEARING); + } + this_audio_thread->objs[0] = NULL; this_audio_thread->objs[1] = NULL; this_audio_thread->objs[2] = NULL;