On Wednesday 31 October 2007, Christian Schlatter wrote:
Robert Dyck wrote:
I am wondering how to expose and test the value
of the expires parameter
in a REGISTER request.
I am experimenting with openser as the basis for a home phone network. I
use multiple devices with the same user ID. They register locally ( with
no reply ) and with an external service provider. The contacts are
mangled to show the public address of openser. Multiple registrations
result in a single AOR at the external registrar. Incoming calls from the
outside are forked and ring the local phones. Local phones can also call
each other without the hairpin problem associated with STUN enabled
phones.
The problem is that a softphone will deregister when it is closed or its
profile changes. This would deregister the AOR at the external registrar.
The remaining phones could not receive calls from the outside until they
refreshed their registrations.
I would like to prevent deregistration at the external registrar unless
the phone that was deregistering was the only remaining one. The first
step would be to identify REGISTER messages where the expires value is
equal to zero.
Both 'Expires' header and 'expires' contact uri parameter have to be
checked like e.g.
if ((is_present_hf("Expires") && $(hdr(Expires){s.int}) == 0) ||
($(ct{param.value,expires}) == '0'))
{
# someone tries to unregister
}
Have a look at
http://www.openser.org/dokuwiki/doku.php/transformations:1.2.x if you're
not familiar with the PV transformations introduced with 1.2.
I am indeed unfamiliar with PV transformations. I will have a look it. I was
afraid I might have to do something ugly with regular expressions. I probably
should not put off upgrading any longer.
Thanks, Rob