<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, May 4, 2021 at 8:49 AM Jean Aunis <<a href="mailto:jean.aunis@prescom.fr">jean.aunis@prescom.fr</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi,<br>
<br>
I'm trying to send a SIP MESSAGE to a PJSIP endpoint, while specifying a <br>
destination number (that is, the "user" portion of the request URI in <br>
<a href="mailto:sip%3Auser@domain.com" target="_blank">sip:user@domain.com</a>).<br>
<br>
Currently, this is only possible by specifying the full request URI. For <br>
example, someone could use:<br>
<br>
 > MessageSend(pjsip:endpoint/<a href="mailto:sip%3A1000@12.0.0.1" target="_blank">sip:1000@12.0.0.1</a>)<br>
<br>
to send a SIP MESSAGE to number 1000.<br>
<br>
But to do this, one needs to know the contact associated to the <br>
endpoint. This is a problem if the endpoint is dynamically registering <br>
to Asterisk: the contact information may change over time.<br>
<br>
When using the dialplan, there is a straightforward solution: using <br>
PJSIP_DIAL_CONTACTS.<br>
<br>
Things become tricky when using ARI or AMI. Retrieving the contact <br>
information requires sending an AMI request each time a SIP MESSAGE has <br>
to be sent... this can create a lot of overhead.<br>
<br>
chan_sip used to solve this problem this way: when calling <br>
MessageSend(sip:user@endpoint), "endpoint" was at first searched in the <br>
endpoints list before being used as a FQDN or an IP address.<br></blockquote><div><br></div><div>The format that PJSIP_DIAL_CONTACTS returns is</div><div>PJSIP/user@endpoint/contact_uri</div><div>For example</div><div><div>PJSIP/8005551212@provider/sip:<a href="http://sip.provider.com:5060">sip.provider.com:5060</a></div><div></div></div><div><br></div><div>Dial() doesn't need the contact_uri  but it can be supplied.</div><div><br></div><div>I think the easiest way to solve this is to just allow MessageSend take<br></div><div>the same format as a simple dial string like so</div><div><br></div><div><div><div>MessageSend(pjsip:PJSIP/8005551212@provider)</div><div><div>"pjsip:" routes the request to the pjsip channel driver.</div><div>"PJSIP/" tells the pjsip channel driver that what follows is formatted as a</div><div>dial string.</div><div><br></div><div></div></div><div></div></div><div></div></div><div>If you wanted to supply the contact_uri as well, you could do</div><div><div><div><div>MessageSend(pjsip:PJSIP/8005551212@provider/sip:<a href="http://sip.provider.com:5060">sip.provider.com:5060</a>)</div><div>If not, we'd take the first contact of the first aor and use that.</div><div></div></div><div></div></div><div></div></div><div> <br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
I understand this is more complex with PJSIP because there may be <br>
multiple AOR/ contacts for a single endpoint...<br></blockquote><div><br></div><div>Yep, there's the issue and I'm not sure how to get around that other than</div><div>the caller specifying a specific contact uri or us trying every contact for</div><div>every aor associated to an endpoint and stopping when we get a</div><div>202 Message Accepted.</div><div><br></div><div>If we can stick to the first contact on the first aor or specifying</div><div>the specific contact uri, that's a quick  modification to my current</div><div>patch up on gerrit.  If we have to go down the route of trying</div><div>in turn, that's something that will need more thought.</div><div><br></div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
Any ideas ?<br>
<br>
Regards,<br>
<br>
Jean<br>
<br>
<br>
<br>
-- <br>
_____________________________________________________________________<br>
-- Bandwidth and Colocation Provided by <a href="http://www.api-digital.com" rel="noreferrer" target="_blank">http://www.api-digital.com</a> --<br>
<br>
asterisk-dev mailing list<br>
To UNSUBSCRIBE or update options visit:<br>
   <a href="http://lists.digium.com/mailman/listinfo/asterisk-dev" rel="noreferrer" target="_blank">http://lists.digium.com/mailman/listinfo/asterisk-dev</a></blockquote></div></div>