Music on Hold

Hello All, I want to do my own music on hold and I did as I’ve found on internet in musiconhold.conf file I added my context myclass after that creat directory
/var/lib/asterisk/moh/music2

[myclass]
mode=files
directory=/var/lib/asterisk/moh/music2

in extensions.conf added

exten => 1,1,Dial(SIP/2001,10)
exten => 1,n,SetMusicOnHold(myclass)
exten => 1,n,Hangup()

but didn’t work why I can’t understand

Are there any errors in the console or the log? I’m a newbie myself but I assume an error should appear in the log if it was unable to locate or play a file. Did you need help finding the log or changing how verbose the CLI output is?

There are no Errors it simply plays default music on hold as follows, and I’m confused

[default]
mode=files
directory=/var/lib/asterisk/moh/music

but I want to play this music which I put it in

[myclass]
mode=files
directory=/var/lib/asterisk/moh/music2

i am not near my asterisk boxes right so i am just guessing
what happens if you comment out the default context, and rename yours to default?
What kind of files are you using?

My guess would be the file format. What errors are there in the CLI ? Also if you are using 1.6.X there is a new command for setting musiconhold. voip-info.org/wiki/view/Aste … usicOnHold

[quote=“giomax”]There are no Errors it simply plays default music on hold as follows, and I’m confused

[default]
mode=files
directory=/var/lib/asterisk/moh/music

but I want to play this music which I put it in

[myclass]
mode=files
directory=/var/lib/asterisk/moh/music2[/quote]

There still does not appear to be enough information to help you but I will take a shot. The myclass in [myclass] is the context. You can specify an unlimited number of contexts. In your dialplan there is a command called SetMusicOnHold which takes the class parameter which determines which class of music to play to the caller.

;notice 'myclass' matches the context in your conf file exten=B,1,SetMusicOnHold(myclass)

You have 3 options here. You can delete the myclass class from your conf file, change the default class directory value to point to /var/lib/asterisk/moh/music2 and leave your dialplan alone.

OR

You can move your music from /var/lib/asterisk/moh/music2 to /var/lib/asterisk/moh/music and delete the myclass class.

OR

You can update your dialplan to set the class of music you want to play to the caller.