When using save in registrar module with f and cXX flags set, the number of contacts can exceed the XX value.
Consider the following scenario: 3 devices registering with the same SIP account and XX above is set to 2, with f flag set. In this case we should be seeing two contacts saved, and the third should randomly overwrite one of the two contacts because of the force flag. What I see instead is that when the third device registers, one of the contacts is correctly overwritten, however when the device whos contact was overwritten, reregisters, it's contact is incorrectly added to the list of contacts, thus exceeding the limit of maximum allowed contacts. The cXX flag in my case is specified as a parameter to the save command in script.
Tested with opensips 1.8.2 svn rev 9438.
Hi Kiss,
I managed to reproduce the scenario - I'm working on a fix.
Thanks and regards,
Bogdan
Hi Kiss,
Attached is a patch that should solve the problem - at least it solved it in my tests :).
Please apply it and give it a try - ignore the really verbose debug messages :D.
Thanks and regards,
Bogdan
With this patch, the original problem is solved, however still not working as expected.
The problem is, that when max allowed regs is 2 and there are two contacts registered, at the first refresh by one of the contacts, the other contact is deleted. I would expect it not to delete any contacts, when I allow 2 and have 2.
Kiss, indeed, the update logic was not fully correct - I tried a simpler approach (which should work) - the version 2 patch is here, against SVN (so remove any prev patch).
Please have it tested and let me know what's the result :)
Thanks and regards,
Bogdan
Kiss,
Following our chat on IRC, see the new patch (Final fix with change in limit) that hopefully solve all the issues.
Regards,
Bogdan
Final fix