[asterisk-dev] PJSIP messaging : specifying the user portion of the request-URI

Jean Aunis jean.aunis at prescom.fr
Tue May 4 09:49:19 CDT 2021


Hi,

I'm trying to send a SIP MESSAGE to a PJSIP endpoint, while specifying a 
destination number (that is, the "user" portion of the request URI in 
sip:user at domain.com).

Currently, this is only possible by specifying the full request URI. For 
example, someone could use:

 > MessageSend(pjsip:endpoint/sip:1000 at 12.0.0.1)

to send a SIP MESSAGE to number 1000.

But to do this, one needs to know the contact associated to the 
endpoint. This is a problem if the endpoint is dynamically registering 
to Asterisk: the contact information may change over time.

When using the dialplan, there is a straightforward solution: using 
PJSIP_DIAL_CONTACTS.

Things become tricky when using ARI or AMI. Retrieving the contact 
information requires sending an AMI request each time a SIP MESSAGE has 
to be sent... this can create a lot of overhead.

chan_sip used to solve this problem this way: when calling 
MessageSend(sip:user at endpoint), "endpoint" was at first searched in the 
endpoints list before being used as a FQDN or an IP address.

I understand this is more complex with PJSIP because there may be 
multiple AOR/ contacts for a single endpoint...

Any ideas ?

Regards,

Jean





More information about the asterisk-dev mailing list