[SR-Users] Identical Kamailio setup on 2 hosts

Daniel Tryba d.tryba at pocos.nl
Mon Sep 26 17:33:01 CEST 2016

On Mon, Sep 26, 2016 at 05:18:32PM +0530, Infinicalls Infinicalls wrote:
>  I am sorry, I am not sure how to implement Brandon's method. Isn't
> there any simpler solution to achieve this? Could someone elaborate me
> more on this or point me to relevant links?
> My problem is simple. I have 2 hosts (host1.mydomain.com and
> host2.mydomain.com located in different places) and user1 and user2
> are registered in both the servers.(local DBs having identical
> records).
> Now, I want user1 at host1.mydomain.com to talk to
> user2 at host2.mydomain.com without issues.

The problem you have is that a lookup() will succeed on host1 when a UAC
is registered to host2 (but stateful firewalls/NAT prohibit traffic from
ipadresses other than host2).

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) 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).

More information about the sr-users mailing list