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

George Joseph gjoseph at sangoma.com
Wed Jun 9 09:18:48 CDT 2021


Hi Guys,

The change for allowing a dialstring-like destination in MessageSend (pjsip
only) is now committed in the 16, 18 and master branches.  You can now use
MessageSend(pjsip:PJSIP/<number>@<provider_endpoint>) and the request URI
will be composed of the endpoint's contact uri with the number inserted as
the user portion of the uri.  Please give it a test.

For Asterisk 19 (not an LTS release) what would you guys think of changing
the MessageSend application to accept discrete parameters for destination
uri, endpoint, user, etc.?  This would remove about 400 lines of fuzzy
parsing code and give you the most flexibility in constructing a
destination.

On Tue, May 4, 2021 at 12:30 PM George Joseph <gjoseph at sangoma.com> wrote:

>
>
> On Tue, May 4, 2021 at 8:49 AM Jean Aunis <jean.aunis at prescom.fr> wrote:
>
>> 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.
>>
>
> The format that PJSIP_DIAL_CONTACTS returns is
> PJSIP/user at endpoint/contact_uri
> For example
> PJSIP/8005551212 at provider/sip:sip.provider.com:5060
>
> Dial() doesn't need the contact_uri  but it can be supplied.
>
> I think the easiest way to solve this is to just allow MessageSend take
> the same format as a simple dial string like so
>
> MessageSend(pjsip:PJSIP/8005551212 at provider)
> "pjsip:" routes the request to the pjsip channel driver.
> "PJSIP/" tells the pjsip channel driver that what follows is formatted as a
> dial string.
>
> If you wanted to supply the contact_uri as well, you could do
> MessageSend(pjsip:PJSIP/8005551212 at provider/sip:sip.provider.com:5060)
> If not, we'd take the first contact of the first aor and use that.
>
>
>>
>> I understand this is more complex with PJSIP because there may be
>> multiple AOR/ contacts for a single endpoint...
>>
>
> Yep, there's the issue and I'm not sure how to get around that other than
> the caller specifying a specific contact uri or us trying every contact for
> every aor associated to an endpoint and stopping when we get a
> 202 Message Accepted.
>
> If we can stick to the first contact on the first aor or specifying
> the specific contact uri, that's a quick  modification to my current
> patch up on gerrit.  If we have to go down the route of trying
> in turn, that's something that will need more thought.
>
>
>
>
>>
>> Any ideas ?
>>
>> Regards,
>>
>> Jean
>>
>>
>>
>> --
>> _____________________________________________________________________
>> -- Bandwidth and Colocation Provided by http://www.api-digital.com --
>>
>> asterisk-dev mailing list
>> To UNSUBSCRIBE or update options visit:
>>    http://lists.digium.com/mailman/listinfo/asterisk-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20210609/1dbfae4b/attachment-0001.html>


More information about the asterisk-dev mailing list