How to set MOH on a channel

Hi,

How do you set the music on hold class for the other parties channel?

I have the following…

exten => 100,1,SetMusicOnHold(newclass)
exten => 100,2,Dial(SIP/102)

But when I call extension 100 and put the callee on hold, asterisk still tries to use ‘default’ class.

One of the asterisk developers said…

" Essentially that setting changes it on the current channel so that if musiconhold is activated on that channel, then the new music class is used. When you are in a call and put someone else on hold, you are putting their channel on hold - not yours. Their musicclass has not been changed, so the new one is not used."

So how would I go about setting the musicclass on their channel?

Thanks!

Maybe this just isn’t possible?!?!?

You should use Answer before setting/activating MOH class
use Dial with m option
valuable information with examples:
voip-info.org/wiki-Asterisk+ … nhold.conf
voip-info.org/wiki-Asterisk+cmd+dial

if You set MOH clasess, after Asterisk start
try ps -auxf - You should see some process , that make an audio stream(s)
one process for every mp3 in music on hold clases

Answer is used - I ommitted it in the example code however.

Using Dial with the m option replaces ringing on the channel with the music on hold. It does not actually set a different class of moh on the channel.

Maybe I should report this as a bug?

I have this same problem. SetMusicOnHold is ignored and default is played if a caller is placed on hold. Anyone out there know if this is the way it is supposed to be working? If so, what’s the point of SetMusicOnHold?

My Asterisk console output. Phone numbers removed:

-- Executing NoOp("SIP/XXXXXXXXXXX-0726", "1534") in new stack
-- Executing SetMusicOnHold("SIP/XXXXXXXXXXX-0726", "mohrandom") in new stack
-- Executing Dial("SIP/XXXXXXXXXXX-0726", "SIP/XXXXXXXXXXX") in new stack
-- Called XXXXXXXXXXX
-- SIP/XXXXXXXXXXX-1567 is ringing
-- SIP/XXXXXXXXXXX-1567 answered SIP/XXXXXXXXXXX-0726
-- Attempting native bridge of SIP/XXXXXXXXXXX-0726 and SIP/XXXXXXXXXXX-1567
-- Started music on hold, class 'default', on SIP/XXXXXXXXXXX-1567

SetVariable(“CHANNEL(musicclass)”, “yourMohClassName”);