PJSIPNotify default endpoint

Hi,

I’m trying to send NOTIFYs from Dialplan using PJSIPNotify (Asterisk 20.12.0). The NOTIFY is not in-dialog. I created a new endpoint, added it to pjsip.conf’s [global] context - it is used as default_outbound_endpoint now while sending the NOTIFY.

I’m getting the endpoint’s URI in the following way:

 same => n,   Set(AOR_CONTACT=${PJSIP_AOR(${EXTENSION_NUMBER},contact)})
 same => n,   Set(NOTIFY_CONTACT=${PJSIP_CONTACT(${AOR_CONTACT},uri)})
 same => n,   Set(NOTIFY_URI=${CUT(NOTIFY_CONTACT,\;,1)})
 same => n,   PJSIPNotify(${NOTIFY_URI},endpoint_test_notify)

where endpoint_test_notify is a context defined in pjsip_notify.conf.
It sends the NOTIFY properly if the default_outbound_endpoint and recipient endpoint’s transport types are matching, e.g. TLS and TLS.
Not every endpoint is connected through TLS and if I change default_outbound_endpoint’s transport to TCP for example, the PJSIPSendNotify fails with error:

[2025-03-13 11:01:57.0436] ERROR[704258]: res_pjsip.c:1769 endpt_send_request: Error 171064 'Unsuitable transport selected (PJSIP_ETPNOTSUITABLE)' sending NOTIFY request to endpoint default_outbound_endpoint
[2025-03-13 11:01:57.0436] ERROR[704258]: res_pjsip_notify.c:780 notify_uri: SIP NOTIFY - Unable to send request for uri sips:<endpoint>@<ip>:<port>

Based on the documentation , there is no way to send the NOTIFY targeting an endpoint like it can be done from CLI (which can find the appropriate transport type):

pjsip send notify endpoint_test_notify endpoint <endpointID>

As default_outbound_endpoint is a global setting, it can’t be just changed from dialplan as far as I know without completely reloading the pjsip module itself.

How can I make it work to send NOTIFYs using PJSIPNotify (from dialplan) to endpoints connecting using different transport types?

Don’t set a transport on the endpoint. It’s not required.

Tried without transport set - this way Asterisk tries to send the NOTIFY on UDP, which is not the correct transport (the endpoint is registered on TCP in this case).

You need to show the actual URI being used for sending, then. If you’re trimming off the transport parameter it’ll use UDP. The transport parameter is what determines the transport type to use[1].

[1] PJSIP Transport Selection - Asterisk Documentation

Yes, you are right. This part was cutting off the transport part:

 same => n,   Set(NOTIFY_URI=${CUT(NOTIFY_CONTACT,\;,1)})

Without transport set on default_outgoing_endpoint and with the whole contact uri it is working as expected.
Thank you :slight_smile: :saluting_face: