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

Freeswitch SVN anthm at freeswitch.org
Mon Mar 3 19:52:55 EST 2008


Author: anthm
Date: Mon Mar  3 19:52:54 2008
New Revision: 7779

Modified:
   freeswitch/trunk/src/mod/applications/mod_dptools/mod_dptools.c
   freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c
   freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c
   freeswitch/trunk/src/switch_core_state_machine.c
   freeswitch/trunk/src/switch_ivr_bridge.c

Log:
update

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	Mon Mar  3 19:52:54 2008
@@ -1507,8 +1507,8 @@
 	SWITCH_ADD_APP(app_interface, "strftime", NULL, NULL, strftime_function, NULL, SAF_SUPPORT_NOMEDIA);
 	SWITCH_ADD_APP(app_interface, "phrase", "Say a Phrase", "Say a Phrase", phrase_function, "<macro_name>,<data>", SAF_NONE);
 	SWITCH_ADD_APP(app_interface, "eval", "Do Nothing", "Do Nothing", eval_function, "", SAF_SUPPORT_NOMEDIA);
-	SWITCH_ADD_APP(app_interface, "pre_answer", "Pre-Answer the call", "Pre-Answer the call for a channel.", pre_answer_function, "", SAF_SUPPORT_NOMEDIA);
-	SWITCH_ADD_APP(app_interface, "answer", "Answer the call", "Answer the call for a channel.", answer_function, "", SAF_SUPPORT_NOMEDIA);
+	SWITCH_ADD_APP(app_interface, "pre_answer", "Pre-Answer the call", "Pre-Answer the call for a channel.", pre_answer_function, "", SAF_NONE);
+	SWITCH_ADD_APP(app_interface, "answer", "Answer the call", "Answer the call for a channel.", answer_function, "", SAF_NONE);
 	SWITCH_ADD_APP(app_interface, "hangup", "Hangup the call", "Hangup the call for a channel.", hangup_function, "[<cause>]", SAF_SUPPORT_NOMEDIA);
 	SWITCH_ADD_APP(app_interface, "set_name", "Name the channel", "Name the channel", set_name_function, "<name>", SAF_SUPPORT_NOMEDIA);
 	SWITCH_ADD_APP(app_interface, "log", "Logs a channel variable", LOG_LONG_DESC, log_function, "<varname>", SAF_SUPPORT_NOMEDIA);

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  3 19:52:54 2008
@@ -712,13 +712,6 @@
 		goto end;
 	}
 
