Unable to play media file

When I tried to play media using “channel.play(media=“sound:demo-congrats.alaw”)” ,it is not working .

File Format:

openwrt@pt-node01:~/asterisk-config/sounds$ ls -lrt
total 240
-rwxrwxrwx 1 systemd-network systemd-journal 242214 Jul 21 09:49 demo-congrats.alaw
openwrt@pt-node01:~/asterisk-config/sounds$ file demo-congrats.alaw
demo-congrats.alaw: data
openwrt@pt-node01:~/asterisk-config/sounds$

Asterisk Log:

[Jul 23 12:50:52] DEBUG[248][C-00000032]: media_cache.c:236 ast_media_cache_retrieve: Failed to obtain media at ‘demo-congrats.alaw’
[Jul 23 12:50:52] WARNING[248][C-00000032]: file.c:779 ast_openstream_full: File demo-congrats.alaw does not exist in any format
[Jul 23 12:50:52] WARNING[248][C-00000032]: file.c:1252 ast_streamfile: Unable to open demo-congrats.alaw (format (ulaw)): Invalid argument
[Jul 23 12:50:52] WARNING[248][C-00000032]: res_stasis_playback.c:276 playback_final_update: 1595508640.59: Playback failed for sound:demo-congrats.alaw
[Jul 23 12:50:52] DEBUG[247]:

any suggestion to make it play ?

Delete the .alaw from the reference, but not the file name. Asterisk looks for the best media format, so decides on the file extension.

Also, as good practice, you should remove the execute permissions, and, at least, the world write permission, on the file.

1 Like

It worked after removing .alaw from the reference.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.