Issue with MOH and streams staying active 24/7


I have set up a small asterisk system for my own personal use, and one idea I had was to be able to listen to internet radio on speakerphone. I got it working just fine with mpg123, but the problem is that the streams stay active even when I’m not listening to them.

This means that I have 6 streams going 24/7, which is a waste of resources (I got plenty of bandwidth, so that’s not a problem, but it just feels wasteful).

What I would like to do is have the MoH application quit when it’s not being actively used. Can this be done?

Example of musiconhold_additional.conf:
application=/usr/bin/mpg123 -q -s --mono -r 8000 -f 8192 -b 0

This is then used in a queue which I call into when I want to listen. Maybe that’s the problem?

Any ideas?


Maybe you can patch together something with app_jack instead of using music on hold.

Use a System() call to set up your player and connect it to Jack, then call Jack() in your dialplan and have your h extension or a hangup handler terminiate the process you started that’s feeding your MP3 stream into Jack.

That sounds like an idea.

I’ll look into it, thanks!