[Freeswitch-svn] [commit] r12271 - in freeswitch/trunk/src: . include mod/applications/mod_dptools mod/endpoints/mod_dingaling mod/endpoints/mod_iax mod/endpoints/mod_sofia mod/event_handlers/mod_erlang_event mod/event_handlers/mod_event_socket mod/languages/mod_spidermonkey

FreeSWITCH SVN anthm at freeswitch.org
Tue Feb 24 19:41:18 PST 2009


Author: anthm
Date: Tue Feb 24 21:41:18 2009
New Revision: 12271

Log:
fix issue in monitor_early_media_fail issue

Modified:
   freeswitch/trunk/src/include/switch_channel.h
   freeswitch/trunk/src/mod/applications/mod_dptools/mod_dptools.c
   freeswitch/trunk/src/mod/endpoints/mod_dingaling/mod_dingaling.c
   freeswitch/trunk/src/mod/endpoints/mod_iax/mod_iax.c
   freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c
   freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c
   freeswitch/trunk/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c
   freeswitch/trunk/src/mod/event_handlers/mod_event_socket/mod_event_socket.c
   freeswitch/trunk/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c
   freeswitch/trunk/src/switch_channel.c
   freeswitch/trunk/src/switch_core_io.c
   freeswitch/trunk/src/switch_core_rwlock.c
   freeswitch/trunk/src/switch_core_session.c
   freeswitch/trunk/src/switch_core_state_machine.c
   freeswitch/trunk/src/switch_ivr_async.c
   freeswitch/trunk/src/switch_ivr_bridge.c
   freeswitch/trunk/src/switch_ivr_originate.c

Modified: freeswitch/trunk/src/include/switch_channel.h
==============================================================================
--- freeswitch/trunk/src/include/switch_channel.h	(original)
+++ freeswitch/trunk/src/include/switch_channel.h	Tue Feb 24 21:41:18 2009
@@ -78,7 +78,8 @@
 
 #define switch_channel_ready(_channel) switch_channel_test_ready(_channel, SWITCH_FALSE)
 #define switch_channel_media_ready(_channel) switch_channel_test_ready(_channel, SWITCH_TRUE)
