From ccf4e57c8dcb78ef27ce044fa6a974fb4436419e Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 5 Feb 2008 16:46:39 +0000 Subject: [PATCH] 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 git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@7525 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- src/include/switch_channel.h | 2 ++ src/switch_core_state_machine.c | 8 ++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/include/switch_channel.h b/src/include/switch_channel.h index 0284dc482d..a49d2c5032 100644 --- a/src/include/switch_channel.h +++ b/src/include/switch_channel.h @@ -473,6 +473,8 @@ SWITCH_DECLARE(switch_status_t) switch_channel_set_timestamps(_In_ switch_channe #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 diff --git a/src/switch_core_state_machine.c b/src/switch_core_state_machine.c index 4e8d1d0cfa..660538f121 100644 --- a/src/switch_core_state_machine.c +++ b/src/switch_core_state_machine.c @@ -156,8 +156,12 @@ static void switch_core_standard_on_execute(switch_core_session_t *session) 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 =