Hello Jan,
On 09/30/08 12:59, Jan Janak wrote:
Hello,
On 29-09 16:31, Daniel-Constantin Mierla wrote:
Hello,
I just added to svn a new function for registrar module:
uunregister(domain, uri), see commit:
http://openser.svn.sourceforge.net/viewvc/openser?view=rev&revision=5010
The patch is small and clean. Backport to 1.4.1 should be straightforward.
This function should help you to achieve the desired behavior: if
register has expires > 0 then call first
unregister("location", "$tu");
then
save("location");
The unregister() function removes all contact associated with the
address in parameter 'uri'.
I am looking also to actually enhance save() function to get a
functionality like:
- update the expires if there is a record with same contact
- otherwise remove all existing contact and add a new one
I wonder if this is safe to use. Given that you cannot notify the
already-registered user agent that its contact is being removed, it
will appear as if it is still registered and able to receive
calls. And after next re-registration attempt, it will again steal the
registration from the most recently registered phone, so neither of the
two phones will be reachable all the time.
If you want to handle this in a graceful manner and have only one
phone registered then you should probably reject registration attempts
from other phones as long as the first one is registered, instead of
discarding the old contact silently.
And for the scenario mentined earlier (calls being sent to a home
phone if it is registered), you could configure the home phone with a
higher q value and do serial forking based on the q value.
The scenario was presented before, where each phone will steal the
registration periodically. You are right, that cannot be prevented. One
usage case I found in the past for this case was to deal with some
broken NAT/STUN devices, when you are sure there is a single phone, but
each registration gets with a new port for each register refresh.
The goal is to get a single contact in location, as fair as possible. I
am in the process to develop access to contact record attributes (we had
a discussion in the past with subject "RFC: branches/location records
control"), so you can check the q value (or other attributes) and decide
from script to reject or save as only contact.
Another usage case for this function is to keep in user profile (managed
by some web/gui) a mapping between source IP and time frame:
work_ip -- allow register 9:00 to 18:00
home_ip -- allow for the rest of the time
Cheers,
Daniel
--
Daniel-Constantin Mierla
http://www.asipto.com