-
+#define switch_channel_up(_channel) (switch_channel_get_state(_channel) < CS_HANGUP)
+#define switch_channel_down(_channel) (switch_channel_get_state(_channel) >= CS_HANGUP)
 
 SWITCH_DECLARE(void) switch_channel_wait_for_state(switch_channel_t *channel, switch_channel_t *other_channel, switch_channel_state_t want_state);
 SWITCH_DECLARE(switch_status_t) switch_channel_wait_for_flag(switch_channel_t *channel, 

Modified: freeswitch/trunk/src/mod/applications/mod_dptools/mod_dptools.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_dptools/mod_dptools.c	(original)
+++ freeswitch/trunk/src/mod/applications/mod_dptools/mod_dptools.c	Tue Feb 24 21:41:18 2009
@@ -1532,7 +1532,7 @@
 	switch_channel_clear_flag(peer_channel, CF_INNER_BRIDGE);
 	switch_channel_clear_flag(channel, CF_INNER_BRIDGE);
 
-	if (!switch_channel_get_state(peer_channel) >= CS_HANGUP) {
+	if (!switch_channel_down(peer_channel)) {
 		switch_core_session_rwunlock(peer_session);
 		goto end;
 	}

Modified: freeswitch/trunk/src/mod/endpoints/mod_dingaling/mod_dingaling.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_dingaling/mod_dingaling.c	(original)
+++ freeswitch/trunk/src/mod/endpoints/mod_dingaling/mod_dingaling.c	Tue Feb 24 21:41:18 2009
@@ -1091,7 +1091,7 @@
 		now = switch_micro_time_now();
 		elapsed = (unsigned int) ((now - started) / 1000);
 
-		if (switch_channel_get_state(channel) >= CS_HANGUP || switch_test_flag(tech_pvt, TFLAG_BYE)) {
+		if (switch_channel_down(channel) || switch_test_flag(tech_pvt, TFLAG_BYE)) {
 			goto out;
 		}
 
@@ -1119,7 +1119,7 @@
 		switch_cond_next();
 	}
 
-	if (switch_channel_get_state(channel) >= CS_HANGUP || switch_test_flag(tech_pvt, TFLAG_BYE)) {
+	if (switch_channel_down(channel) || switch_test_flag(tech_pvt, TFLAG_BYE)) {
 		goto out;
 	}
 
@@ -2542,7 +2542,7 @@
 
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "using Existing session for %s\n", ldl_session_get_id(dlsession));
 
-		if (switch_channel_get_state(channel) >= CS_HANGUP) {
+		if (switch_channel_down(channel)) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Call %s is already over\n", switch_channel_get_name(channel));
 			status = LDL_STATUS_FALSE;
 			goto done;

Modified: freeswitch/trunk/src/mod/endpoints/mod_iax/mod_iax.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_iax/mod_iax.c	(original)
+++ freeswitch/trunk/src/mod/endpoints/mod_iax/mod_iax.c	Tue Feb 24 21:41:18 2009
@@ -1081,7 +1081,7 @@
 				break;
 			case IAX_EVENT_VOICE:
 				if (tech_pvt && (tech_pvt->read_frame.datalen = iaxevent->datalen) != 0) {
-					if (channel && switch_channel_get_state(channel) <= CS_HANGUP) {
+					if (channel && switch_channel_up(channel)) {
 						int bytes = 0, frames = 1;
 
 						if (!switch_test_flag(tech_pvt, TFLAG_CODEC) || !tech_pvt->read_codec.implementation) {

Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c	(original)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c	Tue Feb 24 21:41:18 2009
@@ -959,7 +959,7 @@
 	private_object_t *tech_pvt = switch_core_session_get_private(session);
 	switch_status_t status = SWITCH_STATUS_SUCCESS;
 
-	if (switch_channel_get_state(channel) >= CS_HANGUP || !tech_pvt) {
+	if (switch_channel_down(channel) || !tech_pvt) {
 		status = SWITCH_STATUS_FALSE;
 		goto end;
 	}
@@ -997,7 +997,7 @@
 	/* ones that do need to lock sofia mutex */
 	switch_mutex_lock(tech_pvt->sofia_mutex);
 
-	if (switch_channel_get_state(channel) >= CS_HANGUP || !tech_pvt) {
+	if (switch_channel_down(channel) || !tech_pvt) {
 		status = SWITCH_STATUS_FALSE;
 		goto end_lock;
 	}

Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c	(original)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c	Tue Feb 24 21:41:18 2009
@@ -364,7 +364,7 @@
 	}
 
 	if (session) {
-		if (channel && switch_channel_get_state(channel) >= CS_HANGUP) {
+		if (channel && switch_channel_down(channel)) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Channel is already hungup.\n");
 			goto done;
 		}
@@ -3325,7 +3325,7 @@
 
 			status = switch_ivr_originate(a_session, &tsession, &cause, nhelper->exten, timeout, NULL, NULL, NULL, NULL, NULL, SOF_NONE);
 							
-			if ((switch_channel_get_state(channel_a) < CS_HANGUP)) {
+			if ((switch_channel_up(channel_a))) {
 				
 				if (status != SWITCH_STATUS_SUCCESS || cause != SWITCH_CAUSE_SUCCESS) {
 					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot Create Outgoing Channel! [%s]\n", nhelper->exten);

Modified: freeswitch/trunk/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c
==============================================================================
--- freeswitch/trunk/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c	(original)
+++ freeswitch/trunk/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c	Tue Feb 24 21:41:18 2009
@@ -1234,7 +1234,7 @@
 			switch_ivr_park(session, NULL);
 
 			/* keep app thread running for lifetime of session */
-			if (switch_channel_get_state(switch_core_session_get_channel(session)) >= CS_HANGUP) {
+			if (switch_channel_down(switch_core_session_get_channel(session))) {
 				while (switch_test_flag(session_element, LFLAG_SESSION_ALIVE)) {
 					switch_yield(100000);
 				}

Modified: freeswitch/trunk/src/mod/event_handlers/mod_event_socket/mod_event_socket.c
==============================================================================
--- freeswitch/trunk/src/mod/event_handlers/mod_event_socket/mod_event_socket.c	(original)
+++ freeswitch/trunk/src/mod/event_handlers/mod_event_socket/mod_event_socket.c	Tue Feb 24 21:41:18 2009
@@ -430,7 +430,7 @@
 		listener_run(NULL, (void *) listener);
 	}
 
-	if (switch_channel_get_state(channel) >= CS_HANGUP) {
+	if (switch_channel_down(channel)) {
 		while (switch_test_flag(listener, LFLAG_SESSION)) {
 			switch_yield(100000);
 		}
@@ -1192,7 +1192,7 @@
 			}
 		}
 
-		if (channel && switch_channel_get_state(channel) >= CS_HANGUP && !switch_test_flag(listener, LFLAG_HANDLE_DISCO)) {
+		if (channel && switch_channel_down(channel) && !switch_test_flag(listener, LFLAG_HANDLE_DISCO)) {
 			switch_set_flag_locked(listener, LFLAG_HANDLE_DISCO);
 			if (switch_test_flag(listener, LFLAG_LINGER)) {
 				char message[128] = "";

Modified: freeswitch/trunk/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c	(original)
+++ freeswitch/trunk/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c	Tue Feb 24 21:41:18 2009
@@ -2152,7 +2152,7 @@
 	saveDepth = JS_SuspendRequest(cx);
 	for (;;) {
 		if (((elapsed = (unsigned int) ((switch_micro_time_now() - started) / 1000)) > (switch_time_t) timeout)
-			|| switch_channel_get_state(channel) >= CS_HANGUP) {
+			|| switch_channel_down(channel)) {
 			*rval = BOOLEAN_TO_JSVAL(JS_FALSE);
 			break;
 		}
@@ -2200,7 +2200,7 @@
 	saveDepth = JS_SuspendRequest(cx);
 	for (;;) {
 		if (((elapsed = (unsigned int) ((switch_micro_time_now() - started) / 1000)) > (switch_time_t) timeout)
-			|| switch_channel_get_state(channel) >= CS_HANGUP) {
+			|| switch_channel_down(channel)) {
 			*rval = BOOLEAN_TO_JSVAL(JS_FALSE);
 			break;
 		}

Modified: freeswitch/trunk/src/switch_channel.c
==============================================================================
--- freeswitch/trunk/src/switch_channel.c	(original)
+++ freeswitch/trunk/src/switch_channel.c	Tue Feb 24 21:41:18 2009
@@ -1590,7 +1590,6 @@
 		switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_NOTICE, "Hangup %s [%s] [%s]\n",
 						  channel->name, state_names[last_state], switch_channel_cause2str(channel->hangup_cause));
 		
-		switch_core_media_bug_remove_all(channel->session);
 		switch_channel_set_variable(channel, "hangup_cause", switch_channel_cause2str(channel->hangup_cause));
 		switch_channel_presence(channel, "unavailable", switch_channel_cause2str(channel->hangup_cause), NULL);
 

Modified: freeswitch/trunk/src/switch_core_io.c
==============================================================================
--- freeswitch/trunk/src/switch_core_io.c	(original)
+++ freeswitch/trunk/src/switch_core_io.c	Tue Feb 24 21:41:18 2009
@@ -41,7 +41,7 @@
 	switch_io_event_hook_video_write_frame_t *ptr;
 	switch_status_t status = SWITCH_STATUS_FALSE;
 
-	if (switch_channel_get_state(session->channel) >= CS_HANGUP) {
+	if (switch_channel_down(session->channel)) {
 		return SWITCH_STATUS_FALSE;
 	}
 
@@ -65,7 +65,7 @@
 
 	switch_assert(session != NULL);
 
-	if (switch_channel_get_state(session->channel) >= CS_HANGUP) {
+	if (switch_channel_down(session->channel)) {
 		return SWITCH_STATUS_FALSE;
 	}
 
@@ -123,7 +123,7 @@
 
   top:
 
-	if (switch_channel_get_state(session->channel) >= CS_HANGUP) {
+	if (switch_channel_down(session->channel)) {
 		*frame = NULL;
 		status = SWITCH_STATUS_FALSE; goto even_more_done;
 	}
@@ -1066,7 +1066,7 @@
 	switch_status_t status;
 	switch_dtmf_t new_dtmf;
 
-	if (switch_channel_get_state(session->channel) >= CS_HANGUP) {
+	if (switch_channel_down(session->channel)) {
 		return SWITCH_STATUS_FALSE;
 	}
 
@@ -1096,7 +1096,7 @@
 	switch_status_t status = SWITCH_STATUS_FALSE;
 	switch_dtmf_t new_dtmf;
 
-	if (switch_channel_get_state(session->channel) >= CS_HANGUP) {
+	if (switch_channel_down(session->channel)) {
 		return SWITCH_STATUS_FALSE;
 	}
 
@@ -1144,7 +1144,7 @@
 	switch_assert(session != NULL);
 
 
-	if (switch_channel_get_state(session->channel) >= CS_HANGUP) {
+	if (switch_channel_down(session->channel)) {
 		return SWITCH_STATUS_FALSE;
 	}
 

Modified: freeswitch/trunk/src/switch_core_rwlock.c
==============================================================================
--- freeswitch/trunk/src/switch_core_rwlock.c	(original)
+++ freeswitch/trunk/src/switch_core_rwlock.c	Tue Feb 24 21:41:18 2009
@@ -45,7 +45,7 @@
 	switch_status_t status = SWITCH_STATUS_FALSE;
 
 	if (session->rwlock) {
-		if (switch_test_flag(session, SSF_DESTROYED) || switch_channel_get_state(session->channel) >= CS_HANGUP) {
+		if (switch_test_flag(session, SSF_DESTROYED) || switch_channel_down(session->channel)) {
 			status = SWITCH_STATUS_FALSE;
 #ifdef SWITCH_DEBUG_RWLOCKS
 			switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_ERROR, "%s Read lock FAIL\n",

Modified: freeswitch/trunk/src/switch_core_session.c
==============================================================================
--- freeswitch/trunk/src/switch_core_session.c	(original)
+++ freeswitch/trunk/src/switch_core_session.c	Tue Feb 24 21:41:18 2009
@@ -91,7 +91,7 @@
 			const char *this_val;
 			session = (switch_core_session_t *) val;
 			if (switch_core_session_read_lock(session) == SWITCH_STATUS_SUCCESS) {
-				if (switch_channel_get_state(session->channel) < CS_HANGUP &&
+				if (switch_channel_up(session->channel) &&
 					(this_val = switch_channel_get_variable(session->channel, var_name)) && (!strcmp(this_val, var_val))) {
 					switch_channel_hangup(session->channel, cause);
 				}
@@ -163,7 +163,7 @@
 	if ((session = switch_core_hash_find(session_manager.session_table, uuid_str)) != 0) {
 		/* Acquire a read lock on the session or forget it the channel is dead */
 		if (switch_core_session_read_lock(session) == SWITCH_STATUS_SUCCESS) {
-			if (switch_channel_get_state(session->channel) < CS_HANGUP) {
+			if (switch_channel_up(session->channel)) {
 				status = switch_core_session_receive_message(session, message);
 			}
 			switch_core_session_rwunlock(session);
@@ -183,7 +183,7 @@
 	if ((session = switch_core_hash_find(session_manager.session_table, uuid_str)) != 0) {
 		/* Acquire a read lock on the session or forget it the channel is dead */
 		if (switch_core_session_read_lock(session) == SWITCH_STATUS_SUCCESS) {
-			if (switch_channel_get_state(session->channel) < CS_HANGUP) {
+			if (switch_channel_up(session->channel)) {
 				status = switch_core_session_queue_event(session, event);
 			}
 			switch_core_session_rwunlock(session);
@@ -470,7 +470,7 @@
 
 	switch_assert(session != NULL);
 
-	if (switch_channel_get_state(session->channel) >= CS_HANGUP) {
+	if (switch_channel_down(session->channel)) {
 		return SWITCH_STATUS_FALSE;
 	}
 
@@ -626,7 +626,7 @@
 
 	/* Acquire a read lock on the session or forget it the channel is dead */
 	if (switch_core_session_read_lock(session) == SWITCH_STATUS_SUCCESS) {
-		if (switch_channel_get_state(session->channel) < CS_HANGUP) {
+		if (switch_channel_up(session->channel)) {
 			if (session->endpoint_interface->io_routines->receive_event) {
 				status = session->endpoint_interface->io_routines->receive_event(session, *event);
 			}
@@ -1247,7 +1247,7 @@
 {
 	switch_application_interface_t *application_interface;
 
-	if (switch_channel_get_state(session->channel) >= CS_HANGUP) {
+	if (switch_channel_down(session->channel)) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Channel is hungup, aborting execution of application: %s\n", app);
 		return SWITCH_STATUS_FALSE;
 	}

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	Tue Feb 24 21:41:18 2009
@@ -390,7 +390,6 @@
 				break;
 			case CS_DONE:
 				goto done;
-				/* HANGUP INIT ROUTING and RESET are all short term so we signal lock during their callbacks */
 			case CS_HANGUP:	/* Deactivate and end the thread */
 				{
 					const char *var = switch_channel_get_variable(session->channel, SWITCH_PROCESS_CDR_VARIABLE);
@@ -410,10 +409,10 @@
 							do_extra_handlers = 0;
 						}
 					}
+
+					switch_core_media_bug_remove_all(session);
 					
 					STATE_MACRO(hangup, "HANGUP");
-					
-					switch_core_media_bug_remove_all(session);
 
 					hook_var = switch_channel_get_variable(session->channel, SWITCH_API_HANGUP_HOOK_VARIABLE);
 					if (switch_true(switch_channel_get_variable(session->channel, SWITCH_SESSION_IN_HANGUP_HOOK_VARIABLE))) {

Modified: freeswitch/trunk/src/switch_ivr_async.c
==============================================================================
--- freeswitch/trunk/src/switch_ivr_async.c	(original)
+++ freeswitch/trunk/src/switch_ivr_async.c	Tue Feb 24 21:41:18 2009
@@ -1774,13 +1774,14 @@
 
 	sth->ready = 1;
 
-	while (switch_channel_ready(channel) && !switch_test_flag(sth->ah, SWITCH_ASR_FLAG_CLOSED)) {
+	while (switch_channel_up(channel) && !switch_test_flag(sth->ah, SWITCH_ASR_FLAG_CLOSED)) {
 		char *xmlstr = NULL;
 
 		switch_thread_cond_wait(sth->cond, sth->mutex);
 
-		if (switch_test_flag(sth->ah, SWITCH_ASR_FLAG_CLOSED))
+		if (switch_channel_down(channel) || switch_test_flag(sth->ah, SWITCH_ASR_FLAG_CLOSED)) {
 			break;
+		}
 
 		if (switch_core_asr_check_results(sth->ah, &flags) == SWITCH_STATUS_SUCCESS) {
 			switch_event_t *event;

Modified: freeswitch/trunk/src/switch_ivr_bridge.c
==============================================================================
--- freeswitch/trunk/src/switch_ivr_bridge.c	(original)
+++ freeswitch/trunk/src/switch_ivr_bridge.c	Tue Feb 24 21:41:18 2009
@@ -206,7 +206,7 @@
 			goto end_of_bridge_loop;
 		}
 
-		if ((b_state = switch_channel_get_state(chan_b)) >= CS_HANGUP) {
+		if ((b_state = switch_channel_down(chan_b))) {
 			goto end_of_bridge_loop;
 		}
 
@@ -398,7 +398,7 @@
 	}
 
 
-	if (switch_channel_get_state(chan_b) >= CS_HANGUP) {
+	if (switch_channel_down(chan_b)) {
 		if (originator && switch_channel_ready(chan_a) && !switch_channel_test_flag(chan_a, CF_ANSWERED)) {
 			switch_channel_hangup(chan_a, switch_channel_get_cause(chan_b));
 		}
@@ -409,7 +409,7 @@
 	msg.from = __FILE__;
 	switch_core_session_receive_message(session_a, &msg);
 
-	if (!inner_bridge && switch_channel_get_state(chan_a) < CS_HANGUP) {
+	if (!inner_bridge && switch_channel_up(chan_a)) {
 		if ((app_name = switch_channel_get_variable(chan_a, SWITCH_EXEC_AFTER_BRIDGE_APP_VARIABLE))) {
 			switch_caller_extension_t *extension = NULL;
 			if ((extension = switch_caller_extension_new(session_a, app_name, app_name)) == 0) {
@@ -693,7 +693,7 @@
 			switch_channel_set_variable(channel, SWITCH_BRIDGE_VARIABLE, NULL);
 			switch_channel_set_variable(other_channel, SWITCH_BRIDGE_VARIABLE, NULL);
 
-			if (switch_channel_get_state(other_channel) < CS_HANGUP) {
+			if (switch_channel_up(other_channel)) {
 				switch_channel_hangup(other_channel, switch_channel_get_cause(channel));
 			}
 		}
@@ -723,7 +723,7 @@
 	switch_channel_t *peer_channel = switch_core_session_get_channel(peer_session);
 	switch_event_t *event;
 
-	if (switch_channel_get_state(peer_channel) >= CS_HANGUP) {
+	if (switch_channel_down(peer_channel)) {
 		switch_channel_hangup(caller_channel, switch_channel_get_cause(peer_channel));
 		return SWITCH_STATUS_FALSE;
 	}
@@ -1013,7 +1013,7 @@
 			originator_channel = switch_core_session_get_channel(originator_session);
 			originatee_channel = switch_core_session_get_channel(originatee_session);
 
-			if (switch_channel_get_state(originator_channel) >= CS_HANGUP) {
+			if (switch_channel_down(originator_channel)) {
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s is hungup refusing to bridge.\n", switch_channel_get_name(originatee_channel));
 				switch_core_session_rwunlock(originator_session);
 				switch_core_session_rwunlock(originatee_session);

Modified: freeswitch/trunk/src/switch_ivr_originate.c
==============================================================================
--- freeswitch/trunk/src/switch_ivr_originate.c	(original)
+++ freeswitch/trunk/src/switch_ivr_originate.c	Tue Feb 24 21:41:18 2009
@@ -171,7 +171,7 @@
 
 		switch_core_session_exec(collect->session, application_interface, app_data);
 
-		if (switch_channel_get_state(channel) < CS_HANGUP) {
+		if (switch_channel_up(channel)) {
 			switch_channel_set_flag(channel, CF_WINNER);
 		}
 		goto wbreak;
@@ -228,7 +228,7 @@
 	time_t elapsed = switch_epoch_time_now(NULL) - start;
 
 	for (i = 0; i < max; i++) {
-		if (originate_status[i].peer_channel && switch_channel_get_state(originate_status[i].peer_channel) < CS_HANGUP) {
+		if (originate_status[i].peer_channel && switch_channel_up(originate_status[i].peer_channel)) {
 			if (originate_status[i].per_channel_progress_timelimit_sec && elapsed > originate_status[i].per_channel_progress_timelimit_sec &&
 				!(
 				  switch_channel_test_flag(originate_status[i].peer_channel, CF_RING_READY) ||
@@ -1719,7 +1719,7 @@
 							}
 							pchannel = switch_core_session_get_channel(originate_status[i].peer_session);
 
-							if (switch_channel_get_state(pchannel) >= CS_HANGUP) {
+							if (switch_channel_down(pchannel)) {
 								cause_str = switch_channel_cause2str(switch_channel_get_cause(pchannel));
 								if (switch_stristr(cause_str, fail_on_single_reject_var)) {
 									ok = 0;



More information about the Freeswitch-svn mailing list