[SR-Users] Forwarding Registration to Asterisk

Matthew Jordan mjordan at digium.com
Wed Dec 6 23:10:21 CET 2017


On Wed, Dec 6, 2017 at 2:16 PM, Wilkins, Steve <swwilkins at mitre.org> wrote:

> Hello and thank you for the reply.
>
> I did try something like this before with no luck => Dial(PJSIP/
> 20001 at 129.4.1.32) where 129.4.1.32 is the IP Address of Kamailio.
> When I attempt this, I get the error => Endpoint '20001': Could not create
> dialog to invalid URI '20001'.  Is endpoint registered and reachable?
> And 20001 is registered in 129.4.1.32.
>
> Thank you,
>
> -----Original Message-----
> From: sr-users [mailto:sr-users-bounces at lists.kamailio.org] On Behalf Of
> Fred Posner
> Sent: Wednesday, December 6, 2017 2:09 PM
> To: sr-users at lists.kamailio.org
> Subject: Re: [SR-Users] Forwarding Registration to Asterisk
>
> You could also just use the Kamailio address in your Dial command...
>
> Dial(SIP/user at kamailio)
>
> This will be beneficial if you will be running multiple asterisk servers
> using a base registered on Kamailio.
>
> Of course, there's many ways to go about this...
>
>
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.

It's good to keep in mind that there are three ways you can map an inbound
request to an endpoint:

1) By From username. This matches to an AoR, which is associated to an
endpoint
2) By IP address/DNS hostname, using an identify section associated to an
endpoint
3) By header, which also uses an identify section

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.

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.

Thus, some options:

1. Proxy REGISTER requests through to Asterisk, allowing Asterisk to
(believe) it is the Registrar

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.

2. Create an endpoint in Asterisk that represents your pool of Proxies

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!)

3. Create endpoints for all of the phones, but have them all have a Contact
that is Kamailio

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.


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.

Matt

-- 
Matthew Jordan
Digium, Inc. | CTO
445 Jan Davis Drive NW - Huntsville, AL 35806 - USA
Check us out at: http://digium.com & http://asterisk.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-users/attachments/20171206/03efd3ab/attachment.html>


More information about the sr-users mailing list