add record_ms, record_samples, playback_ms and playback_samples chanvars

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@13105 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale 2009-04-21 19:32:55 +00:00
parent b83524217b
commit 1797ffc016
1 changed files with 7 additions and 0 deletions

View File

@ -634,6 +634,9 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_record_file(switch_core_session_t *se
}
}
switch_channel_set_variable_printf(channel, "record_ms", "%d", fh->samples_in / read_impl.samples_per_second);
switch_channel_set_variable_printf(channel, "record_samples", "%d", fh->samples_in);
switch_core_file_close(fh);
switch_core_session_reset(session, SWITCH_TRUE, SWITCH_TRUE);
return status;
@ -1280,6 +1283,10 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "done playing file\n");
//switch_core_file_seek(fh, &fh->last_pos, 0, SEEK_CUR);
switch_channel_set_variable_printf(channel, "playback_ms", "%d", fh->samples_out / read_impl.samples_per_second);
switch_channel_set_variable_printf(channel, "playback_samples", "%d", fh->samples_out);
switch_core_file_close(fh);
switch_buffer_destroy(&fh->audio_buffer);
switch_buffer_destroy(&fh->sp_audio_buffer);