diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index cf25aae369..9061270a91 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -7150,7 +7150,7 @@ void sofia_handle_sip_i_invite(nua_t *nua, sofia_profile_t *profile, nua_handle_ const char *data = switch_channel_get_variable(b_channel, SWITCH_CURRENT_APPLICATION_DATA_VARIABLE); if (app && data && !strcasecmp(app, "conference")) { - destination_number = switch_core_session_sprintf(b_session, "answer,conference:%s", data); + destination_number = switch_core_session_sprintf(session, "answer,conference:%s", data); dialplan = "inline"; } else { if (switch_core_session_check_interface(b_session, sofia_endpoint_interface)) { @@ -7188,7 +7188,7 @@ void sofia_handle_sip_i_invite(nua_t *nua, sofia_profile_t *profile, nua_handle_ if (!one_leg && (!b_tech_pvt || !sofia_test_flag(b_tech_pvt, TFLAG_SIP_HOLD)) && (!c_tech_pvt || !sofia_test_flag(c_tech_pvt, TFLAG_SIP_HOLD))) { - char *ext = switch_core_session_sprintf(b_session, "answer,conference:%s@sla+flags{mintwo}", uuid); + char *ext = switch_core_session_sprintf(session, "answer,conference:%s@sla+flags{mintwo}", uuid); switch_channel_set_flag(c_channel, CF_REDIRECT); switch_ivr_session_transfer(b_session, ext, "inline", NULL); @@ -7200,16 +7200,17 @@ void sofia_handle_sip_i_invite(nua_t *nua, sofia_profile_t *profile, nua_handle_ } if (do_conf) { - destination_number = switch_core_session_sprintf(b_session, "answer,conference:%s@sla+flags{mintwo}", uuid); + destination_number = switch_core_session_sprintf(session, "answer,conference:%s@sla+flags{mintwo}", uuid); } else { if (one_leg && c_app) { if (c_data) { - destination_number = switch_core_session_sprintf(b_session, "answer,%s:%s", c_app, c_data); + destination_number = switch_core_session_sprintf(session, "answer,%s:%s", c_app, c_data); } else { - destination_number = switch_core_session_sprintf(b_session, "answer,%s", c_app); + destination_number = switch_core_session_sprintf(session, "answer,%s", c_app); } } else { - destination_number = switch_core_session_sprintf(b_session, "answer,intercept:%s", uuid); + switch_channel_mark_hold(b_channel, SWITCH_FALSE); + destination_number = switch_core_session_sprintf(session, "answer,intercept:%s", uuid); } } diff --git a/src/switch_channel.c b/src/switch_channel.c index bc8daabbc6..2a53c34e93 100644 --- a/src/switch_channel.c +++ b/src/switch_channel.c @@ -634,6 +634,10 @@ SWITCH_DECLARE(void) switch_channel_mark_hold(switch_channel_t *channel, switch_ { switch_event_t *event; + if (!!on == !!switch_channel_test_flag(channel, CF_LEG_HOLDING)) { + return; + } + if (on) { switch_channel_set_flag(channel, CF_LEG_HOLDING); } else { diff --git a/src/switch_ivr_bridge.c b/src/switch_ivr_bridge.c index f1a6bdba22..d10b5e0e5e 100644 --- a/src/switch_ivr_bridge.c +++ b/src/switch_ivr_bridge.c @@ -1576,6 +1576,8 @@ SWITCH_DECLARE(void) switch_ivr_intercept_session(switch_core_session_t *session switch_channel_answer(rchannel); } + switch_channel_mark_hold(rchannel, SWITCH_FALSE); + switch_channel_set_state_flag(rchannel, CF_TRANSFER); switch_channel_set_state(rchannel, CS_PARK);