ARI - Play sound from a file:/// URI

Hi,

I’m trying to play a sound file using ARI’s play command.

"/ari/channels/" + channelId + "/play?&media=" + mediavar

where mediavar is a string describing the URI of the file to be played.

I have successfully played files using

mediavar = "sound:tt-monkeys" or

mediavar = "sound: https://github.com/pbxware/asterisk-sounds/raw/master/demo-congrats.wav "

However, the command does not work when the media is in a file URI. I have tried several combinations, using the URI formats recommended by Wikipedia.

"sound:file:///srv/var/lib/mfa/hello1.wav"

I have also tried the following, to no avail.

"sound:file://srv/var/lib/mfa/hello1.wav"

"sound:/srv/var/lib/mfa/hello1.wav"

What am I missing? Do I need to use http or https for the URI?

Solved!!

I think the main problem is that the documentation does not mention the correct syntax to play a sound file that is not in the regular sounds directory.

After realizing that the file scheme is not implemented, I started a try/error effort until I figured the right syntax. It seems obvious now…

So, do not use the file:/// scheme. Use the full path of the sound file, but omit the extension.

"sound:/srv/var/lib/mfa/demo-congrats"

1 Like