Unable to Play Sound Files in Asterisk IVR (File not found error)

Hello Asterisk Community,

I’m encountering an issue while trying to play a sound file in my Asterisk-based IVR setup. Specifically, when I attempt to play a sound file (welcome-message.wav), I get the following error in the Asterisk logs:
[Jan 17 15:33:32] WARNING[13543][C-00000002] file.c: Unable to open playback.wav (format (ulaw)): No such file or directory
[Jan 17 15:33:32] WARNING[13543][C-00000002] pbx_builtins.c: ast_streamfile failed on SIP/1000-00000001 for playback.wav
Here’s what I’ve done so far to resolve the issue:

  1. I’ve confirmed that the sound files are in the correct directory (/var/lib/asterisk/sounds/) and have the correct permissions.
  2. I tried both .wav and .ulaw file formats.
  3. I verified that Asterisk has access to the /var/lib/asterisk/sounds/ directory.
  4. I attempted to change the file name and paths as per the logs, but the issue persists.
  5. I also tested with .ulaw files but got similar errors related to not being able to locate the file.

Here is my current directory structure:

/var/lib/asterisk/sounds$ ls
custom playback.wav welcome-message.ulaw

[Jan 17 15:33:32] WARNING[13543][C-00000002] file.c: Unable to open playback.wav (format (ulaw)): No such file or directory
[Jan 17 15:33:32] WARNING[13543][C-00000002] pbx_builtins.c: ast_streamfile failed on SIP/1000-00000001 for playback.wav

Here’s my relevant configuration for the IVR (extensions.conf):

[ivr-context]
exten => 1000,1,Answer()
exten => 1000,n,Background(/var/lib/asterisk/sounds/playback.wav) ; Play welcome message once
exten => 1000,n,WaitExten(5)

exten => 1,1,Background(option1)
exten => 1,n,Hangup()

exten => 2,1,Background(option2)
exten => 2,n,Hangup()

exten => i,1,Background(invalid-option)
exten => i,n,Goto(ivr-context,s,1)

exten => t,1,Background(timeout-message)
exten => t,n,Goto(ivr-context,s,1)

Questions:

  1. Why am I getting the “No such file or directory” error for sound files even though they exist in the correct directory and have the right permissions?
  2. Is there something specific I need to do to make .wav or .ulaw files compatible with Asterisk’s playback system?
  3. Are there any other file formats or configurations that I should try to resolve this issue?

I would appreciate any guidance or suggestions you may have to resolve this issue.

Thank you in advance!

You don’t specify the file extension. You just call Background(playback) and it will find the file.

I tried that also still getting same type of error so I give path of that particular file

Show the attempt with no file extension or path.

/etc/asterisk$ sudo tail -f /var/log/asterisk/full
[Jan 17 16:10:37] ERROR[14822] loader.c: pbx_dundi declined to load.
[Jan 17 16:10:37] ERROR[14822] loader.c: app_voicemail declined to load.
[Jan 17 16:10:37] ERROR[14822] loader.c: app_voicemail_odbc declined to load.
[Jan 17 16:10:37] ERROR[14822] loader.c: chan_unistim declined to load.
[Jan 17 16:10:37] ERROR[14822] loader.c: res_hep_pjsip declined to load.
[Jan 17 16:10:37] WARNING[14832] chan_sip.c: chan_sip has no official maintainer and is deprecated. Migration to
[Jan 17 16:10:37] WARNING[14832] chan_sip.c: chan_pjsip is recommended. See guides at the Asterisk Wiki:
[Jan 17 16:10:37] WARNING[14832] chan_sip.c: https://wiki.asterisk.org/wiki/display/AST/Migrating+from+chan_sip+to+res_pjsip
[Jan 17 16:10:37] WARNING[14832] chan_sip.c: https://wiki.asterisk.org/wiki/display/AST/Configuring+res_pjsip
[Jan 17 16:10:37] VERBOSE[14822] asterisk.c: Asterisk Ready.
[Jan 17 16:10:48] WARNING[14908][C-00000001] file.c: File playback does not exist in any format
[Jan 17 16:10:48] WARNING[14908][C-00000001] file.c: Unable to open playback (format (ulaw)): No such file or directory
[Jan 17 16:10:48] WARNING[14908][C-00000001] pbx_builtins.c: ast_streamfile failed on SIP/1000-00000000 for playback

