diff --git a/src/switch_core_file.c b/src/switch_core_file.c index 4cd4600c48..8fc0008b78 100644 --- a/src/switch_core_file.c +++ b/src/switch_core_file.c @@ -81,10 +81,13 @@ SWITCH_DECLARE(switch_status_t) switch_core_perform_file_open(const char *file, } fh->samples_in = 0; - fh->samplerate = 0; - fh->native_rate = 0; - fh->channels = 0; - fh->real_channels = 0; + + if (!(flags & SWITCH_FILE_FLAG_WRITE)) { + fh->samplerate = 0; + fh->native_rate = 0; + fh->channels = 0; + fh->real_channels = 0; + } if (!fh->samplerate) { if (!(fh->samplerate = rate)) { diff --git a/src/switch_ivr_async.c b/src/switch_ivr_async.c index 23d669214f..f318fd9874 100644 --- a/src/switch_ivr_async.c +++ b/src/switch_ivr_async.c @@ -1322,7 +1322,7 @@ static switch_bool_t record_callback(switch_media_bug_t *bug, void *user_data, s switch_core_session_get_read_impl(session, &rh->read_impl); if (rh->fh) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Record session sample rate: %d -> %d\n", rh->fh->native_rate, rh->read_impl.actual_samples_per_second); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Record session sample rate: %d -> %d\n", rh->fh->native_rate, rh->fh->samplerate); rh->fh->native_rate = rh->read_impl.actual_samples_per_second; if (switch_core_file_has_video(rh->fh, SWITCH_TRUE)) { switch_core_media_bug_set_media_params(bug, &rh->fh->mm);