diff --git a/src/switch_ivr_play_say.c b/src/switch_ivr_play_say.c index 97f553d733..47451c3ca6 100644 --- a/src/switch_ivr_play_say.c +++ b/src/switch_ivr_play_say.c @@ -389,31 +389,26 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_record_file(switch_core_session_t *se const char *prefix, *var; + if (switch_channel_pre_answer(channel) != SWITCH_STATUS_SUCCESS) { + return SWITCH_STATUS_FALSE; + } + prefix = switch_channel_get_variable(channel, "sound_prefix"); if (!prefix) { prefix = SWITCH_GLOBAL_dirs.sounds_dir; } + if (!switch_channel_media_ready(channel)) { + return SWITCH_STATUS_FALSE; + } + switch_core_session_get_read_impl(session, &read_impl); if (!(divisor = read_impl.actual_samples_per_second / 8000)) { divisor = 1; } - - if (!switch_channel_ready(channel)) { - return SWITCH_STATUS_FALSE; - } - - if (switch_channel_answer(channel) != SWITCH_STATUS_SUCCESS) { - return SWITCH_STATUS_FALSE; - } - - if (!switch_channel_media_ready(channel)) { - return SWITCH_STATUS_FALSE; - } - arg_recursion_check_start(args); if (!fh) {