Asterisk cannot find sound files

The problem: you get error messages from Asterisk when it tries to play a sound file:

Sep 22 09:23:59 WARNING[25263] file.c: File agent-pass does not exist in any format
Sep 22 09:23:59 WARNING[25263] file.c: Unable to open agent-pass (format ulaw): No such file or directory

But you can see the file there in /usr/share/asterisk/sounds (or similar location).

First, open an Asterisk console and do 'show file formats':

 devonian*CLI> show file formats
 Format     Name       Extensions          
 slin       wav        wav                 
 adpcm      vox        vox                 
slin       sln        sln|raw             
gsm        wav49      WAV|wav49           
ulaw       pcm        pcm|ulaw|ul|mu      
alaw       alaw       alaw|al             
ilbc       iLBC       ilbc                
h263       h263       h263                
gsm        gsm        gsm                 
g729       g729       g729                
g726       g726-16    g726-16             
g726       g726-24    g726-24             
g726       g726-32    g726-32             
g726       g726-40    g726-40             
g723       g723sf     g723|g723sf         
ulaw       au         au                  
slin       ogg_vorbis ogg                 
17 file formats registered.

That'll show the formats available and the file extensions they should have. Check your file exists and with the right extension.

Next, see whether your translation has been activated. Asterisk needs to translate the audio between the stored format and the format it sends out over the VOIP connection. It's best to transcode your recording into the VOIP format so Asterisk doesn't have to do it in real time. To see the active translations, do:

devonian*CLI> show translation
         Translation times between formats (in milliseconds)
          Source Format (Rows) Destination Format(Columns)

         g723   gsm  ulaw  alaw  g726 adpcm  slin lpc10  g729 speex  ilbc
   g723     -     -     -     -     -     -     -     -     -     -     -
    gsm     -     -    52    52    92    54    51 14628     - 64027     -
   ulaw     - 12442     -     1    45     7     4 14581     - 63980     -
   alaw     - 12442     2     -    45     7     4 14581     - 63980     -
   g726     - 12472    35    35     -    37    34 14611     - 64010     -
  adpcm     - 12442     5     5    45     -     4 14581     - 63980     -
   slin     - 12438     1     1    41     3     - 14577     - 63976     -
  lpc10     - 28229 15792 15792 15832 15794 15791     -     - 79767     -
   g729     -     -     -     -     -     -     -     -     -     -     -
  speex     - 27150 14713 14713 14753 14715 14712 29289     -     -     -
   ilbc     -     -     -     -     -     -     -     -     -     -     -

This shows the codecs available and their performance. 'devonian' is a slow wireless router, which is why many codecs take much longer than realtime to transcode.

Is this list sparsely populated? Are you running on slow hardware? Have you just (re)started Asterisk? In which case you might run into an artifact of the way Asterisk starts up its codecs.

Asterisk computes the above table by running transcoding tests for each entry in the table when it starts up. If you're on slow hardware, these tests may take several minutes (the lpc10 to speex test above took 79 seconds). While the tests are going on, the codec isn't available for use by Asterisk. If you try to play a recording while the test is going on it may declare there's no sound file available, because the codec hasn't been initialised yet. For example, in this situation I see:

devonian*CLI> show file formats
Format     Name       Extensions          
slin       ogg_vorbis ogg                 
1 file format registered.

In this state it can't play anything other than ogg. Asterisk will still work, but will give the error on playing any audio files that aren't ogg.

The situation can be much improved by disabling some codecs. For example, to disable speex and lpc10 do this in modules.conf:
noload => codec_speex.so
noload => codec_lpc10.so

You should see the startup time much imporved.
The problem: you get error messages from Asterisk when it tries to play a sound file:

Sep 22 09:23:59 WARNING[25263] file.c: File agent-pass does not exist in any format
Sep 22 09:23:59 WARNING[25263] file.c: Unable to open agent-pass (format ulaw): No such file or directory

But you can see the file there in /usr/share/asterisk/sounds (or similar location).

First, open an Asterisk console and do 'show file formats':

 devonian*CLI> show file formats
 Format     Name       Extensions          
 slin       wav        wav                 
 adpcm      vox        vox                 
slin       sln        sln|raw             
gsm        wav49      WAV|wav49           
ulaw       pcm        pcm|ulaw|ul|mu      
alaw       alaw       alaw|al             
ilbc       iLBC       ilbc                
h263       h263       h263                
gsm        gsm        gsm                 
g729       g729       g729                
g726       g726-16    g726-16             
g726       g726-24    g726-24             
g726       g726-32    g726-32             
g726       g726-40    g726-40             
g723       g723sf     g723|g723sf         
ulaw       au         au                  
slin       ogg_vorbis ogg                 
17 file formats registered.

That'll show the formats available and the file extensions they should have. Check your file exists and with the right extension.

Next, see whether your translation has been activated. Asterisk needs to translate the audio between the stored format and the format it sends out over the VOIP connection. It's best to transcode your recording into the VOIP format so Asterisk doesn't have to do it in real time. To see the active translations, do:

devonian*CLI> show translation
         Translation times between formats (in milliseconds)
          Source Format (Rows) Destination Format(Columns)

         g723   gsm  ulaw  alaw  g726 adpcm  slin lpc10  g729 speex  ilbc
   g723     -     -     -     -     -     -     -     -     -     -     -
    gsm     -     -    52    52    92    54    51 14628     - 64027     -
   ulaw     - 12442     -     1    45     7     4 14581     - 63980     -
   alaw     - 12442     2     -    45     7     4 14581     - 63980     -
   g726     - 12472    35    35     -    37    34 14611     - 64010     -
  adpcm     - 12442     5     5    45     -     4 14581     - 63980     -
   slin     - 12438     1     1    41     3     - 14577     - 63976     -
  lpc10     - 28229 15792 15792 15832 15794 15791     -     - 79767     -
   g729     -     -     -     -     -     -     -     -     -     -     -
  speex     - 27150 14713 14713 14753 14715 14712 29289     -     -     -
   ilbc     -     -     -     -     -     -     -     -     -     -     -

This shows the codecs available and their performance. 'devonian' is a slow wireless router, which is why many codecs take much longer than realtime to transcode.

Is this list sparsely populated? Are you running on slow hardware? Have you just (re)started Asterisk? In which case you might run into an artifact of the way Asterisk starts up its codecs.

Asterisk computes the above table by running transcoding tests for each entry in the table when it starts up. If you're on slow hardware, these tests may take several minutes (the lpc10 to speex test above took 79 seconds). While the tests are going on, the codec isn't available for use by Asterisk. If you try to play a recording while the test is going on it may declare there's no sound file available, because the codec hasn't been initialised yet. For example, in this situation I see:

devonian*CLI> show file formats
Format     Name       Extensions          
slin       ogg_vorbis ogg                 
1 file format registered.

In this state it can't play anything other than ogg. Asterisk will still work, but will give the error on playing any audio files that aren't ogg.

The situation can be much improved by disabling some codecs. For example, to disable speex and lpc10 do this in modules.conf:
noload => codec_speex.so
noload => codec_lpc10.so

You should see the startup time much imporved.
Created by: caliston, Last modification: Fri 04 of Dec, 2009 (04:43 UTC) by admin
Please update this page with new information, just login and click on the "Edit" or "Discussion" tab. Get a free login here: Register Thanks! - Find us on Google+