[Freeswitch-svn] [commit] r7955 - in freeswitch/trunk/src: . include mod/endpoints/mod_sofia

Freeswitch SVN anthm at freeswitch.org
Mon Mar 24 16:58:44 EDT 2008


Author: anthm
Date: Mon Mar 24 16:58:44 2008
New Revision: 7955

Modified:
   freeswitch/trunk/src/include/switch_types.h
   freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c
   freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c
   freeswitch/trunk/src/switch_core_io.c
   freeswitch/trunk/src/switch_ivr.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	Mon Mar 24 16:58:44 2008
@@ -722,7 +722,8 @@
 	CF_ORIGINATING = (1 << 25),
 	CF_STOP_BROADCAST = (1 << 26),
 	CF_PROXY_MEDIA = (1 << 27),
-	CF_INNER_BRIDGE = (1 << 28)
+	CF_INNER_BRIDGE = (1 << 28),
+	CF_REQ_MEDIA = (1 << 29)
 } switch_channel_flag_t;
 
 

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	Mon Mar 24 16:58:44 2008
@@ -513,7 +513,7 @@
 		return SWITCH_STATUS_FALSE;
 	}
 
-	while (!(tech_pvt->read_codec.implementation && switch_rtp_ready(tech_pvt->rtp_session))) {
+	while (!(tech_pvt->read_codec.implementation && switch_rtp_ready(tech_pvt->rtp_session) && !switch_channel_test_flag(channel, CF_REQ_MEDIA))) {
 		if (switch_channel_ready(channel)) {
 			switch_yield(10000);
 		} else {
@@ -590,7 +590,7 @@
 
 	switch_assert(tech_pvt != NULL);
 
-	while (!(tech_pvt->read_codec.implementation && switch_rtp_ready(tech_pvt->rtp_session))) {
+	while (!(tech_pvt->read_codec.implementation && switch_rtp_ready(tech_pvt->rtp_session) && !switch_channel_test_flag(channel, CF_REQ_MEDIA))) {
 		if (switch_channel_ready(channel)) {
 			switch_yield(10000);
 		} else {
@@ -782,6 +782,7 @@
 			if (!tech_pvt->local_sdp_str) {
 				sofia_glue_tech_absorb_sdp(tech_pvt);
 			}
+			switch_channel_set_flag(tech_pvt->channel, CF_REQ_MEDIA);
 			sofia_glue_do_invite(session);
 		}
 		break;
@@ -797,7 +798,7 @@
 
 	case SWITCH_MESSAGE_INDICATE_MEDIA:
 		{
-			uint32_t count = 0, send_invite = 1;
+			uint32_t send_invite = 1;
 			
 			switch_channel_clear_flag(channel, CF_PROXY_MODE);
 			tech_pvt->local_sdp_str = NULL;
@@ -827,20 +828,8 @@
 			sofia_glue_set_local_sdp(tech_pvt, NULL, 0, NULL, 1);
 
 			if (send_invite) {
+				switch_channel_set_flag(tech_pvt->channel, CF_REQ_MEDIA);
 				sofia_glue_do_invite(session);
-				/* wait for rtp to start and first real frame to arrive */
-				tech_pvt->read_frame.datalen = 0;
-				while (switch_test_flag(tech_pvt, TFLAG_IO) && switch_channel_get_state(channel) < CS_HANGUP && !switch_rtp_ready(tech_pvt->rtp_session)) {
-					if (++count > 1000) {
-						status = SWITCH_STATUS_FALSE;
-						goto end;
-					}
-					if (!switch_rtp_ready(tech_pvt->rtp_session)) {
-						switch_yield(1000);
-						continue;
-					}
-					break;
-				}
 			}
 		}
 		break;

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	Mon Mar 24 16:58:44 2008
@@ -1404,10 +1404,11 @@
 		switch_channel_t *channel = switch_core_session_get_channel(session);
 		const char *uuid;
 		switch_core_session_t *other_session;
+		private_object_t *tech_pvt = switch_core_session_get_private(session);
+		
+		switch_channel_clear_flag(channel, CF_REQ_MEDIA);
 
 		if (switch_channel_test_flag(channel, CF_PROXY_MODE) || switch_channel_test_flag(channel, CF_PROXY_MEDIA)) {
-			private_object_t *tech_pvt = switch_core_session_get_private(session);
-			switch_assert(tech_pvt != NULL);
 
 			if (!switch_test_flag(tech_pvt, TFLAG_SENT_UPDATE)) {
 				return;
@@ -1827,6 +1828,8 @@
 		}
 		break;
 	case nua_callstate_ready:
+		switch_channel_clear_flag(channel, CF_REQ_MEDIA);
+
 		if (tech_pvt && nh == tech_pvt->nh2) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Cheater Reinvite!\n");
 			switch_set_flag_locked(tech_pvt, TFLAG_REINVITE);

Modified: freeswitch/trunk/src/switch_core_io.c
==============================================================================
--- freeswitch/trunk/src/switch_core_io.c	(original)
+++ freeswitch/trunk/src/switch_core_io.c	Mon Mar 24 16:58:44 2008
@@ -475,6 +475,7 @@
 			}
 		}
 	}
+
 	return status;
 }
 
@@ -868,6 +869,7 @@
 	}
 
   done:
+
 	if (do_write) {
 		return perform_write(session, frame, timeout, io_flag, stream_id);
 	}

Modified: freeswitch/trunk/src/switch_ivr.c
==============================================================================
--- freeswitch/trunk/src/switch_ivr.c	(original)
+++ freeswitch/trunk/src/switch_ivr.c	Mon Mar 24 16:58:44 2008
@@ -800,7 +800,8 @@
 	switch_core_session_message_t msg = { 0 };
 	switch_status_t status = SWITCH_STATUS_GENERR;
 	uint8_t swap = 0;
-
+	switch_frame_t *read_frame = NULL;
+	
 	msg.message_id = SWITCH_MESSAGE_INDICATE_MEDIA;
 	msg.from = __FILE__;
 
@@ -815,12 +816,17 @@
 			status = SWITCH_STATUS_SUCCESS;
 			switch_core_session_receive_message(session, &msg);
 
+			switch_channel_wait_for_flag(channel, CF_REQ_MEDIA, SWITCH_FALSE, 10000);
+			switch_core_session_read_frame(session, &read_frame, -1, 0);
+			
 			if ((flags & SMF_REBRIDGE)
 				&& (other_uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BRIDGE_VARIABLE))
 				&& (other_session = switch_core_session_locate(other_uuid))) {
 				other_channel = switch_core_session_get_channel(other_session);
 				switch_assert(other_channel != NULL);
 				switch_core_session_receive_message(other_session, &msg);
+				switch_channel_wait_for_flag(other_channel, CF_REQ_MEDIA, SWITCH_FALSE, 10000);
+				switch_core_session_read_frame(other_session, &read_frame, -1, 0);
 				switch_channel_clear_state_handler(other_channel, NULL);
 				switch_core_session_rwunlock(other_session);
 			}
@@ -865,12 +871,14 @@
 
 		if ((flags & SMF_FORCE) || !switch_channel_test_flag(channel, CF_PROXY_MODE)) {
 			switch_core_session_receive_message(session, &msg);
+			switch_channel_wait_for_flag(channel, CF_REQ_MEDIA, SWITCH_FALSE, 10000);
 
 			if ((flags & SMF_REBRIDGE) && (other_uuid = switch_channel_get_variable(channel, SWITCH_BRIDGE_VARIABLE)) &&
 				(other_session = switch_core_session_locate(other_uuid))) {
 				other_channel = switch_core_session_get_channel(other_session);
 
 				switch_core_session_receive_message(other_session, &msg);
+				switch_channel_wait_for_flag(other_channel, CF_REQ_MEDIA, SWITCH_FALSE, 10000);
 				switch_channel_clear_state_handler(other_channel, NULL);
 			}
 



More information about the Freeswitch-svn mailing list