[SR-Users] how to use 2 kamailios sharing one database to make call?

Alex Balashov abalashov at evaristesys.com
Fri Sep 6 09:14:33 CEST 2013


Hello,

On 09/06/2013 02:52 AM, yuanshui lee wrote:

> Hello,
>      I have two sip clients. Client1 registers to kamailio1, Client2
> registers to kamailio2. Kamailio1 and kamalio2 sharing one database. I
> want to make call between client1 and client2. What should I do?
>
> Another question is that I want to achieve load balancing with kamailios.
> The architecture is described as: I run one kamailio instance as load
> balancer, other to help make calls, and the load balancer dispatchs
> requests to other kamailios.
>
> So, how should I do that? Has anyone ever achieved this? Give me a hand,
> thanks very much.

If you're having the client register to two different Kamailio servers, 
you can use the differing 'domains' for them to route the call.

If you're having different clients registrar on different registrars, 
the 'socket' parameter in the 'location' table indicates which registrar 
the request came into.

For instance, if kamailio1 is xxx.xxx.xxx.xxx and kamailio2 is 
yyy.yyy.yyy.yyy, the 'socket' column for the respective bindings in the 
'location' table will contain either

    udp:xxx.xxx.xxx.xxx:5060

or

    udp:yyy.yyy.yyy.yyy:5060

So, if you do a registrar lookup on kamailio1 and find the 'socket' to 
be the other server, you can just route the call over to it laterally.

The 'socket' data doesn't get loaded into anywhere accessible by default 
when you do a lookup().  To get it, you must call reg_fetch_contacts():

    http://kamailio.org/docs/modules/4.0.x/modules/registrar.html#idp1933672

Then, the 'socket' will be accessible via $ulc(profile=>socket).  See 
this for more information:

    http://kamailio.org/docs/modules/4.0.x/modules/registrar.html#idp1950400

-- Alex

-- 
Alex Balashov - Principal
Evariste Systems LLC
235 E Ponce de Leon Ave
Suite 106
Decatur, GA 30030
United States
Tel: +1-678-954-0670
Web: http://www.evaristesys.com/, http://www.alexbalashov.com/



More information about the sr-users mailing list