Change Music-On-Hold on a Schedule


I would like to have two MOH classes (normal and christmas). Normal plays most of the year and christmas plays during December. Is there a way to make this happen system wide either with a manual switch or a date based schedule?

Any ideas?


Probably. I doubt it will be simple, but I’d say probably.

My gut feeling on this is that currently it would either need custom code (think extensions_custom.conf) or a music on hold custom application/script that would check the date…

I am surprised there seems to be no way to do this currently… I remember years ago in one of my jobs someone would manually change the music on hold on our old PBX for Christmas, I would have assumed by now there would have been a way to automatize this…

Have a nice day!


Calendar control is coming to 14. Put in a feature request

In the interim, a cron job that “ln’s” /var/lib/asterisk/mohchristmas to /var/lib/asterisk/moh on December 1st at 00:01 and another that “ln’s” /var/lib/asterisk/mohnormal to /var/lib/asterisk/moh on Januuary 5th at 23:59 would work. I’ll leave the population of those directories to you.

1 Like

Thanks for the ideas guys!

The cron job is probably best for now, though I’d hoped to be able to do it in asterisk/freepbx. I’ve been playing with using a global variable that holds the MOH class name. The idea is that I could set the variable either programatically or by calling an extension and then when music is played it would use the variable to set the class. This works well in basic testing, but I haven’t been able to figure out how I would use the variable in the parking config or maybe in a route.


Ok, I’m real close I think…

For testing, I’m setting the MOHCLASS variable in globals_custom.conf. When I make a call, I can see that MOH class is getting set to the value of MOHCLASS as expected. However, if the value of MOHCLASS is anything other than ‘default’, no music is played when on hold…my ‘christmas’ class is present and working if I do MusicOnHold(christmas).


Nevermind, it works, I don’t know what I had wrong the first time.

Next step…how to get parking to use the MOHCLASS variable, or honor the channel’s MOH class…

Ok, so if I comment out the ‘parkedmusicclass’ setting in res_parking.conf then the music class is inherit therefore honoring my MOHCLASS value.

Is there a way to override settings in res_parking.conf with custom values that won’t get overwritten by the GUI (which only lets me choose specific music classes)? I just need to completely remove the ‘parkedmusicclass’ setting.