<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Dec 6, 2017 at 2:16 PM, Wilkins, Steve <span dir="ltr"><<a href="mailto:swwilkins@mitre.org" target="_blank">swwilkins@mitre.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hello and thank you for the reply.<br>
<br>
I did try something like this before with no luck => Dial(PJSIP/<a href="mailto:20001@129.4.1.32">20001@129.4.1.32</a>) where 129.4.1.32 is the IP Address of Kamailio.<br>
When I attempt this, I get the error => Endpoint '20001': Could not create dialog to invalid URI '20001'.  Is endpoint registered and reachable?<br>
And 20001 is registered in 129.4.1.32.<br>
<br>
Thank you,<br>
<div class="gmail-HOEnZb"><div class="gmail-h5"><br>
-----Original Message-----<br>
From: sr-users [mailto:<a href="mailto:sr-users-bounces@lists.kamailio.org">sr-users-bounces@<wbr>lists.kamailio.org</a>] On Behalf Of Fred Posner<br>
Sent: Wednesday, December 6, 2017 2:09 PM<br>
To: <a href="mailto:sr-users@lists.kamailio.org">sr-users@lists.kamailio.org</a><br>
Subject: Re: [SR-Users] Forwarding Registration to Asterisk<br>
<br>
You could also just use the Kamailio address in your Dial command...<br>
<br>
Dial(SIP/user@kamailio)<br>
<br>
This will be beneficial if you will be running multiple asterisk servers using a base registered on Kamailio.<br>
<br>
Of course, there's many ways to go about this...<br>
<br></div></div></blockquote><div><br></div><div>As Fred said, there's a lot of ways you can approach this, all of which have trade-offs. You can go pretty deep in depth with any one of these approaches, so I'll just allude to some of your options.</div><div><br></div><div>It's good to keep in mind that there are three ways you can map an inbound request to an endpoint:</div><div><br></div><div>1) By From username. This matches to an AoR, which is associated to an endpoint</div><div>2) By IP address/DNS hostname, using an identify section associated to an endpoint</div><div>3) By header, which also uses an identify section</div><div><br></div><div>When using registration, this will create a Contact that is associated to an AoR. That AoR can be associated to an Endpoint. When dialing, Asterisk will look up the Contacts on the AoR that is associated to an Endpoint and send INVITE requests to all of those Contacts.</div><div><br></div><div>You can, of course, simply set up a static Contact for your Kamailio proxy (represented with an Endpoint/AoR0 and let it handle all of the subsequent routing decisions. But that gets into some various options you have.<br></div><div><br></div><div>Thus, some options:</div><div><br></div><div>1. Proxy REGISTER requests through to Asterisk, allowing Asterisk to (believe) it is the Registrar</div><div><br></div><div>In this particular case, you'll need a PJSIP endpoint for each SIP endpoint that is registering. Identification will need to be done based either on the From user or by a custom header that Kamailio can add and pass off to Asterisk. You will need to use the outbound_proxy options so that outbound requests go through Kamailio as opposed to directly to the registered endpoints. The benefit of this is that it gives Asterisk all of the information it needs, all of the time. The downside is that you now have potentially many services acting as a Registrar, and you have a lot of traffic flying around that you don't need or want.</div><div><br></div><div>2. Create an endpoint in Asterisk that represents your pool of Proxies</div><div><br></div><div>In this case, you would have Kamailio act as the Registrar. If it determines that it needs Asterisk, it would route the INVITE request down to Asterisk. Asterisk would match based on IP address or Header, and would have a single endpoint representing inbound requests from the pool of proxies. You could re-use this same endpoint for outbound requests, or have several different outbound endpoints with different codec capabilities (if needed), typically matching different phone profiles. You would most likely want a static contact set to the DNS name of your proxies, and Dial using SIP URI over that endpoint. The upside of this is that it keeps Asterisk simple and ignorant of all of the phones/registrations; the downside is that BLF handling and call state becomes problematic (as you don't have endpoints to match them to any longer!)</div><div><br></div><div>3. Create endpoints for all of the phones, but have them all have a Contact that is Kamailio</div><div><br></div><div>This combines both #1 and #2, giving you the best (and maybe the worst) of both worlds. You will need an AoR with a static contact that maps to the Kamailio proxies, so that all outbound requests flow through them. Inbound requests can be matched either by From user or by a custom Header, depending on how much flexibility you need. Because you have endpoints for all your phones still, your extension state/device state handling will work better. Handling subscriptions can be done either at Kamailio or at Asterisk, so long as Asterisk is configured to PUBLISH state information to the Kamailio proxies.</div><div><br></div><div><br></div><div>Note that there are many more options. PJSIP in Asterisk is a toolkit, and there isn't a right way to do this - merely ways that balance different system needs. For what it's worth, depending on the inbound traffic, I've used both #2 and #3. I tend to shy away from #1, as I like to keep each service having a specific purpose, and Kamailio acts as a good registrar in a larger system.</div><div><br></div><div>Matt</div></div><div><br></div>-- <br><div class="gmail_signature">Matthew Jordan<br>Digium, Inc. | CTO<br>445 Jan Davis Drive NW - Huntsville, AL 35806 - USA<br>Check us out at: <a href="http://digium.com" target="_blank">http://digium.com</a> & <a href="http://asterisk.org" target="_blank">http://asterisk.org</a></div>
</div></div>