Revision
15326
Author
brian
Date
2009-11-02 17:58:30 -0600 (Mon, 02 Nov 2009)

Log Message

fix some bypass xfer scenarios

Modified Paths

Diff

Modified: freeswitch/trunk/src/switch_core_state_machine.c (15325 => 15326)


--- freeswitch/trunk/src/switch_core_state_machine.c	2009-11-02 23:31:44 UTC (rev 15325)
+++ freeswitch/trunk/src/switch_core_state_machine.c	2009-11-02 23:58:30 UTC (rev 15326)
@@ -77,6 +77,10 @@
 
 	switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s Standard ROUTING\n", switch_channel_get_name(session->channel));
 
+	if (switch_channel_test_flag(session->channel, CF_PROXY_MODE)) {
+		switch_ivr_media(session->uuid_str, SMF_NONE);
+	}
+
 	if ((caller_profile = switch_channel_get_caller_profile(session->channel)) == 0) {
 		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Can't get profile!\n");
 		switch_channel_hangup(session->channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);

Modified: freeswitch/trunk/src/switch_ivr_bridge.c (15325 => 15326)


--- freeswitch/trunk/src/switch_ivr_bridge.c	2009-11-02 23:31:44 UTC (rev 15325)
+++ freeswitch/trunk/src/switch_ivr_bridge.c	2009-11-02 23:58:30 UTC (rev 15326)
@@ -677,7 +677,7 @@
 		return SWITCH_STATUS_SUCCESS;
 	}
 
-	switch_channel_clear_flag(channel, CF_BRIDGE_ORIGINATOR);
+	switch_channel_clear_flag_recursive(channel, CF_BRIDGE_ORIGINATOR);
 	
 	if ((other_uuid = switch_channel_get_variable(channel, SWITCH_UUID_BRIDGE)) && (other_session = switch_core_session_locate(other_uuid))) {
 		switch_channel_t *other_channel = switch_core_session_get_channel(other_session);
@@ -799,7 +799,7 @@
 				} else if ((var = switch_channel_get_variable(other_channel, SWITCH_TRANSFER_AFTER_BRIDGE_VARIABLE))) {
 					transfer_after_bridge(other_session, var);
 				}
-
+				
 				if (switch_channel_test_flag(other_channel, CF_BRIDGE_ORIGINATOR) &&
 					switch_true(switch_channel_get_variable(other_channel, SWITCH_HANGUP_AFTER_BRIDGE_VARIABLE))) {
 					switch_channel_hangup(other_channel, switch_channel_get_cause(channel));	
@@ -813,7 +813,7 @@
     }
 	
 	if (switch_channel_test_flag(channel, CF_BRIDGE_ORIGINATOR)) {
-		switch_channel_clear_flag(channel, CF_BRIDGE_ORIGINATOR);
+		switch_channel_clear_flag_recursive(channel, CF_BRIDGE_ORIGINATOR);
 		if (switch_event_create(&event, SWITCH_EVENT_CHANNEL_UNBRIDGE) == SWITCH_STATUS_SUCCESS) {
 			switch_channel_event_set_data(channel, event);
 			switch_event_fire(&event);
@@ -853,7 +853,8 @@
 	switch_channel_set_variable(caller_channel, SWITCH_SIGNAL_BRIDGE_VARIABLE, switch_core_session_get_uuid(peer_session));
 	switch_channel_set_variable(peer_channel, SWITCH_SIGNAL_BRIDGE_VARIABLE, switch_core_session_get_uuid(session));
 
-	switch_channel_set_flag(caller_channel, CF_BRIDGE_ORIGINATOR);
+	switch_channel_set_flag_recursive(caller_channel, CF_BRIDGE_ORIGINATOR);
+	switch_channel_clear_flag(peer_channel, CF_BRIDGE_ORIGINATOR);
 
 	switch_channel_clear_state_handler(caller_channel, NULL);
 	switch_channel_clear_state_handler(peer_channel, NULL);
@@ -920,7 +921,8 @@
 		return switch_ivr_signal_bridge(session, peer_session);
 	}
 	
-	switch_channel_set_flag(caller_channel, CF_BRIDGE_ORIGINATOR);
+	switch_channel_set_flag_recursive(caller_channel, CF_BRIDGE_ORIGINATOR);
+	switch_channel_clear_flag(peer_channel, CF_BRIDGE_ORIGINATOR);
 
 	b_leg->session = peer_session;
 	switch_copy_string(b_leg->b_uuid, switch_core_session_get_uuid(session), sizeof(b_leg->b_uuid));
@@ -1046,7 +1048,7 @@
 			switch_channel_set_state(peer_channel, CS_EXCHANGE_MEDIA);
 			audio_bridge_thread(NULL, (void *) a_leg);
 			
-			switch_channel_clear_flag(caller_channel, CF_BRIDGE_ORIGINATOR);
+			switch_channel_clear_flag_recursive(caller_channel, CF_BRIDGE_ORIGINATOR);
 
 			while (switch_channel_get_state(peer_channel) == CS_EXCHANGE_MEDIA) {
 				switch_cond_next();
@@ -1255,7 +1257,7 @@
 			switch_channel_clear_state_handler(originator_channel, NULL);
 			switch_channel_clear_state_handler(originatee_channel, NULL);
 			switch_channel_set_state_flag(originator_channel, CF_BRIDGE_ORIGINATOR);
-			switch_channel_clear_flag(originatee_channel, CF_BRIDGE_ORIGINATOR);
+			switch_channel_clear_flag_recursive(originatee_channel, CF_BRIDGE_ORIGINATOR);
 			switch_channel_add_state_handler(originator_channel, &uuid_bridge_state_handlers);
 			switch_channel_add_state_handler(originatee_channel, &uuid_bridge_state_handlers);