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

Freeswitch SVN anthm at freeswitch.org
Mon Aug 28 19:50:11 EDT 2006


Author: anthm
Date: Mon Aug 28 19:50:10 2006
New Revision: 2419

Modified:
   freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c
   freeswitch/trunk/src/switch_ivr.c
   freeswitch/trunk/src/switch_rtp.c

Log:
fix stupidness

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 Aug 28 19:50:10 2006
@@ -723,7 +723,6 @@
 		set_local_sdp(tech_pvt);
 		activate_rtp(tech_pvt);
 		if (tech_pvt->nh) {
-			tech_pvt->contact = sip_contact_create(tech_pvt->home, URL_STRING_MAKE("sip:1000 at 208.64.200.40"), NULL);
 			nua_respond(tech_pvt->nh, SIP_200_OK, SIPTAG_CONTACT(tech_pvt->contact), SOATAG_USER_SDP_STR(tech_pvt->local_sdp_str), TAG_END());
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Local SDP:\n%s\n", tech_pvt->local_sdp_str);
 		}
@@ -995,10 +994,12 @@
 	    if (!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);
+
 			/* Transmit 183 Progress with SDP */
 			tech_choose_port(tech_pvt);
 			set_local_sdp(tech_pvt);
 			activate_rtp(tech_pvt);
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "183 SDP:\n%s\n", tech_pvt->local_sdp_str);
 			nua_respond(tech_pvt->nh, SIP_183_SESSION_PROGRESS, SIPTAG_CONTACT(tech_pvt->contact), SOATAG_USER_SDP_STR(tech_pvt->local_sdp_str), TAG_END());
 			//nua_respond(tech_pvt->nh, SIP_200_OK, SOATAG_USER_SDP_STR(tech_pvt->local_sdp_str), TAG_END());
 	    }
@@ -1251,6 +1252,9 @@
 			uint8_t match = 0;
 			
 
+			tech_pvt->contact = sip_contact_create(tech_pvt->home, URL_STRING_MAKE("sip:1000 at 208.64.200.40"), NULL);
+			
+
 			if (tech_pvt->num_codecs) {
 				if ((sdp = sdp_session(parser))) {
 					match = negotiate_sdp(session, sdp);
@@ -1267,7 +1271,7 @@
 				switch_channel_set_state(channel, CS_INIT);
 				switch_set_flag_locked(tech_pvt, TFLAG_READY);
 				switch_core_session_thread_launch(session);
-				//nua_respond(nh, SIP_180_RINGING, TAG_END());
+				//nua_respond(nh, SIP_100_TRYING, SIPTAG_CONTACT(tech_pvt->contact), TAG_END());
 				return;
 			}
 		}
@@ -1531,10 +1535,15 @@
 							  event_callback, /* Callback for processing events */
 							  profile, /* Additional data to pass to callback */
 							  NUTAG_URL(profile->url),
-							  NUTAG_EARLY_MEDIA(1),
-							  SIPTAG_SUPPORTED_STR("100rel, precondition"),
 							  TAG_END()); /* Last tag should always finish the sequence */
 
+	nua_set_params(profile->nua,
+				   NUTAG_EARLY_MEDIA(1),
+				   SIPTAG_SUPPORTED_STR("100rel, precondition"),
+				   NUTAG_AUTOANSWER(0),
+				   NUTAG_AUTOALERT(0));
+				   
+
 	for (node = profile->aliases; node; node = node->next) {
 		node->nua = nua_create(profile->s_root, /* Event loop */
 							   event_callback, /* Callback for processing events */
@@ -1542,8 +1551,16 @@
 							   NUTAG_URL(node->url),
 							   NUTAG_EARLY_MEDIA(1),
 							   SIPTAG_SUPPORTED_STR("100rel, precondition"),
+							   NUTAG_AUTOANSWER(0),
+							   NUTAG_AUTOALERT(0),
 							   TAG_END()); /* Last tag should always finish the sequence */
 
+		nua_set_params(node->nua,
+					   NUTAG_EARLY_MEDIA(1),
+					   SIPTAG_SUPPORTED_STR("100rel, precondition"),
+					   NUTAG_AUTOANSWER(0),
+					   NUTAG_AUTOALERT(0));
+		
 	}
 
 	su_root_run(profile->s_root);

Modified: freeswitch/trunk/src/switch_ivr.c
==============================================================================
--- freeswitch/trunk/src/switch_ivr.c	(original)
+++ freeswitch/trunk/src/switch_ivr.c	Mon Aug 28 19:50:10 2006
@@ -1678,7 +1678,7 @@
 			this_audio_thread->running = 2;
 
 
-			if (!switch_channel_test_flag(peer_channel, CF_TRANSFER)) {
+			if (!switch_channel_test_flag(peer_channel, CF_TRANSFER) && switch_channel_get_state(peer_channel) < CS_HANGUP) {
 				switch_core_session_kill_channel(peer_session, SWITCH_SIG_KILL);
 				switch_channel_hangup(peer_channel, SWITCH_CAUSE_NORMAL_CLEARING);
 			}

Modified: freeswitch/trunk/src/switch_rtp.c
==============================================================================
--- freeswitch/trunk/src/switch_rtp.c	(original)
+++ freeswitch/trunk/src/switch_rtp.c	Mon Aug 28 19:50:10 2006
@@ -547,7 +547,7 @@
 
 SWITCH_DECLARE(uint8_t) switch_rtp_ready(switch_rtp_t *rtp_session)
 {
-	return switch_test_flag(rtp_session, SWITCH_RTP_FLAG_IO) ? 1 : 0;
+	return (rtp_session != NULL && switch_test_flag(rtp_session, SWITCH_RTP_FLAG_IO)) ? 1 : 0;
 }
 
 SWITCH_DECLARE(void) switch_rtp_destroy(switch_rtp_t **rtp_session)



More information about the Freeswitch-svn mailing list