Add ControlPlayback manager action

This patch adds the capability for asynchronous manipulation of audio being
played back to a channel though a new AMI action "ControlPlayback". The
ControlPlayback action supports a number of operations, the availability of
which depend on the application being used to send audio to the channel.
When the audio playback was initiated using the ControlPlayback application
or CONTROL STREAM FILE AGI command, the audio can be paused, stopped,
restarted, reversed, or skipped forward. When initiated by other mechanisms
(such as the Playback application), the audio can be stopped, reversed, or
skipped forward.

Review: https://reviewboard.asterisk.org/r/2265/

(closes issue ASTERISK-20882)
Reported by: mjordan



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@379830 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Matthew Jordan
2013-01-22 15:16:20 +00:00
parent 985ea8b2c9
commit 7d9871b394
10 changed files with 392 additions and 53 deletions

View File

@@ -82,6 +82,14 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
<para>See Also: Background (application) -- for playing sound files that are interruptible</para>
<para>WaitExten (application) -- wait for digits from caller, optionally play music on hold</para>
</description>
<see-also>
<ref type="application">Background</ref>
<ref type="application">WaitExten</ref>
<ref type="application">ControlPlayback</ref>
<ref type="agi">stream file</ref>
<ref type="agi">control stream file</ref>
<ref type="manager">ControlPlayback</ref>
</see-also>
</application>
***/
@@ -473,11 +481,12 @@ static int playback_exec(struct ast_channel *chan, const char *data)
res = say_full(chan, front, "", ast_channel_language(chan), NULL, -1, -1);
else
res = ast_streamfile(chan, front, ast_channel_language(chan));
if (!res) {
res = ast_waitstream(chan, "");
if (!res) {
res = ast_waitstream(chan, "");
ast_stopstream(chan);
} else {
ast_log(LOG_WARNING, "ast_streamfile failed on %s for %s\n", ast_channel_name(chan), (char *)data);
}
if (res) {
ast_log(LOG_WARNING, "Playback failed on %s for %s\n", ast_channel_name(chan), (char *)data);
res = 0;
mres = 1;
}