On 20 March 2013 03:05, David Thomson <jdavidthomson@hotmail.com> wrote:
hi,

I have two kamailio 3.3.4 servers sharing one database.  usrloc module is loaded on both machines.  The DNS name for the machines is shared (i.e siptest.testdomain.com with 2 public ip's - one for Server1 and one for Server2) and setup in round robin mode.

The scenario is as follows:
User 1 registers to Server1
User 2 registers to Server2

User1 tries to call User2 but Server1 throws an error and the call doesn't ever connect to User2:

 WARNING: usrloc [udomain.c:321]: non-local socket <udp:xxx.xxx.xxx.xxx:5060>...ignoring.  



Hi

I think you can use the t_replicate function within your register route so that each server will replicate the registration request to the other. 

I did this many years ago on OpenSER using the following just before the consume_credentials() line. 

On each of the servers you want to check that the src_ip is not that of the OTHER sever so they don't keep sending back and forth forever :-) So in the example below 10.0.1.1 is the IP of the other server.

--------8<-----------------------------------------
       if (!src_ip==10.0.1.1) {
               t_replicate("udp:10.0.1.1:5060");
               xlog("L_INFO", "Replicating $ct, URI = $ru");
       };

       consume_credentials();
--------8<-----------------------------------------

Have a look at http://www.kamailio.org/docs/modules/3.3.x/modules/tm.html#t_replicate

Hope this helps.

-Barry