We’ve just recently replaced our company PBX with FreePBX and Asterisk 1.4. We were getting complaints about format_mp3 and how it plays the same song, from the beginning every time you put someone on hold. This is honestly a bad way to do hold music, and I’m not sure why the Asterisk Developers haven’t fixed it, but, it’s easy enough to fix. Here are the steps to take to use madplay instead. Note that we’re using Ubuntu Linux, so the commands may change a bit.

  1. Install madplay

     # apt-get install madplay
    
  2. Login to the FreePBX Control Console and create a Music On Hold context. Next you will want to upload all your mp3’s to this context.

  3. Once your satisfied with the mp3’s you’ve uploaded to your context, you will have to ssh to your box

     # ssh your.pbx.ip
    
  4. After logging in, and su’ing to root, go to /etc/asterisk and edit musiconhold_additional.conf. It should end up looking like this. Replace [Flewid] with your Music on Hold context.

     [Flewid]  
     mode=custom  
     directory=/var/lib/asterisk/mohmp3/Flewid/  
     application=/usr/bin/madplay -Qzr -o raw:- –mono -R 8000 -a -12  
     random=yes
    
  5. Now you will have to stop and start asterisk. Something like this should do the trick.

     # /etc/init.d/asterisk stop  
     # /etc/init.d/asterisk start
    
  6. Now when you issue a ps you should see that madplay is now running. You should see something like the following.

     # ps aux | grep madplay
    
     asterisk 15921 0.0 0.4 5732 2156 ? S Nov21 0:00 /usr/bin/madplay -Qzr -o raw:- –mono -R 8000 -a -12 Party 1992 Intromusic.mp3 A Touch of Spring.mp3 Ice Frontier.mp3 imphobia.mp3 Aquaphobia – 1993 spring.mp3 Lavender Hill.mp3 M16A.mp3 M16C.mp3 MENU.mp3 Minimum Velocity.mp3 Purple Sky II.mp3 Satellite one..mp3 technology.mp3 Turbulence.mp3 Unreal Symphony.mp3 When the heavens fall.mp3
    
  7. That’s it. Now you should have fancy music on hold that won’t start at the beginning of every song, and when people are put on music on hold they will hear the song immediately, instead of waiting for it to start.

There is one problem with this method, in that if you decide to upload any more music on hold files to your context, musiconhold_additional.conf will get overwritten, and you will have to apply this fix again.

It would be nice if the freepbx developers added the option of using madplay from the administration interface. But this isn’t really too big of a deal since musiconhold is changed infrequently (at least for us).

Comments

Comment by israel on 2009-12-23 14:52:27 -0500

Thanks for the info its good even today more than two years later 🙂

just one point
put it in to “musiconhold_custom.conf” and then you dont have to worry of it being over written
it will look for the context first there even if it also is in musiconhold_additional.conf