From: Mathieu Parent Date: Thu, 22 Jul 2010 21:53:11 +0000 (+0200) Subject: ivr_play: preanswer before getting variables to avoid crash X-Git-Tag: v1.2-rc1~526^2~121 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=25fe16dfed4af27f9737c8d19bf1a8a5166990ef;p=thirdparty%2Ffreeswitch.git ivr_play: preanswer before getting variables to avoid crash --- diff --git a/src/switch_ivr_play_say.c b/src/switch_ivr_play_say.c index 0e0322452c..bc1fbadd00 100644 --- a/src/switch_ivr_play_say.c +++ b/src/switch_ivr_play_say.c @@ -916,6 +916,10 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess int timeout_samples = 0; const char *var; + if (switch_channel_pre_answer(channel) != SWITCH_STATUS_SUCCESS) { + return SWITCH_STATUS_FALSE; + } + switch_core_session_get_read_impl(session, &read_impl); if ((var = switch_channel_get_variable(channel, "playback_timeout_sec"))) { @@ -936,10 +940,6 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess } } - if (switch_channel_pre_answer(channel) != SWITCH_STATUS_SUCCESS) { - return SWITCH_STATUS_FALSE; - } - prefix = switch_channel_get_variable(channel, "sound_prefix"); timer_name = switch_channel_get_variable(channel, "timer_name");