here is my voice files

/var/lib/asterisk/sounds$ ls
custom playback.wav welcome-message.ulaw

Does Asterisk have permission to access the file? Is Asterisk configured with a different path for sounds?

yes it is configured for the different path for the sounds

my sound directory is already created when we installed asterisk and it is inside /var/lib/asterisk/sounds and we perfoming our actions in /etc/asterisk so is it ok or need to work on same directory.

and my ubuntu version is No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 22.04.2 LTS
Release: 22.04
Codename: jammy

and asterisk -V
Asterisk 18.10.0~dfsg+~cs6.10.40431411-2

What is the output of the “core show settings” CLI command? Additionally, if you try a full path minus the file extension what happens then?

Try in default language and country folder

Like

sounds/en/US this is for english country US

On Fri, 17 Jan, 2025, 6:47 pm jcolp via Asterisk Community, <notifications@asterisk.discoursemail.com> wrote:

jcolp Asterisk Project Lead
January 17

What is the output of the “core show settings” CLI command? Additionally, if you try a full path minus the file extension what happens then?


Visit Topic or reply to this email to respond.

You are receiving this because you enabled mailing list mode.

To unsubscribe from these emails, click here.

Does the asterisk user (whichever user you have got asterisk process running) have access to both the folders and files?

For example, if you’ve moved the file in to /var/lib/asterisk/sounds using the root user with incorrect chmod permissions, the file won’t be able to be opened. Recommend running chown to the asterisk user and group and modifying chmod permissions to suit.

sudo chown -R asterisk:asterisk /var/lib/asterisk/sounds/
sudo chmod -R 755 /var/lib/asterisk/sounds/

I am able to do call but in only thing I am getting error is during call I am not getting any sound and for sound I am getting this error sudo tail -f /var/log/asterisk/full
[Jan 20 10:25:40] WARNING[10078][C-00000001] pbx_builtins.c: ast_streamfile failed on SIP/1000-00000000 for invalid-option
[Jan 20 10:25:40] WARNING[10078][C-00000001] file.c: File invalid-option does not exist in any format
[Jan 20 10:25:40] WARNING[10078][C-00000001] file.c: Unable to open invalid-option (format (ulaw)): No such file or directory
[Jan 20 10:25:40] WARNING[10078][C-00000001] pbx_builtins.c: ast_streamfile failed on SIP/1000-00000000 for invalid-option
[Jan 20 10:25:40] WARNING[10078][C-00000001] file.c: File invalid-option does not exist in any format
[Jan 20 10:25:40] WARNING[10078][C-00000001] file.c: Unable to open invalid-option (format (ulaw)): No such file or directory
[Jan 20 10:25:40] WARNING[10078][C-00000001] pbx_builtins.c: ast_streamfile failed on SIP/1000-00000000 for invalid-option
[Jan 20 10:25:40] WARNING[10078][C-00000001] file.c: File invalid-option does not exist in any format
[Jan 20 10:25:40] WARNING[10078][C-00000001] file.c: Unable to open invalid-option (format (ulaw)): No such file or directory
[Jan 20 10:25:40] WARNING[10078][C-00000001] pbx_builtins.c: ast_streamfile failed on SIP/1000-00000000 for invalid-option
[Jan 20 12:10:23] WARNING[11545][C-00000002] file.c: File welcome-message does not exist in any format
[Jan 20 12:10:23] WARNING[11545][C-00000002] file.c: Unable to open welcome-message (format (ulaw)): No such file or directory
[Jan 20 12:10:23] WARNING[11545][C-00000002] pbx_builtins.c: ast_streamfile failed on SIP/1000-00000001 for welcome-message

A security issue, rather than the cause of your problem, but you should not be setting the sound files to be executable, only the directories.