The ability to send SIP NOTIFY messages to endpoints and arbitrary uri’s via AMI and CLI has existed for some time within Asterisk. Changes from a recent CommUnity UCaaS submission have expanded these capabilities.
This starts with including the ability to send NOTIFY messages within the current SIP dialog for a channel. Previously, manual NOTIFY messages could only be sent to an endpoint or uri.
The CLI command pjsip send notify was added to include this capability. The new syntax is as follows:
pjsip send notify [option] [channel | endpoint | uri] [destination]
More importantly, this capability has now been extended to a new dialplan application PJSIPNotify. The PJSIPNotify application can send either a pre-configured set of headers (read from one of the entries in pjsip_notify.conf) or as a list of headers specified in dialplan to either a specified uri or within the current SIP dialog for the channel.
Let’s take a look at a few dialplan examples and what the resulting NOTIFY looks like.
The following dialplan:
same => n,PJSIPNotify(,&Event=Test&X-Data=Fun)
Results in the following headers being sent within an in-dialog NOTIFY message:
X-Data: Fun
Event: Test
To send a NOTIFY with the same headers to <sip:[email protected]:5260>, specify the uri:
same => n,PJSIPNotify(<sip:[email protected]:5260>,&Event=Test&X-Data=Fun)
The message body can also be set either in dialplan itself:
same => n,PJSIPNotify(,&Event=PotatoReport&Content-type=application/potato-summary&Content=Num-Potatoes: 23&Content=Potato-Quality: fair&Content=)
or via pre-configured entry in pjsip_notify.conf:
same => n,PJSIPNotify(,potato-notify)
[potato-notify]
Event=>PotatoReport
Content-type=>application/potato-summary
Content=>Num-Potatoes: 23
Content=>Potato-Quality: fair
Content=>
Both of these will result in the same headers and body:
Event: PotatoReport
Content-Type: application/potato-summary
Content-Length: 38
Potato-Quality: fair
Num-Potatoes: 23
Please note that in order to use this feature to send a NOTIFY to an arbitrary uri, you need to make sure that default_outbound_endpoint in your global pjsip settings points to a valid configured endpoint.
The post Introducing the PJSIPNotify dialplan application appeared first on Asterisk.
roosho.
I am Rakib Raihan RooSho, Jack of all IT Trades. You got it right. Good for nothing. I try a lot of things and fail more than that. That's how I learn. Whenever I succeed, I note that in my cookbook. Eventually, that became my blog.
No Comment! Be the first one.