-	if (msg->message_id == SWITCH_MESSAGE_INDICATE_ANSWER || msg->message_id == SWITCH_MESSAGE_INDICATE_PROGRESS) {
-		const char *var;
-		if ((var = switch_channel_get_variable(channel, SOFIA_SECURE_MEDIA_VARIABLE)) && switch_true(var)) {
-			switch_set_flag_locked(tech_pvt, TFLAG_SECURE);
-		}
-	}
-
 	switch (msg->message_id) {
 	case SWITCH_MESSAGE_INDICATE_VIDEO_REFRESH_REQ:
 		{
@@ -794,10 +787,26 @@
 
 	case SWITCH_MESSAGE_INDICATE_MEDIA:
 		{
-			uint32_t count = 0;
-
+			uint32_t count = 0, send_invite = 1;
+			
 			switch_channel_clear_flag(channel, CF_PROXY_MODE);
 			tech_pvt->local_sdp_str = NULL;
+
+			if (!switch_channel_media_ready(channel)) {
+				if (!switch_channel_test_flag(tech_pvt->channel, CF_OUTBOUND)) {
+					const char *r_sdp = switch_channel_get_variable(channel, SWITCH_R_SDP_VARIABLE);
+					
+					tech_pvt->num_codecs = 0;
+					sofia_glue_tech_prepare_codecs(tech_pvt);
+					if (sofia_glue_tech_media(tech_pvt, r_sdp) != SWITCH_STATUS_SUCCESS) {
+						switch_channel_set_variable(channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "CODEC NEGOTIATION ERROR");
+						status = SWITCH_STATUS_FALSE;
+						goto end;
+					}
+					send_invite = 0;
+				}
+			}
+
 			if (!switch_rtp_ready(tech_pvt->rtp_session)) {
 				sofia_glue_tech_prepare_codecs(tech_pvt);
 				if ((status = sofia_glue_tech_choose_port(tech_pvt, 0)) != SWITCH_STATUS_SUCCESS) {
@@ -806,20 +815,22 @@
 				}
 			}
 			sofia_glue_set_local_sdp(tech_pvt, NULL, 0, NULL, 1);
-			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;
+			if (send_invite) {
+				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;
 			}
 		}
 		break;

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	Mon Mar  3 19:52:54 2008
@@ -1422,11 +1422,18 @@
 	uint32_t rtp_timeout_sec = tech_pvt->profile->rtp_timeout_sec;
 	uint32_t rtp_hold_timeout_sec = tech_pvt->profile->rtp_hold_timeout_sec;
 	char *timer_name;
+	const char *var;
 
 	switch_assert(tech_pvt != NULL);
 
 	switch_core_session_signal_lock(tech_pvt->session);
 	
+
+	if ((var = switch_channel_get_variable(tech_pvt->channel, SOFIA_SECURE_MEDIA_VARIABLE)) && switch_true(var)) {
+		switch_set_flag_locked(tech_pvt, TFLAG_SECURE);
+	}
+
+
 	if (switch_channel_test_flag(tech_pvt->channel, CF_PROXY_MODE)) {
 		status = SWITCH_STATUS_SUCCESS;
 		goto end;

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	Mon Mar  3 19:52:54 2008
@@ -137,8 +137,7 @@
 
 	while (switch_channel_get_state(session->channel) == CS_EXECUTE && extension->current_application) {
 		char *expanded = NULL;
-		int nomedia = 0;
-		
+
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s Execute %s(%s)\n", switch_channel_get_name(session->channel),
 						  extension->current_application->application_name, switch_str_nil(extension->current_application->application_data));
 		if ((application_interface = switch_loadable_module_get_application_interface(extension->current_application->application_name)) == 0) {
@@ -155,7 +154,6 @@
 		
 		if (switch_channel_test_flag(session->channel, CF_PROXY_MODE) && !switch_test_flag(application_interface, SAF_SUPPORT_NOMEDIA)) {
 			switch_ivr_media(session->uuid_str, SMF_NONE);
-			nomedia++;
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Application %s Requires media on channel %s!\n",
 							  extension->current_application->application_name, switch_channel_get_name(session->channel));
 		} else if (!switch_test_flag(application_interface, SAF_SUPPORT_NOMEDIA) && !switch_channel_media_ready(session->channel)) {
@@ -189,12 +187,6 @@
 			goto top;
 		}
 
-		if (nomedia) {
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Application %s Releasing media\n",
-							  extension->current_application->application_name);
-			switch_ivr_nomedia(session->uuid_str, SMF_NONE);
-		}
-
 		extension->current_application = extension->current_application->next;
 	}
 

Modified: freeswitch/trunk/src/switch_ivr_bridge.c
==============================================================================
--- freeswitch/trunk/src/switch_ivr_bridge.c	(original)
+++ freeswitch/trunk/src/switch_ivr_bridge.c	Mon Mar  3 19:52:54 2008
@@ -496,7 +496,7 @@
 	switch_core_session_t *other_session;
 	switch_event_t *event;
 
-	if (switch_channel_test_flag(channel, CF_ORIGINATOR)) {
+	if (switch_channel_test_flag(channel, CF_ORIGINATOR)) {		
 		switch_channel_clear_flag(channel, CF_ORIGINATOR);
 		if (switch_event_create(&event, SWITCH_EVENT_CHANNEL_UNBRIDGE) == SWITCH_STATUS_SUCCESS) {
 			switch_channel_event_set_data(channel, event);
@@ -514,17 +514,10 @@
 		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_get_state(other_channel) < CS_HANGUP) {
+			switch_channel_hangup(other_channel, switch_channel_get_cause(channel));
+		}
 
-		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 &&
-				switch_true(switch_channel_get_variable(other_channel, SWITCH_HANGUP_AFTER_BRIDGE_VARIABLE))) {
-				switch_channel_hangup(other_channel, switch_channel_get_cause(channel));
-			} else {
-				switch_channel_set_state(other_channel, CS_EXECUTE);
-			}
-		} 
 		switch_core_session_rwunlock(other_session);
 	}
 



More information about the Freeswitch-svn mailing list