[OpenSIPS-Users] lookup "b" flag - one registration at a time
jpyle at fidelityvoice.com
Sun Jan 10 04:42:18 CET 2010
On Jan 9, 2010, at 5:00 PM, Iñaki Baz Castillo wrote:
> El Sábado, 9 de Enero de 2010, Jeff Pyle escribió:
>> The docs say that when using the "b" flag with lookup() when multiple
>> records are present, it will load only the one with the highest q. What
>> if the q is the same for all? How does it decide which to use?
> I've not tested it with multiple users sharing same "q". however it should
> fetch all the users with highest "q", not just one of them.
Perhaps I'm asking the wrong question. I'm looking to allow only one registration per user in the sense that if a second successful registration comes in it will replace tne existing one. My approach so far is to use a max_contacts=2 and the lookup() function with the "b" flag to retrieve only one. max_contacts=1 returns a 503 to the new "replacement" registration request, so that's out.
Perhaps the hot ticket is to run an all-DB mode running a manual mysql query with avp_db_query after successful REGISTER authentication but before the save() so we can remove any existing registrations before the new one is saved. Thoughts?
More information about the Users