Play function not working with http links


#1

Hi,
I am using official ARI python library with asterisk 15.5.

I am facing an issue when using channel.play() , when i use channel.play(media=“sound:hello-world”) it works. But when i use channel.play(media=“sound:http://some_url”). It does not work.

Can someone tell me what am I doing wrong?


#2

Have you tried not prefixing it with sound: as the usage of the sound: URI specifies that you want to use a local sound?


#3

I tried using it that way. Its not working. It doesnt play anything.

channel.play(media=“https://www.thesoundarchive.com/play-wav-files.asp?sound=ringtones/Jingle-Bells-Ella.wav”)

I used this.


#4

I haven’t used the functionality so I don’t know anything further off the top of my head. I’d suggest showing any console output too though.


#5

I did console. Whatever I am printing, I am getting in the console so its not an error. It is being executed, but I hear nothing.


#6

I also tried and also cannot get it to work. I also tried with sound:url, and without sound URI scheme.
I checked the Asterisk console and with sound URI scheme, I have the following error:
“WARNING[1637]: file.c:774 ast_openstream_full: File <url\hello-world.wav> does not exist in any format
[Dec 28 10:52:22] WARNING[1637]: file.c:1247 ast_streamfile: Unable to open <url\hello-world.wav> (format (slin)): No such file or directory
[Dec 28 10:52:22] WARNING[1637]: res_stasis_playback.c:277 playback_final_update: 1545994342.7: Playback failed for sound:url/hello-world.wav”

When I tried without URI sheme, the Asterisk console display the following error:
“ERROR[1788]: res_stasis_playback.c:366 play_on_channel: Attempted to play URI ‘url/hello-world.wav’ on channel ‘Announcer/ARI-00000001;1’ but scheme is unsupported”
I checked the code on res_stasis_playback.c file and saw the following code on play_on_channel function:
"else {
/* Play URL */
ast_log(LOG_ERROR, “Attempted to play URI ‘%s’ on channel ‘%s’ but scheme is unsupported\n”, playback->media, ast_channel_name(chan));
continue;
}

Which means that the Asterisk does not yet support playback from URL on a channel or bridge?
I saw that this was implemented since Asterisk v14, and I check on v14, and v16 and the problem is the same.
Has anyone ever been able to?


#7

For the first one, you do not include the file name extension; Asterisk chooses the best available extensions for the codec in use.

For the second one, the error messages doesn’t show a scheme at all.


#8

For both cases when I wrote ‘url/hello-world.wav’ was equivalent to ‘http://myserver/hello-world.wav’.

For the first one, I tried with extension, because with an URL the Asterisk cannot choose the best extension to use, because an URL is just related to one resource (I also tried without an extension and has the same result as expected).

For the second one, the scheme mentioned by Asterisk which is not supported, it’s because is neither of sound, recording,number, digits,characters, or tone (https://wiki.asterisk.org/wiki/display/AST/ARI+and+Channels%3A+Simple+Media+Manipulation).