Switch current hold music?

So this seems like it would be really simple, but I can’t find it anywhere.

The MOH option in FreePBX allows you to either select hold music sequentially, or at random.

Is there a way to program an extension, or a user while on hold, to be able to press a number (or symbol) to stop the current hold music and restart another one at random? So hold music could be played at random, but also be switched through at random.

It seems like it would be really easy to do, either directly with while music is on hold, or by doing some sort of workaround that by pressing a key (say, 9) it restarts them into the hold and thus resets the hold music.

I’m just not quite sure how I could do it.

Any hints, anyone?


Hold music is done through the Asterisk StartMusicOnHold() and StopMusicOnHold() applications which don’t allow for any feedback as far as I’m aware.

I did something like this once. I think asterisk allows you to program the moh.conf file to let you switch the moh class when a key is pressed. Look in the mof.conf for example.