[Asterisk-Users] Re: Music on Hold - can it be done without mpg123?

James H. Cloos Jr. cloos at jhcloos.com
Tue Jan 20 19:54:22 MST 2004


With a bit of coding it can be done w/o mp3.  

asterisk/res/res_musiconhold.c needs to me modified to know how to
handle some other format.  I'd suggest 16-bit mono pcm files with
either wav or au headers.  If you are only dumping your MoH to zap
ports, g.711 with wav or au headers is also a good choice.

Current versions of sox(1) can convert even mp3 and ogg/vorbis to
uncompressed formats such as pcm.  Try:

  sox file.ogg -s -w -c 1 -r 8000 file.au resample -ql

or:

  sox file.mp3 -s -w -c 1 -r 8000 file.au resample -ql

as applicable.  Use -U or -A rather than -s -w to convert to mulaw or
alaw g.711.  Use -g instead of -s -w to convert to gsm.  (In the gsm
case you may as well use a .gsm suffix; the resulting files will be
the same as the sound files shipped w/ *.)

Once you have the files converted, edit res_musiconhold.c:moh_register
and add support for your chosen file format.  Look for the line:

 ast_log(LOG_WARNING, "Don't know how to do a mode '%s' music on hold\n", mode);


Another alternative is to write your own MoH app (it could even be an
EAGI) that does whatever you like.  

-JimC




More information about the asterisk-users mailing list