[Freeswitch-branches] [commit] r11375 - freeswitch/branches/1.0/src

FreeSWITCH SVN mikej at freeswitch.org
Thu Jan 22 11:30:47 PST 2009


Author: mikej
Date: Thu Jan 22 13:30:46 2009
New Revision: 11375

Log:
core: fix c leg no hangup when converting attended to blind transfer before b leg answers (MODENDP-165/r:11061)

Modified:
   freeswitch/branches/1.0/src/switch_ivr_bridge.c
   freeswitch/branches/1.0/src/switch_ivr_originate.c

Modified: freeswitch/branches/1.0/src/switch_ivr_bridge.c
==============================================================================
--- freeswitch/branches/1.0/src/switch_ivr_bridge.c	(original)
+++ freeswitch/branches/1.0/src/switch_ivr_bridge.c	Thu Jan 22 13:30:46 2009
@@ -829,8 +829,8 @@
 			switch_channel_set_variable(peer_channel, SWITCH_BRIDGE_VARIABLE, switch_core_session_get_uuid(session));
 
 			if (!switch_channel_media_ready(caller_channel) || 
-				!(switch_channel_test_flag(peer_channel, CF_ANSWERED) || switch_channel_test_flag(peer_channel, CF_EARLY_MEDIA))) {
-				if ((status = switch_ivr_wait_for_answer(session, peer_session)) != SWITCH_STATUS_SUCCESS) {
+				(!switch_channel_test_flag(peer_channel, CF_ANSWERED) && !switch_channel_test_flag(peer_channel, CF_EARLY_MEDIA))) {
+				if ((status = switch_ivr_wait_for_answer(session, peer_session)) != SWITCH_STATUS_SUCCESS || !switch_channel_ready(caller_channel)) {
 					switch_channel_state_t w_state = switch_channel_get_state(caller_channel);
 					switch_channel_hangup(peer_channel, SWITCH_CAUSE_ALLOTTED_TIMEOUT);
 					if (w_state < CS_HANGUP && w_state != CS_ROUTING && w_state != CS_PARK && 
@@ -850,6 +850,7 @@
 					switch_core_session_rwunlock(peer_session);
 					goto done;
 				}
+
 				if (switch_channel_test_flag(peer_channel, CF_ANSWERED) && !switch_channel_test_flag(caller_channel, CF_ANSWERED)) {
 					switch_channel_answer(caller_channel);
 				}

Modified: freeswitch/branches/1.0/src/switch_ivr_originate.c
==============================================================================
--- freeswitch/branches/1.0/src/switch_ivr_originate.c	(original)
+++ freeswitch/branches/1.0/src/switch_ivr_originate.c	Thu Jan 22 13:30:46 2009
@@ -330,7 +330,7 @@
 	}
 
 	if ((switch_channel_test_flag(peer_channel, CF_ANSWERED) || switch_channel_test_flag(peer_channel, CF_EARLY_MEDIA))) {
-		return SWITCH_STATUS_SUCCESS;
+		goto end;
 	}
 
 	switch_zmalloc(write_frame.data, SWITCH_RECOMMENDED_BUFFER_SIZE);
@@ -551,7 +551,9 @@
 
 	switch_safe_free(write_frame.data);
 
-	return status;
+ end:
+
+	return (!caller_channel || switch_channel_ready(caller_channel)) ? status : SWITCH_STATUS_FALSE;
 }
 
 static void process_import(switch_core_session_t *session, switch_channel_t *peer_channel)



More information about the Freeswitch-branches mailing list