mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-02 19:16:15 +00:00
app.c: Allow ampersands in playback lists to be escaped.
Any function or application that accepts a `&`-separated list of
filenames can now include a literal `&` in a filename by wrapping the
entire filename in single quotes, e.g.:
```
exten = _X.,n,Playback('https://example.com/sound.cgi?a=b&c=d'&hello-world)
```
Fixes #172
UpgradeNote: Ampersands in URLs passed to the `Playback()`,
`Background()`, `SpeechBackground()`, `Read()`, `Authenticate()`, or
`Queue()` applications as filename arguments can now be escaped by
single quoting the filename. Additionally, this is also possible when
using the `CONFBRIDGE` dialplan function, or configuring various
features in `confbridge.conf` and `queues.conf`.
(cherry picked from commit 33213c1979
)
This commit is contained in:
committed by
Asterisk Development Team
parent
6a75f22858
commit
0620c14eb6
@@ -85,7 +85,17 @@
|
||||
Play a sound file and wait for speech to be recognized.
|
||||
</synopsis>
|
||||
<syntax>
|
||||
<parameter name="sound_file" required="true" />
|
||||
<parameter name="sound_file" required="true" argsep="&">
|
||||
<para>Ampersand separated list of filenames. If the filename
|
||||
is a relative filename (it does not begin with a slash), it
|
||||
will be searched for in the Asterisk sounds directory. If the
|
||||
filename is able to be parsed as a URL, Asterisk will
|
||||
download the file and then begin playback on it. To include a
|
||||
literal <literal>&</literal> in the URL you can enclose
|
||||
the URL in single quotes.</para>
|
||||
<argument name="sound_file" required="true" />
|
||||
<argument name="sound_file2" multiple="true" />
|
||||
</parameter>
|
||||
<parameter name="timeout">
|
||||
<para>Timeout integer in seconds. Note the timeout will only start
|
||||
once the sound file has stopped playing.</para>
|
||||
@@ -776,7 +786,10 @@ static int speech_background(struct ast_channel *chan, const char *data)
|
||||
/* Okay it's streaming so go into a loop grabbing frames! */
|
||||
while (done == 0) {
|
||||
/* If the filename is null and stream is not running, start up a new sound file */
|
||||
if (!quieted && (ast_channel_streamid(chan) == -1 && ast_channel_timingfunc(chan) == NULL) && (filename = strsep(&filename_tmp, "&"))) {
|
||||
if (!quieted
|
||||
&& ast_channel_streamid(chan) == -1
|
||||
&& ast_channel_timingfunc(chan) == NULL
|
||||
&& (filename = ast_strsep(&filename_tmp, '&', AST_STRSEP_STRIP | AST_STRSEP_TRIM))) {
|
||||
/* Discard old stream information */
|
||||
ast_stopstream(chan);
|
||||
/* Start new stream */
|
||||
|
Reference in New Issue
Block a user