]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-3494
authorAnthony Minessale <anthm@freeswitch.org>
Wed, 10 Aug 2011 12:36:48 +0000 (07:36 -0500)
committerAnthony Minessale <anthm@freeswitch.org>
Wed, 10 Aug 2011 12:36:48 +0000 (07:36 -0500)
src/mod/endpoints/mod_loopback/mod_loopback.c

index 97684b6f10ce01b75e99f22ed08f10ffbaac74ac..17f0b91e7af7677755c128bdae25b091a630a022 100644 (file)
@@ -802,15 +802,20 @@ static switch_status_t loopback_bowout_on_execute_state_handler(switch_core_sess
                switch_core_session_read_lock(tech_pvt->other_session);
                b_channel = switch_core_session_get_channel(tech_pvt->other_session);
 
+               /* Wait for b_channel to be fully bridged */
+               switch_channel_wait_for_flag(b_channel, CF_BRIDGED, SWITCH_TRUE, 5000, NULL);
+
                uuid = switch_channel_get_variable(b_channel, SWITCH_SIGNAL_BOND_VARIABLE);
 
                if (uuid && (other_session = switch_core_session_locate(uuid))) {
                        switch_channel_t *other_channel = switch_core_session_get_channel(other_session);
                        switch_caller_profile_t *cp, *clone;
-                       
+
+                       switch_channel_wait_for_state(other_channel, NULL, CS_EXCHANGE_MEDIA);
+
                        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->other_session), SWITCH_LOG_INFO, "Replacing loopback channel: %s with real channel: %s\n",
                                                          switch_channel_get_name(b_channel), switch_channel_get_name(other_channel));
-                       
+
                        if ((cp = switch_channel_get_caller_profile(channel))) {
                                clone = switch_caller_profile_clone(other_session, cp);
                                clone->originator_caller_profile = NULL;
@@ -831,7 +836,7 @@ static switch_status_t loopback_bowout_on_execute_state_handler(switch_core_sess
                switch_core_session_rwunlock(tech_pvt->other_session);
 
                switch_core_event_hook_remove_state_change(session, loopback_bowout_on_execute_state_handler);
-               
+
        }
        return SWITCH_STATUS_SUCCESS;
 }