mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-05 20:20:07 +00:00
Update CONTROL STREAM FILE to accept an 'offsetms' parameter
This patch allows starting playback of audio through the CONTROL STREAM FILE AGI command to start at a particular offset. It will also return the final position of the file in the 'endpos' attribute. (closes issue ASTERISK-17803) Reported by: Murray Melvin patches: res_agi.c.r316293.diff uploaded by murraytm (license 6221) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@395906 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
4
CHANGES
4
CHANGES
@@ -305,6 +305,10 @@ AGI (Asterisk Gateway Interface)
|
||||
* The manager event AsyncAGI has been split into AsyncAGIStart, AsyncAGIExec,
|
||||
and AsyncAGIEnd.
|
||||
|
||||
* The CONTROL STREAM FILE command now accepts an offsetms parameter. This
|
||||
will start the playback of the audio at the position specified. It will
|
||||
also return the final position of the file in 'endpos'.
|
||||
|
||||
CDR (Call Detail Records)
|
||||
------------------
|
||||
* Significant changes have been made to the behavior of CDRs. For a full
|
||||
|
@@ -155,13 +155,19 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
|
||||
<para>Defaults to <literal>#</literal></para>
|
||||
</parameter>
|
||||
<parameter name="pausechr" />
|
||||
<parameter name="offsetms">
|
||||
<para>Offset, in milliseconds, to start the audio playback</para>
|
||||
</parameter>
|
||||
</syntax>
|
||||
<description>
|
||||
<para>Send the given file, allowing playback to be controlled by the given
|
||||
digits, if any. Use double quotes for the digits if you wish none to be
|
||||
permitted. Returns <literal>0</literal> if playback completes without a digit
|
||||
permitted. If offsetms is provided then the audio will seek to offsetms
|
||||
before play starts. Returns <literal>0</literal> if playback completes without a digit
|
||||
being pressed, or the ASCII numerical value of the digit if one was pressed,
|
||||
or <literal>-1</literal> on error or if the channel was disconnected.</para>
|
||||
or <literal>-1</literal> on error or if the channel was disconnected. Returns the
|
||||
position where playback was terminated as endpos.</para>
|
||||
|
||||
<para>It sets the following channel variables upon completion:</para>
|
||||
<variablelist>
|
||||
<variable name="CPLAYBACKSTATUS">
|
||||
@@ -2092,7 +2098,7 @@ static int handle_controlstreamfile(struct ast_channel *chan, AGI *agi, int argc
|
||||
long offsetms = 0;
|
||||
char offsetbuf[20];
|
||||
|
||||
if (argc < 5 || argc > 9) {
|
||||
if (argc < 5 || argc > 10) {
|
||||
return RESULT_SHOWUSAGE;
|
||||
}
|
||||
|
||||
@@ -2116,7 +2122,11 @@ static int handle_controlstreamfile(struct ast_channel *chan, AGI *agi, int argc
|
||||
suspend = argv[8];
|
||||
}
|
||||
|
||||
res = ast_control_streamfile(chan, argv[3], fwd, rev, stop, suspend, NULL, skipms, NULL);
|
||||
if (argc > 9 && (sscanf(argv[9], "%30ld", &offsetms) != 1)) {
|
||||
return RESULT_SHOWUSAGE;
|
||||
}
|
||||
|
||||
res = ast_control_streamfile(chan, argv[3], fwd, rev, stop, suspend, NULL, skipms, &offsetms);
|
||||
|
||||
/* If we stopped on one of our stop keys, return 0 */
|
||||
if (res > 0 && stop && strchr(stop, res)) {
|
||||
@@ -2137,7 +2147,7 @@ static int handle_controlstreamfile(struct ast_channel *chan, AGI *agi, int argc
|
||||
snprintf(offsetbuf, sizeof(offsetbuf), "%ld", offsetms);
|
||||
pbx_builtin_setvar_helper(chan, "CPLAYBACKOFFSET", offsetbuf);
|
||||
|
||||
ast_agi_send(agi->fd, chan, "200 result=%d\n", res);
|
||||
ast_agi_send(agi->fd, chan, "200 result=%d endpos=%ld\n", res, offsetms);
|
||||
|
||||
return (res >= 0) ? RESULT_SUCCESS : RESULT_FAILURE;
|
||||
}
|
||||
|
Reference in New Issue
Block a user