]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-9654 introduce origination_aleg_uuid
authorAnthony Minessale <anthm@freeswitch.org>
Tue, 17 Jan 2017 22:45:22 +0000 (16:45 -0600)
committerAnthony Minessale <anthm@freeswitch.org>
Tue, 17 Jan 2017 22:45:22 +0000 (16:45 -0600)
src/switch_core_session.c
src/switch_ivr_bridge.c

index 2ffcc7d37e555d962c5d86de22bfa8c8686929fa..95aa65794b97e2e08d09e3103ffded0b67e78741 100644 (file)
@@ -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);
index 13c72247135108cd54b265de2744715619864063..bdd50695d839721a349123784205c0b2e22c1d49 100644 (file)
@@ -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);