On Tue, May 4, 2021 at 8:49 AM Jean Aunis <jean.au...@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:u...@domain.com). > > Currently, this is only possible by specifying the full request URI. For > example, someone could use: > > > MessageSend(pjsip:endpoint/sip:1000@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@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@endpoint/contact_uri For example PJSIP/8005551212@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@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@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
-- _____________________________________________________________________ -- 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