[SR-Users] Identical Kamailio setup on 2 hosts

Daniel Tryba d.tryba at pocos.nl
Thu Sep 29 11:33:33 CEST 2016

On Thu, Sep 29, 2016 at 01:53:14PM +0530, Infinicalls Infinicalls wrote:
> > You can either figure out which host was used to register by looking at
> > the socket value in the location table (using sqlops/avp_db_query) and
> > send the INVITE to the other host if socket doesn't contain a local
> > ipadress (by simply setting $rd to the other host and setting $du to
> > null)
> The socket value I get here is the internal IP only. For eg.
> Can you tell me how do I get the static IP here? I am
> behind NAT and use rtpproxy and advertised it.

In that case there is no direct way to get the external ip as far as I
know. As far as location is concerned that information is lost. You
might want to look into the Path module to store information about the
REGISTER (you might have to fake a Path header before save from
available info during the REGISTER).

> >or just wait for a failure route (which adds a delay) to trigger
> > and send the invite to the other host (again setting $du to null and $rd
> > to the other host).
> # uncomment the following lines if you want to redirect the failed
> # calls to a different new destination
> ##  if (t_check_status("486|408")) {
> ##      sethostport("MySecondIP:5061");
> ##      append_branch();
> ##      # do not set the missed call flag again
> ##      t_relay();
> ##}
> Is this sufficient? In my case, if calls are only sent to the second
> IP, how do I add a mesh of servers (I have 5 of them now). Will that
> add more delay time? Any idea? Thanks.

It is the correct idea, but it might be a little bit fragile. There
might be no response (in which case you get a local generated 408), but
if a device is listening it might decide to send any 4/5/6xx code.

You might want to take a look at you solution though. 
For example you might want to introduce edge proxies, clients connect
with those directly, but they forward the requests to a (specific or
loadbalanced) registrar (essentially the machines you have up and
running now). These proxies insert Path information about themselves in
any messages coming from the outside world (add_path_received()) , the
registrar saves the Path info:
modparam("registrar", "use_path", 1)
modparam("registrar", "path_use_received", 1)

Now any registrar looking at the shared location data knows which edge
proxy to sent the request for the enduser to directly.

More information about the sr-users mailing list