diff options
author | David M. Lee <dlee@digium.com> | 2013-05-23 20:21:16 +0000 |
---|---|---|
committer | David M. Lee <dlee@digium.com> | 2013-05-23 20:21:16 +0000 |
commit | 557125664da831cd332b6bab9d3da219fd484c63 (patch) | |
tree | c414cdca4ab023c7b00a7dcaf90f7205092c60bc /main/app.c | |
parent | 10ba6bf8a8114278ca974861ecebcb3a827d8d5b (diff) |
This patch adds support for controlling a playback operation from the
Asterisk REST interface.
This adds the /playback/{playbackId}/control resource, which may be
POSTed to to pause, unpause, reverse, forward or restart the media
playback.
Attempts to control a playback that is not currently playing will
either return a 404 Not Found (because the playback object no longer
exists) or a 409 Conflict (because the playback object is still in the
queue to be played).
This patch also adds skipms and offsetms parameters to the
/channels/{channelId}/play resource.
(closes issue ASTERISK-21587)
Review: https://reviewboard.asterisk.org/r/2559
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@389603 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'main/app.c')
-rw-r--r-- | main/app.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/main/app.c b/main/app.c index 1473c06cb..3001450e8 100644 --- a/main/app.c +++ b/main/app.c @@ -930,6 +930,7 @@ static int control_streamfile(struct ast_channel *chan, const char *restart, int skipms, long *offsetms, + const char *lang, ast_waitstream_fr_cb cb) { char *breaks = NULL; @@ -945,6 +946,9 @@ static int control_streamfile(struct ast_channel *chan, if (offsetms) { offset = *offsetms * 8; /* XXX Assumes 8kHz */ } + if (lang == NULL) { + lang = ast_channel_language(chan); + } if (stop) { blen += strlen(stop); @@ -982,7 +986,7 @@ static int control_streamfile(struct ast_channel *chan, for (;;) { ast_stopstream(chan); - res = ast_streamfile(chan, file, ast_channel_language(chan)); + res = ast_streamfile(chan, file, lang); if (!res) { if (pause_restart_point) { ast_seekstream(ast_channel_stream(chan), pause_restart_point, SEEK_SET); @@ -1093,7 +1097,7 @@ int ast_control_streamfile_w_cb(struct ast_channel *chan, long *offsetms, ast_waitstream_fr_cb cb) { - return control_streamfile(chan, file, fwd, rev, stop, suspend, restart, skipms, offsetms, cb); + return control_streamfile(chan, file, fwd, rev, stop, suspend, restart, skipms, offsetms, NULL, cb); } int ast_control_streamfile(struct ast_channel *chan, const char *file, @@ -1101,7 +1105,14 @@ int ast_control_streamfile(struct ast_channel *chan, const char *file, const char *stop, const char *suspend, const char *restart, int skipms, long *offsetms) { - return control_streamfile(chan, file, fwd, rev, stop, suspend, restart, skipms, offsetms, NULL); + return control_streamfile(chan, file, fwd, rev, stop, suspend, restart, skipms, offsetms, NULL, NULL); +} + +int ast_control_streamfile_lang(struct ast_channel *chan, const char *file, + const char *fwd, const char *rev, const char *stop, const char *suspend, + const char *restart, int skipms, const char *lang, long *offsetms) +{ + return control_streamfile(chan, file, fwd, rev, stop, suspend, restart, skipms, offsetms, lang, NULL); } int ast_play_and_wait(struct ast_channel *chan, const char *fn) |