How to change default musiconhold class

Hi Everyone,

In below dialplan (scenario 1), If ‘mymoh’ class is available, then play ‘mymoh’ else ‘default’ moh class. Working as expected.
Scenario 1:
exten => 1000,1,Answer
exten => 1000,2,WaitExten(5,m(mymoh))
exten => 1000,n,HangUp

But, I want to change default moh ‘default’ to ‘mydefault’. (Note: i want to assign default moh class channel wise, channel1- mydefault1 , channel2 - mydefault2 etc.).
For this, I’v done below dialplan. then it always plays ‘mydefault’ eventhoug ‘mymoh’ class is available.
Scenario 2:
exten => 1000,1,Answer
exten => 1000,2,Set(CHANNEL(musicclass)=mydefault)
exten => 1000,3,WaitExten(5,m(mymoh))
exten => 1000,n,HangUp

How can I play ‘mydefault’ only if ‘mymoh’ is not available as in scenario 1?
I appreciate your help.


Nowhere are you allowing the default class to be used, so changing its definition, which can only be done by changing the [default] section in musiconhold.conf, will not do anything.

The relative precedence of different sources for the musiconhold class to use is hard coded in the source code.