switch_file_remove(rh->file, switch_core_session_get_pool(session));
}
- if (read_impl.actual_samples_per_second) {
- switch_channel_set_variable_printf(channel, "record_seconds", "%d", rh->fh->samples_out / read_impl.actual_samples_per_second);
- switch_channel_set_variable_printf(channel, "record_ms", "%d", rh->fh->samples_out / (read_impl.actual_samples_per_second / 1000));
+ if (rh->fh) {
+ switch_channel_set_variable_printf(channel, "record_samples", "%d", rh->fh->samples_out);
+ if (read_impl.actual_samples_per_second) {
+ switch_channel_set_variable_printf(channel, "record_seconds", "%d", rh->fh->samples_out / read_impl.actual_samples_per_second);
+ switch_channel_set_variable_printf(channel, "record_ms", "%d", rh->fh->samples_out / (read_impl.actual_samples_per_second / 1000));
+ }
}
- switch_channel_set_variable_printf(channel, "record_samples", "%d", rh->fh->samples_out);
-
}
if (switch_event_create(&event, SWITCH_EVENT_RECORD_STOP) == SWITCH_STATUS_SUCCESS) {