diff --git a/src/switch_core_session.c b/src/switch_core_session.c index 2ffcc7d37e..95aa65794b 100644 --- a/src/switch_core_session.c +++ b/src/switch_core_session.c @@ -624,6 +624,7 @@ SWITCH_DECLARE(switch_call_cause_t) switch_core_session_outgoing_channel(switch_ switch_event_t *event; switch_channel_t *peer_channel = switch_core_session_get_channel(*new_session); const char *use_uuid; + switch_core_session_t *other_session = NULL; switch_assert(peer_channel); @@ -644,6 +645,15 @@ SWITCH_DECLARE(switch_call_cause_t) switch_core_session_outgoing_channel(switch_ } } + if (!channel && var_event) { + const char *other_uuid; + + if ((other_uuid = switch_event_get_header(var_event, "origination_aleg_uuid")) && (other_session = switch_core_session_locate(other_uuid))) { + channel = switch_core_session_get_channel(other_session); + session = other_session; + } + } + if (channel) { const char *val; switch_codec_t *vid_read_codec = NULL, *read_codec = switch_core_session_get_read_codec(session); @@ -740,6 +750,13 @@ SWITCH_DECLARE(switch_call_cause_t) switch_core_session_outgoing_channel(switch_ } + if (other_session) { + switch_core_session_rwunlock(other_session); + channel = NULL; + session = NULL; + } + + if (switch_event_create(&event, SWITCH_EVENT_CHANNEL_OUTGOING) == SWITCH_STATUS_SUCCESS) { switch_channel_event_set_data(peer_channel, event); switch_event_fire(&event); diff --git a/src/switch_ivr_bridge.c b/src/switch_ivr_bridge.c index 13c7224713..bdd50695d8 100644 --- a/src/switch_ivr_bridge.c +++ b/src/switch_ivr_bridge.c @@ -2181,6 +2181,10 @@ SWITCH_DECLARE(void) switch_ivr_intercept_session(switch_core_session_t *session rchannel = switch_core_session_get_channel(rsession); buuid = switch_channel_get_partner_uuid(rchannel); + if (!strcasecmp(buuid, switch_core_session_get_uuid(session))) { + buuid = NULL; + } + if ((var = switch_channel_get_variable(channel, "intercept_unbridged_only")) && switch_true(var)) { if ((switch_channel_test_flag(rchannel, CF_BRIDGED))) { switch_core_session_rwunlock(rsession);