From: Michael Jerris Date: Tue, 5 Feb 2008 17:33:34 +0000 (+0000) Subject: tweak error checking. X-Git-Tag: v1.0-rc1~399 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1369cdf235142eebaa43195290cff39355a18a5a;p=thirdparty%2Ffreeswitch.git tweak error checking. git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@7528 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- diff --git a/src/switch_ivr_async.c b/src/switch_ivr_async.c index 8b56fe6e10..396ed2d052 100644 --- a/src/switch_ivr_async.c +++ b/src/switch_ivr_async.c @@ -965,21 +965,15 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_stop_inband_dtmf_generate_session(swi SWITCH_DECLARE(switch_status_t) switch_ivr_inband_dtmf_generate_session(switch_core_session_t *session, switch_bool_t read_stream) { switch_channel_t *channel = switch_core_session_get_channel(session); - switch_codec_t *read_codec; switch_media_bug_t *bug; switch_status_t status; switch_inband_dtmf_generate_t *pvt; - if ((status = switch_channel_pre_answer(channel)) != SWITCH_STATUS_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can not install inband dtmf generate. Failed to pre_answer session!\n"); - return status; - } + status = switch_channel_pre_answer(channel); - read_codec = switch_core_session_get_read_codec(session); - - if (!read_codec) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can not install inband dtmf generate. No read codec.!\n"); - return SWITCH_STATUS_FALSE; + if (!switch_channel_media_ready(channel) || !switch_core_session_get_read_codec(session)) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can not install inband dtmf generate. Media not enabled on channel\n"); + return status; } if (!(pvt = switch_core_session_alloc(session, sizeof(*pvt)))) {