[Freeswitch-svn] [commit] r7525 - in freeswitch/trunk/src: . include

Freeswitch SVN anthm at freeswitch.org
Tue Feb 5 11:46:39 EST 2008


Author: anthm
Date: Tue Feb  5 11:46:39 2008
New Revision: 7525

Modified:
   freeswitch/trunk/src/include/switch_channel.h
   freeswitch/trunk/src/switch_core_state_machine.c

Log:
make the core pre_answer channels when they hit an app that requires media and they have not answered yet to at least establish media

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  5 11:46:39 2008
@@ -473,6 +473,8 @@
 
 #define switch_channel_stop_broadcast(_channel)	if (switch_channel_test_flag(_channel, CF_BROADCAST)) switch_channel_set_flag(_channel, CF_BREAK | CF_STOP_BROADCAST)
 
+#define switch_channel_media_ready(_channel) ((switch_channel_test_flag(_channel, CF_ANSWERED) || switch_channel_test_flag(_channel, CF_EARLY_MEDIA)) && !switch_channel_test_flag(_channel, CF_BYPASS_MEDIA))
+
 /** @} */
 
 SWITCH_END_EXTERN_C

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  5 11:46:39 2008
@@ -156,8 +156,12 @@
 		if (switch_channel_test_flag(session->channel, CF_BYPASS_MEDIA) && !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_ERROR, "Application %s Requires media!\n",
-							  extension->current_application->application_name);
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Application %s Requires media on channel %s!\n",
+							  extension->current_application->application_name, switch_channel_get_name(session->channel));
+		} else if (!switch_channel_media_ready(session->channel)) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Application %s Requires media! pre_answering channel %s\n",
+							  extension->current_application->application_name, switch_channel_get_name(session->channel));
+			switch_channel_pre_answer(session->channel);
 		}
 
 		if ((expanded =



More information about the Freeswitch-svn mailing list