Here's a patch we've been using since ~1.3.X and ported until 1.6.X. It seems stable, although some of the functionality was ported by copy-pasting and might need a review (I did not know much about opensips when I wrote it!)
Basically it allows setting db_atomic=1 if you're already using realtime database and will eliminate a race condition when doing re-registration. During normal operation, it's possible that opensips does:
SELECT .... FROM location (checking existing ones)
DELETE FROM location WHERE (timer cleaning up the existing registration)
UPDATE location SET ... (trying to update registration that doesn't exist anymore)
We've had problems with people getting randomly deregistered and after patching we didn't get any more complaints. Using db_atomic=1 requires a database schema change. Depending on whether you use domains or not, you need:
UNIQUE KEY `registration_idx` (`username`,`contact`)
UNIQUE KEY `registration_idx` (`username`,`domain`,`contact`)
in the location table.
This is a patch against 1.6.1.
Log in to post a comment.