[SR-Users] howto synchronize ruid across multiple proxy instances

Daniel-Constantin Mierla miconda at gmail.com
Mon Sep 15 12:04:46 CEST 2014


On 12/09/14 15:42, Andrew Pogrebennyk wrote:
> Hi,
> let's say I'm running two proxies/registrars that need to access Shared
> location DB in db_mode=1 (all changes to usrloc are immediately
> reflected in database too). I have observed that if the UAC re-registers
> before the previous registration's expiry and the new REGISTER reaches
> the other proxy than the one that processed the registration originally,
> this new proxy is going to insert the second record for the same
> username into location table instead of updating the existing registration.
> I assume the problem is the ruid calculation,
if the proxy doesn't have the record in memory, it will not matter if it 
is with same ruid or not, it will create a new record. If it is the same 
ruid, it will be a failure when inserting in database, not updating it 
there, leaving the old record in place.

Also, even if this one will overwrite in database, the other proxy will 
still have in memory and will route calls to it.

Alex mentioned in a separate email the db only mode - that could be a 

Also, you can try deleting the record from db via sqlops based on 
username, domain, contact uri if the registered() returns false for that 
user, before doing save().

If looking at writing C code to get it done, maybe it can be achieved 
with a new function to load_db_contacts("userid") to be called before 

Back on ruid, just for sake of clarifications, by the way ruid is 
generated, is unlikely to get it the same across many systems, because 
it uses pid and local counters.


>   because proxy2 generated a
> different ruid than proxy1 since internal state of the two nodes is not
> shared. I have two questions: 1) is that assumption correct? 2) is there
> any way to synchronize the "ruid" of the two nodes in usrloc module,
> similar to the "secret" parameter in the auth module, or a better
> solution? I prefer the load-balancer to select random proxy and not do a
> hash based on From URI.
> I don't have the trace of the two registrations at the moment, but could
> get one next week. The issue popped up when running some sipp tests, but
> it's also possible that some cheap SIP endpoint would register well
> before the expiration time, creating duplicate registration. So if
> someone dials its number it's going to receive multiple incoming calls.
> Here are the module parameters I am using, all quite ordinary:
> modparam("usrloc", "use_domain", USE_DOMAIN)
> modparam("usrloc", "db_mode", 1)
> modparam("usrloc", "db_url", CENTRAL_URL)
> modparam("usrloc", "db_check_update", 0)
> modparam("usrloc", "nat_bflag", FLB_NATB)
> modparam("registrar", "default_expires", 3600)
> modparam("registrar", "min_expires", 60)
> modparam("registrar", "max_expires", 43200)
> modparam("registrar", "method_filtering", 0)
> modparam("registrar", "append_branches", 1)
> modparam("registrar", "max_contacts", 5)
> modparam("registrar", "received_avp", "$avp(s:received)")
> modparam("registrar", "use_path", 1)
> modparam("registrar", "path_mode", 0)
> modparam("registrar", "path_use_received", 1)
> modparam("registrar", "gruu_enabled", 0)
> Any ideas?
> Thanks in advance.
> Andrew
> _______________________________________________
> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
> sr-users at lists.sip-router.org
> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users

Daniel-Constantin Mierla
http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
Next Kamailio Advanced Trainings 2014 - http://www.asipto.com
Sep 22-25, Berlin, Germany

More information about the sr-users mailing list