[SR-Users] Kazoo like load balancing

Daniel Tryba d.tryba at pocos.nl
Tue Jul 21 11:25:12 CEST 2015


On Tuesday 21 July 2015 11:13:15 Jurijs Ivolga wrote:
> My set-up is working as it is with default settings, when 2 servers share
> same DB in case if our subscribers do not use NAT.
> 
> If subscribers are behind NAT, then in this case such set-up will not work,
> as described here:
> 
> http://kb.smartvox.co.uk/opensips/clustering-opensips-part-2/
> 
> Please check diagram under "Far-end NAT traversal on multi-homed or
> clustered servers".

Adding the Path header on save() should solve this problem. The top most path 
is either the register server itself or the other one. If it is the otherone 
the INVITE should be send there. But like I said in
http://lists.sip-router.org/pipermail/sr-users/2015-April/087872.html
I hate NAT :(

I didn't look further into my routing problems but solved it with 
loadbalancers.
 
> I believe in my case solution will be only when I will have one more
> Kamailio in front of my servers and it will dispatch all request to 2
> servers, in this case I will eliminate this NAT issue.

This solved my problem. Path points to loadbalancer and received in path to 
the external received address/port. 

UA1 registered to register1 via loadbalancer1
UA2 registered to register2 via loadbalancer2

if UA1 calls UA2, the call will go:
UA1->LB1->random register->LB2 (based on path)->UA2 (based on path)

These loadbalancers are very simple and essentially stateless.

modparam("path", "use_received", 1)

...

request_route {
        route(NATDETECT);
        route(WITHINDLG);

        if (is_method("INVITE|SUBSCRIBE"))
        {
                record_route();
        }

        if(!is_in_subnet($si, "myvoicesubnet"))
        {
                add_path_received("vialoadalancers");
                $rd="mydomain";

                ds_select_dst(1, 0);
                t_on_failure("RTF_DISPATCH");
        }
        else
        {
                add_path("fromregistrars");

                remove_hf("Route");

                loose_route();
        }
        
        route(RELAY);
}


-- 

Telefoon: 088 0100 700
Sales: sales at pocos.nl | Service: servicedesk at pocos.nl
http://www.pocos.nl/ | Croy 9c, 5653 LC Eindhoven | Kamer van Koophandel 
17097024




More information about the sr-users mailing list