jump to a specific offset with the playback by appending @@<samples> to the path

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@14752 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale 2009-09-02 20:43:49 +00:00
parent d647132a84
commit 3fd795ae71
1 changed files with 17 additions and 1 deletions

View File

@ -1859,12 +1859,28 @@ SWITCH_STANDARD_APP(playback_function)
switch_input_args_t args = { 0 };
switch_channel_t *channel = switch_core_session_get_channel(session);
switch_status_t status = SWITCH_STATUS_SUCCESS;
switch_file_handle_t fh = { 0 };
char *p;
const char *file = NULL;
if (data) {
file = switch_core_session_strdup(session, data);
if ((p = strchr(file, '@')) && *(p+1) == '@') {
*p = '\0';
p += 2;
if (p && *p) {
fh.samples = atoi(p);
}
}
} else {
file = data;
}
args.input_callback = on_dtmf;
switch_channel_set_variable(channel, SWITCH_PLAYBACK_TERMINATOR_USED, "" );
status = switch_ivr_play_file(session, NULL, data, &args);
status = switch_ivr_play_file(session, &fh, file, &args);
switch (status) {
case SWITCH_STATUS_SUCCESS: