Asterisk not finding the sound files

I’ve a running Asterisk 1.4 installation, mostly operating correctly however I cannot get it to play any of the sound files from /var/lib/asterisk/sounds/, even when I specify the full path to the files.

I’ve got both gsm and alaw versions installed (originally had just the gsm but added the alaw of the two I’m trying to use in case it was a codec issue).

Here’s the test entry from extensions.conf that should play the sound files, I repeated the calls several times to make it easier to spot the relevant section of the log file (this is a reasonably busy system):

exten => 1929,1,Answer()
exten => 1929,n,Playback(warning)
exten => 1929,n,Playback(warning)
exten => 1929,n,Playback(/var/lib/asterisk/sounds/test-tones-follow)
exten => 1929,n,Playback(/var/lib/asterisk/sounds/test-tones-follow)
exten => 1929,n,Playtones(test929)
exten => 1929,n,Wait(60)
exten => 1929,n,Hangup()

When I dial 1929 on an attached SIP phone however, this is what happens:

[2011-10-04 19:44:18] VERBOSE[27265] logger.c: [2011-10-04 19:44:18] – Executing [1929@0113xxxyyyy:1] Set(“SIP/0113xxxyyyy-08ada018”, “CALLERID(all)=“0113xxxyyyy” <0113xxxyyyy>”) in new stack
[2011-10-04 19:44:18] VERBOSE[27265] logger.c: [2011-10-04 19:44:18] – Executing [1929@0113xxxyyyy:2] Set(“SIP/0113xxxyyyy-08ada018”, “CALLERID(ANI)=0113xxxyyyy”) in new stack
[2011-10-04 19:44:18] VERBOSE[27265] logger.c: [2011-10-04 19:44:18] – Executing [1929@0113xxxyyyy:3] Playback(“SIP/0113xxxyyyy-08ada018”, “warning”) in new stack
[2011-10-04 19:44:18] WARNING[27265] file.c: File warning does not exist in any format
[2011-10-04 19:44:18] WARNING[27265] file.c: Unable to open warning (format 0x8 (alaw)): Permission denied
[2011-10-04 19:44:18] WARNING[27265] app_playback.c: ast_streamfile failed on SIP/0113xxxyyyy-08ada018 for warning
[2011-10-04 19:44:18] VERBOSE[27265] logger.c: [2011-10-04 19:44:18] – Executing [1929@0113xxxyyyy:4] Playback(“SIP/0113xxxyyyy-08ada018”, “/var/lib/asterisk/sounds/test-tones-follow”) in new stack
[2011-10-04 19:44:18] WARNING[27265] file.c: File /var/lib/asterisk/sounds/test-tones-follow does not exist in any format
[2011-10-04 19:44:18] WARNING[27265] file.c: Unable to open /var/lib/asterisk/sounds/test-tones-follow (format 0x8 (alaw)): Permission denied
[2011-10-04 19:44:18] WARNING[27265] app_playback.c: ast_streamfile failed on SIP/0113xxxyyyy-08ada018 for /var/lib/asterisk/sounds/test-tones-follow
[2011-10-04 19:44:18] VERBOSE[27265] logger.c: [2011-10-04 19:44:18] – Executing [1929@0113xxxyyyy:5] Playback(“SIP/0113xxxyyyy-08ada018”, “/var/lib/asterisk/sounds/test-tones-follow”) in new stack
[2011-10-04 19:44:18] WARNING[27265] file.c: File /var/lib/asterisk/sounds/test-tones-follow does not exist in any format
[2011-10-04 19:44:18] WARNING[27265] file.c: Unable to open /var/lib/asterisk/sounds/test-tones-follow (format 0x8 (alaw)): Permission denied
[2011-10-04 19:44:18] WARNING[27265] app_playback.c: ast_streamfile failed on SIP/0113xxxyyyy-08ada018 for /var/lib/asterisk/sounds/test-tones-follow
[2011-10-04 19:44:18] VERBOSE[27265] logger.c: [2011-10-04 19:44:18] – Executing [1929@0113xxxyyyy:6] PlayTones(“SIP/0113xxxyyyy-08ada018”, “test929”) in new stack
[2011-10-04 19:44:18] VERBOSE[27265] logger.c: [2011-10-04 19:44:18] – Executing [1929@0113xxxyyyy:7] Wait(“SIP/0113xxxyyyy-08ada018”, “60”) in new stack

The test tones themselves (test929) play fine, but all of the sound files, regardless of how specified, give that double “does not exist / permission denied” error.

The relevant files most definitely do exist:

/etc/asterisk (LIVE)# ls -la /var/lib/asterisk/sounds/test-tones-follow*
-rw-r–r-- 1 root root 12160 Oct 4 19:25 /var/lib/asterisk/sounds/test-tones-follow.alaw
-rw-r–r-- 1 AstUser AstUser 2508 Dec 5 2007 /var/lib/asterisk/sounds/test-tones-follow.gsm

/etc/asterisk (LIVE)# ls -la /var/lib/asterisk/sounds/warn*
-rw-r–r-- 1 root root 6080 Oct 4 19:25 /var/lib/asterisk/sounds/warning.alaw
-rw-r–r-- 1 AstUser AstUser 1254 Dec 5 2007 /var/lib/asterisk/sounds/warning.gsm

Asterisk runs as root and the files are globally readable (644), so “permission denied” makes no sense.

I’ve tried Googling for the error, and I see it appearing in log file snippets in various forums but invariably as a side issue, not the subject of the question and not addressed in the answers. The O’Reilly Asterisk book mentions the sound files and how to play them, but doesn’t seem to cover this error.

Anyone else come across this, and how do I correct it?

Thanks in advance!

They are not in the language sub-directory.

Ta, but we don’t have the options set to use language subdirectories (1.4 doesn’t do that by default, you have to specify the language in the channel config and enable the subdirectory options, it came in by default with 1.6).

Eventually found the problem - the /var/lib/asterisk and /var/lib/asterisk/sounds directories themselves had at some point been chmod 750 instead of 755. Even though Asterisk was running as root, it was unable to access these directories due to the missing execute bits in the global set.

Both levels were drwxr-x— instead of drwxr-xr-x. Didn’t stop root from cding to the directories directly, but did stop any process that tried to access them. Spotted it when I tried to scp the .gsm files across to a test platform which didn’t have the sound files installed, in order to try experimenting with the language subdir options, and the scp kept failing with permission denied errors. So your suggestion did lead us to the actual cause of the problem.

Cheers!