mp3 moh/sounds not played ! (asterisk 1.6.1)

Hello all !

I have various mp3 sounds and moh. But when asterisk trys to play them, here is what I get :

[May 27 16:27:00] WARNING[2493]: file.c:924 ast_streamfile: Unable to open custom/SalesDeWillkommen (format 0x4 (ulaw)): No such file or directory

I suppose that it wants the file in a ulaw format. Is there any feature to modify so that asterisk does translate the mp3 file into ulaw on the fly ?

Thanks a lot for any feedback !


(asterisk 1.6.1)

Do not add the format to the file you want to play.

Like this :

Not like this :

In your directory custom/ you need the file with the format.
Like this :

SalesDeWillkommen.ulaw SalesDeWillkommen.alaw SalesDeWillkommen.gsm

Depending on the codec of the conversation, Asterisk will take the corresponding format.

From :

[quote]In order to use Asterisk’s built in MOH playback support with the default MOH mp3 files (fpm-calm-river.mp3, fpm-sunshine.mp3, fpm-world-mix.mp3) you must have installed the asterisk-addons package! It contains a utility called format_mp3 which is required for mp3 playback.
Note: in Asterisk 1.4 the default file format is changed to wav which does not require format_mp3[/quote]

With ‘sox’ you can convert .wav-files to ulaw, alaw or gsm…

Hallo jonaskellens,

thank you very much for your detailed reply ! And I hope you could give me some more feedback on the following …

  1. I did not add the file format.

  2. For now, in my directory custom/ there is only the file SalesDeWillkommen.mp3 and I would like that this is played in all cases (as it is more simple for me - you’ll see why …)
    I checked and during the compilation of asterisk 1.6 I integrated app_mp3 - do I need anything else to play mp3 files ?

  3. I would like to convert certain files (that change rarly) into the varous codecs, but I have the following problems: for now I have the files in mp3 format
    3a) so I need a solution to convert the mp3 files to wav files in order to continue with sox
    3b) once I have a wav file, could you tell me which is the sox command to execute in order to get a regular alaw, ulaw, … format ?

Thanks a lot for any further advice !


Hello jonaskellens,

I discovered that mpg123 wasn’t installed on my ubutu server (but mpg321) and this cause that the mp3 files were not played. Now this works fine.

But still I would be very interested int playing files in the channel’s codec in order to make thinks more simple in terms of cpu (or do you think that this does not eat a lot of cpu ?).

So what I need is to convert my mp3 files into alaw and ulaw format. Could you give me a hint on how I may do this (I don’t know the command for sox and I tryed to fied it, but I did not get it for the current version of sox …).

Thanks a lot for any feedback !