[Freeswitch-trunk] [commit] r6906 - in freeswitch/trunk/src: . include

Freeswitch SVN anthm at freeswitch.org
Wed Dec 19 18:24:55 EST 2007


Author: anthm
Date: Wed Dec 19 18:24:55 2007
New Revision: 6906

Modified:
   freeswitch/trunk/src/include/switch_types.h
   freeswitch/trunk/src/switch_channel.c
   freeswitch/trunk/src/switch_core_state_machine.c
   freeswitch/trunk/src/switch_ivr_bridge.c

Log:
update

Modified: freeswitch/trunk/src/include/switch_types.h
==============================================================================
--- freeswitch/trunk/src/include/switch_types.h	(original)
+++ freeswitch/trunk/src/include/switch_types.h	Wed Dec 19 18:24:55 2007
@@ -580,7 +580,8 @@
 	CS_HIBERNATE,
 	CS_RESET,
 	CS_HANGUP,
-	CS_DONE
+	CS_DONE,
+	CS_NONE
 } switch_channel_state_t;
 
 

Modified: freeswitch/trunk/src/switch_channel.c
==============================================================================
--- freeswitch/trunk/src/switch_channel.c	(original)
+++ freeswitch/trunk/src/switch_channel.c	Wed Dec 19 18:24:55 2007
@@ -288,6 +288,7 @@
 	channel->state = state;
 	channel->flags = flags;
 	channel->session = session;
+	channel->running_state = CS_NONE;
 	return SWITCH_STATUS_SUCCESS;
 }
 
@@ -592,7 +593,13 @@
 					  channel->name, state_names[channel->state]);
 	channel->running_state = channel->state;
 
+	if (channel->state_flags) {
+		channel->flags |= channel->state_flags;
+		channel->state_flags = 0;
+	}
+	
 	if (channel->state >= CS_RING) {
+		switch_clear_flag(channel, CF_TRANSFER);
 		switch_channel_presence(channel, "unknown", (char *) state_names[channel->state]);
 	}
 	
@@ -770,7 +777,6 @@
 		break;
 
 	case CS_RING:
-		switch_clear_flag(channel, CF_TRANSFER);
 		switch (state) {
 		case CS_LOOPBACK:
 		case CS_EXECUTE:
@@ -842,12 +848,6 @@
 	}
   done:
 
-	if (channel->state_flags) {
-		channel->flags |= channel->state_flags;
-		channel->state_flags = 0;
-
-	}
-
 	switch_mutex_unlock(channel->flag_mutex);
 	return channel->state;
 }

Modified: freeswitch/trunk/src/switch_core_state_machine.c
==============================================================================
--- freeswitch/trunk/src/switch_core_state_machine.c	(original)
+++ freeswitch/trunk/src/switch_core_state_machine.c	Wed Dec 19 18:24:55 2007
@@ -330,7 +330,7 @@
 
 SWITCH_DECLARE(void) switch_core_session_run(switch_core_session_t *session)
 {
-	switch_channel_state_t state = CS_NEW, laststate = CS_HANGUP, midstate = CS_DONE, endstate;
+	switch_channel_state_t state = CS_NEW, midstate = CS_DONE, endstate;
 	const switch_endpoint_interface_t *endpoint_interface;
 	const switch_state_handler_table_t *driver_state_handler = NULL;
 	const switch_state_handler_table_t *application_state_handler = NULL;
@@ -395,7 +395,7 @@
 			switch_channel_clear_flag(session->channel, CF_REPEAT_STATE);
 			exception = 1;
 		}
-		if (state != laststate || state == CS_HANGUP || exception) {
+		if (state != switch_channel_get_running_state(session->channel) || state == CS_HANGUP || exception) {
 			int index = 0;
 			int proceed = 1;
 			
@@ -437,20 +437,22 @@
 			case CS_HIBERNATE:	/* sleep */
 				STATE_MACRO(hibernate, "HIBERNATE");
 				break;
+			case CS_NONE:
+				abort();
+				break;
 			}
 			
 			if (midstate == CS_DONE) {
 				break;
 			}
 
-			laststate = midstate;
 		}
 
 
 		endstate = switch_channel_get_state(session->channel);
 
-
-		if (midstate == endstate) {
+		
+		if (endstate == switch_channel_get_running_state(session->channel)) {
 			if (endstate == CS_NEW) {
 				switch_yield(1000);
 			} else {

Modified: freeswitch/trunk/src/switch_ivr_bridge.c
==============================================================================
--- freeswitch/trunk/src/switch_ivr_bridge.c	(original)
+++ freeswitch/trunk/src/switch_ivr_bridge.c	Wed Dec 19 18:24:55 2007
@@ -447,6 +447,8 @@
 		switch_channel_set_variable(channel, SWITCH_BRIDGE_VARIABLE, NULL);
 		switch_channel_set_variable(other_channel, SWITCH_BRIDGE_VARIABLE, NULL);
 
+		assert (!switch_channel_test_flag(other_channel, CF_TRANSFER));
+
 		if (!switch_channel_test_flag(other_channel, CF_TRANSFER)) {
 			if (switch_channel_test_flag(other_channel, CF_ANSWERED) && 
 				switch_channel_get_state(other_channel) < CS_HANGUP &&
@@ -455,7 +457,7 @@
 			} else {
 				switch_channel_set_state(other_channel, CS_EXECUTE);
 			}
-		}
+		} 
 		switch_core_session_rwunlock(other_session);
 	}
 



More information about the Freeswitch-trunk mailing list