[asterisk-users] any valid up-to-date info about Kamailio-Asterisk integration ?

Matthew Jordan mjordan at digium.com
Thu Jan 29 09:52:22 CST 2015

On Thu, Jan 29, 2015 at 2:43 AM, Kirill Marchuk <62mkv at mail.ru> wrote:
> Hi all
>  Have recently watched Matt Jordan's session on Kamailio World 2014
> On slides 26-29 of his presentation
> (http://www.kamailio.org/events/2014-KamailioWorld/day1/09-Matt.Jordan-Asterisk12-And-PJSIP.pdf)
> he speaks about a (completely new, for me at least) approach to build
> scalable telephony systems, using N instances of Kamailio and N instances of
> Asterisk
> Are there any whitepapers, howtos, "implementation experience reports",
> whatever, available, that would describe such an approach in details and
> help some not-so-advanced admins to at least understand "if is it what they
> need, or not exactly, or not at all" ?
> We are planning to look closer at Kamailio (or any other proxy, like
> OpenSip) as a way to do both load-balancing and failover solutions, so that
> refusal of any Asterisk instance should have minimal possible effect on the
> overall system availability.

The best documentation out there - that I'm personally aware of - is
Daniel's guide on integrating Kamailio and Asterisk:


While there have been quite a few improvements made in Asterisk (and I
imagine, Kamailio as well) since that was written, that guide would be
a good starting point, regardless of the versions involved.

> A lot of questions howevere arise, like: what if one SIP user got REGISTERed
> at Server 1, and the other on Server 3, so how can they call one another ?

There are many different ways of handling this.

First, you have to ask yourself what you want Asterisk and Kamailio to
do in your set up. Some sample questions:
* Who acts as the registrar?
* Who manages subscriptions?
* Should each Asterisk server have a special purpose, or should they
be treated as a generic pool of media servers?
* Should Asterisk be involved in 'normal' calls (two-party, no media
manipulation), or should it only be used when special services are

Your goal, in any scenario, should be to keep the Asterisk dialplan as
simple as possible. That typically means not placing customer specific
logic in the dialplan, but instead relying on func_odbc to pull
customer specific information from a database. In later versions (such
as Asterisk 13), you can remove much of the logic from the dialplan
and use ARI to build custom media applications.

But no, not a lot of this is written down yet.

> Also, outbound registrations can be done from one instance at a time, say
> it's done from Server1 for Trunk1, so how can users, that got authenticated
> at Server2, call thru that registration (Trunk1) ?

If your Asterisk servers are sitting behind Kamailio, they should
probably just be registering to their Kamailio instances. Again, if
Kamailio is handling the registration, identification, and
authentication, then you probably don't want Asterisk doing any of
that. You would instead just have Asterisk "trust" that Kamailio is
sending it the right calls, and have it handle them accordingly.

> Also, Kamailio itself has to be protected from failing, and probably even
> from overload...

That's pretty standard stuff for Kamailio.

> Would be great to read something in-depth about that

Matthew Jordan
Digium, Inc. | Engineering Manager
445 Jan Davis Drive NW - Huntsville, AL 35806 - USA
Check us out at: http://digium.com & http://asterisk.org

More information about the asterisk-users mailing list