[SR-Users] Kamailio as loadbalancer + NAT pinning

Daniel Tryba d.tryba at pocos.nl
Tue Jan 3 15:59:20 CET 2017


On Tue, Jan 03, 2017 at 04:07:20PM +0200, Vladyslav Zakhozhai wrote:
> Daniel, thank you for your answer.
> 
> You did not understand me completely. This is my fault.
> 
> Let me put it this way. I want kamailio to handle NAT (fixing nat only from
> client's side) not being registrar itself. This also includes nat pinning.
> usrloc module is a dependency for nat pinning in nathelper module.
> 
> Request: UAC behind NAT ===> kamailio == fixed contact ==> freeswitch
> Respnse: freeswitch == 200 OK ==> kamailio (store contact in usrloc, start
> pinning) == 200 OK ==> UAC behind NAT
> 
> Kamailio starts pinning UACs behind NAT only after successful
> authentication and registration on freeswitch box.
> 
> No nat fixes between kamailio and freeswitch (only from UAC).


You keep telling kamailio isn't the registrar, but you are implementing
a registrar :) (but instead of authenticating locally you leave that to
an other backend)

To my understanding (without testing), saving the REGISTERs to the
kamailio locationdb isn't necessary. You need usrloc to mangle Contact
headers, nothing more. So what is the purpose for storing the REGISTERs
in kamailio? Unless you mean NAT pinging instead of NAT pinning (which I 
interpreted to somehow fixing a all traffic to the source of the
REGISTERs (which is what normally is done)).

Looks like you are trying to implement something like Path
https://tools.ietf.org/html/rfc3327

I'd take a look at Path support in Freeswitch and Kamailio. Use
add_contact_alias to add the source ip/port to the Contact, then add a
Path header to REGISTERs befoire sending it to Freeswitch. And let
Freeswitch do the keepalive pinging based on it's own location database
(you need to add some routing logic to forward (presumably) OPTIONS from
Freeswitch to the alias portion of the RURI and back again).
This way you are essentially creating a very lightweight stateless
kamailio proxy.



More information about the sr-users mailing list