Music on hold notification message not sent to peer


Is there any way we can let Asterisk notify the other party when the caller becomes on hold? This would allow the callee to display a message (e.g. ‘on hold’). When using other SIP servers, the callee is being notified so I assume this is possible. By the way, I have ‘notifyhold = yes’ in sip.conf. Thanks.

Asterisk’s SIP channel drivers provide facilities to allow SIP presence subscriptions (RFC3856) to extensions with a defined hint. With an active subscription, devices can receive notification of state changes for the subscribed to extension. That notification will take the form of a SIP NOTIFY with PIDF content (RFC3863) containing the presence/state information.

for more information

1 Like

I have this in my extensions.conf :

exten = peer1,hint,SIP/peer1
exten = peer2,hint,SIP/peer2

and in sip.conf :

notifyhold = yes

core show hints is showing :

-= Registered Asterisk Dial Plan Hints =-

peer1@hint-test : SIP/peer1 State:Idle Presence:not_set Watchers 0
peer2@hint-test : SIP/peer2 State:Idle Presence:not_set Watchers 0

However, when peer1 calls peer2 then peer1 puts call on hold, peer2 is still not being notified.

What am I missing?

There is nothing subscribed to know the status of those. That is why “Watchers” is 0. As well other systems may pass the hold request through end to end (Phone A puts Phone B on hold, Phone B is therefore told to go on hold). In Asterisk this doesn’t go end to end, Asterisk instead generates the hold music itself without telling the device - this way you can control the hold music and such.

How do I get my peers to subscribe? Can it be done automatically (since allowsubscribe=yes) or should the client explicitly send a SUBSCRIBE message? My goal is to let peer2 be notified when peer1 is put on hold so peer2 can display a message (i.e. Call on hold). Thanks!

In SIP you generally can’t tell devices to do things. They have to do it. Whether your device is capable and would even display such a thing is up to it.

The thing is when my same two devices are connected through another SIP server (e.g. Linphone) and peer1 is put on hold, peer2 is displaying ‘Call on hold’ as well. Whereas, when using Asterisk, peer2 is just playing the music but its call duration counter is still running. I thought it was a setting on the server which triggers the client to subscribe automatically…

As I said, if the SIP server in question passes the hold through end to end - then the device could behave like that. Asterisk doesn’t do this by default, although it is a feature of chan_pjsip. The consequence of using it is that Asterisk will not generate hold music which is the opposite behavior of what many individuals want.

When you say that “Asterisk doesn’t do this by default”, does it imply that such a behavior could be triggered using a setting or anything? How? I am using chan_sip. Thanks.

The chan_sip module does not support it. Only the chan_pjsip module does as of Asterisk 14 using the “moh_passthrough” option.