[Freeswitch-svn] [commit] r7624 - freeswitch/trunk/src/mod/endpoints/mod_sofia

Freeswitch SVN anthm at freeswitch.org
Fri Feb 15 14:48:16 EST 2008


Author: anthm
Date: Fri Feb 15 14:48:16 2008
New Revision: 7624

Modified:
   freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c
   freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c
   freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c

Log:
avoiding racelock

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	Fri Feb 15 14:48:16 2008
@@ -702,7 +702,9 @@
 	private_object_t *tech_pvt = switch_core_session_get_private(session);
 	switch_status_t status;
 
-	switch_assert(tech_pvt != NULL);
+	if (switch_channel_get_state(channel) >= CS_HANGUP || !tech_pvt) {
+		return SWITCH_STATUS_FALSE;
+	}
 
 	if (msg->message_id == SWITCH_MESSAGE_INDICATE_ANSWER || msg->message_id == SWITCH_MESSAGE_INDICATE_PROGRESS) {
 		const char *var;
@@ -755,11 +757,7 @@
 			switch_core_session_t *other_session;
 			switch_channel_t *other_channel;
 			const char *ip = NULL, *port = NULL;
-
-			if (switch_channel_get_state(channel) >= CS_HANGUP) {
-				return SWITCH_STATUS_FALSE;
-			}
-
+			
 			switch_channel_set_flag(channel, CF_BYPASS_MEDIA);
 			tech_pvt->local_sdp_str = NULL;
 			if ((uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE))
@@ -792,10 +790,6 @@
 		{
 			uint32_t count = 0;
 
-			if (switch_channel_get_state(channel) >= CS_HANGUP) {
-				return SWITCH_STATUS_FALSE;
-			}
-
 			switch_channel_clear_flag(channel, CF_BYPASS_MEDIA);
 			tech_pvt->local_sdp_str = NULL;
 			if (!switch_rtp_ready(tech_pvt->rtp_session)) {
@@ -975,8 +969,9 @@
 	case SWITCH_MESSAGE_INDICATE_ANSWER:
 		sofia_answer_channel(session);
 		break;
-	case SWITCH_MESSAGE_INDICATE_PROGRESS:{
-			if (!switch_test_flag(tech_pvt, TFLAG_ANS)) {
+	case SWITCH_MESSAGE_INDICATE_PROGRESS:
+		{
+			if (!switch_test_flag(tech_pvt, TFLAG_ANS) && !switch_test_flag(tech_pvt, TFLAG_EARLY_MEDIA)) {
 				
 				switch_set_flag_locked(tech_pvt, TFLAG_EARLY_MEDIA);
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Asked to send early media by %s\n", msg->from);

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	Fri Feb 15 14:48:16 2008
@@ -1462,6 +1462,10 @@
 		goto done;
 	}
 
+	if (status == 183 && !r_sdp) {
+		status = 180;
+	}
+
 	if (channel && (status == 180 || status == 183) && switch_channel_test_flag(channel, CF_OUTBOUND)) {
 		const char *val;
 		if ((val = switch_channel_get_variable(channel, "sip_auto_answer")) && switch_true(val)) {

Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c	(original)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c	Fri Feb 15 14:48:16 2008
@@ -1084,6 +1084,11 @@
 {
 	int ms;
 
+	if (!tech_pvt->iananame) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No audio codec available\n");
+		return SWITCH_STATUS_FALSE;
+	}
+
 	if (tech_pvt->read_codec.implementation) {
 		if (!force) {
 			return SWITCH_STATUS_SUCCESS;
@@ -1102,11 +1107,6 @@
 		}
 	}
 
-	if (!tech_pvt->iananame) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't load codec with no name?\n");
-		return SWITCH_STATUS_FALSE;
-	}
-
 	if (switch_core_codec_init(&tech_pvt->read_codec,
 							   tech_pvt->iananame,
 							   tech_pvt->rm_fmtp,



More information about the Freeswitch-svn mailing list