Streaming audio in MOH causes 100% cpu usage over 24 hours

I added streaming audio for moh at the request of the ‘boss’ yesterday at about 5:00pm. It seemed to work ok.

This is the entry in my moh_addition.conf

application=/usr/bin/mpg123 -q -s --mono -r 8000 -f 8192 -b 0 http://145.58.33.31:8058

Today I started to experience some choppy audio so I checked the system and saw that the cpu usage was red and stating 100%.

I noticed via webmin there were 3 seperate processes running the above application. I terminated the running process and waited.

After about 1 hour I checked back and I had two process running and had been for about 40 minutes and I had no one on hold.

So it appears to me the process is not stopping when no longer needed.

Does anyone know how to control this. Or is there a better way to get streaming MOH.

Thanks Rob

Found that madplay works better, and call it from a script.

musiconhold.conf
[default]
mode=custom
application=/etc/asterisk/mohstream.sh

mohplay.sh Script (chmod 755, and place it in /etc/asterisk directory)
#!/bin/bash
/usr/bin/wget -q -O - http://64.72.118.44:8002 | /usr/local/bin/madplay -Q -z -o raw:- --mono -R 8000 -a -18 -

Madplay needs to be downloaded and compiled + libraries.

Thanks for the info. I’ll give that a try.

I see that I have two instances running of the other right now. Still trying to figure out why they won’t quit.

I’ll try your suggestion and see how it pans out.

Thanks again for the info.

djspike,

I tried your suggestion, however after a day or so I had about 10 mohplay.sh scripts running. All appeared to be streaming audio to never never land. Should there not be a quit command or somthing to stop it from playing when not used anymore?

Thanks

Rob

I’ve run into the same issue Rob, and hopefully this helps you.

I tested this a few times. I put myself on hold on a phone and ran “pkill mpg123”. There was no discernible audio skip as the process closed and asterisk restarted mpg123. Audio stayed up on the MOH the entire time.

The next step I took was to setup a Cron job that runs “pkill mpg123” every 10 minutes (about how long before mpg123 reaches 20% cpu usage for me). I’ve been running this way for a few days now and have not had any issues since.

I’m not saying its the most graceful solution, but it works for me.

-Gizmo