[pjsip] Parsing expires from REGISTER reply

Benny Prijono bennylp at pjsip.org
Wed May 7 11:48:11 EDT 2008


Gents,

sorry for not responding sooner. So bottom line is, if server doesn't
follow the protocol, then there's no exact way to make registration
right. I wonder again if it's really hopeless to ask them to fix it (I
kind of know the answer though :) ).

Alan, as you said your patch looks a bit rough (I tend to see it as
both funny and desperate at the same time). Can we not do like this,
which is simpler (this would only happen if the strict checking is
disabled):

 if we're registering:
     if the answer is 200/OK:
         if matched Contact is found:
             get expiration from Contact
         else if there is at least one Contact
             get the lowest expires from all Contacts
         else if Expires is found:
             get expiration from Expires header
         else
             get expiration from the request
     else if the answer is 3xx-6xx:
         the registration has failed


if we're unregistering:
     if the answer is 200/OK:
         the unregistration has been successful
     else
         it doesn't matter, we're unregistering no matter

What do you think?

Cheers
 Benny


On Mon, May 5, 2008 at 9:28 PM, Tanguy Floc'h <electrocut at gmail.com> wrote:
> You are right Alan, I didn't see the included file (in fact, you last post
> on the mailing list haven't reached my mailbox, I don't know why).
>
> I'll look at your sip_reg.c remplacement more closely.
>
> Thanks
>
>
>
> On Mon, May 5, 2008 at 6:05 PM, Tanguy Floc'h <electrocut at gmail.com> wrote:
> > Sorry for the bad ascii table :(
> >
> > the same in an image :
> http://www.monsterup.com/image.php?url=upload/1210003361.jpg
> >
> >
> >
> >
> >
> > On Mon, May 5, 2008 at 6:00 PM, Tanguy Floc'h <electrocut at gmail.com>
> wrote:
> >
> > > I agree with you Alan, I had the same problem a few minutes ago :
> > > with "pjsip_cfg()->regc.check_contact" disabled, it will fail anyway
> with a "unregister success", if more than once user have registered to the
> account. (if we assume 'Contact: header' is missing)
> > >
> > > Another problem with the fix you proposed :
> > >
> > >
> > > if (expiration == NOEXP)
> > >   expiration = -1;
> > > else if (expiration == 0 && contact_cnt > 0 && contact[0]->expires > 0)
> > >   expiration = contact[0]->expires;
> > >
> > >
> > > is that you don't know if 'contact[0]->expires' is your expire value ...
> or if it is 'contact[1]->expires'
> > >
> > >
> > > If 'contact[0]->expires' is taken as the "good expire value", only if
> the "Contact header recognation" (like when "check_contact" is enabled) has
> failed ... if could solve a part of the problem, but not all.
> > >
> > > If my assumption is right (I haven't tested it) finally, it should be :
> > >
> > >
> -------------------+-----------------------+-------------------------------------------+
> > >                   |       only       |        only           |
> |
> > >                   | No Expire header |   bad Contact Info    |    No
> Expire header + Wrong Contact Info  |
> > >
> ------------------|------------------+-----------------------+-------------------------------------------|
> > >  1st fix          |                  |                       |
> |
> > > (contact_cnt = 0) | ok if register<2 |         ok            |
> ok if register<2                |
> > >                   |                  |                       |
> |
> > >
> ------------------+------------------+-----------------------+-------------------------------------------+
> > >  2nd fix          |       ok         |                       |
> ok                       |
> > > (contact_cnt > 0) | but multi-unreg  |         ok            |
> but multi-unreg problem          |
> > >                   |     problem      |                       |
> |
> > >
> ------------------+------------------+-----------------------+-------------------------------------------+
> > >  2nd fix +        |                  |                       |
> |
> > >  + the idea above |                  |                       |
> ok                      |
> > > (test contact     |        ok        |         ok            |
> but multi-unreg problem          |                     |
> > > header recogn. 1st|                  |                       |
> |
> > >
> ------------------+------------------+-----------------------+-------------------------------------------+
> > >
> > >
> > > I hope we will managed to find the best solution for this issue :)
> > >
> > > Regards,
> > >
> > > Electrocut
> > >
> > >
> > >
> > >
> > >
> > > On Sun, May 4, 2008 at 2:06 PM, Benny Prijono <bennylp at pjsip.org> wrote:
> > >
> > > > Hi Alan,
> > > >
> > > > First of all, I think this issue has come up several times on this
> > > > list, so I've just added this entry in the FAQ to explain the
> > > > rationale why PJSIP behaves this way, and also few solutions to cope
> > > > with it: http://trac.pjsip.org/repos/wiki/FAQ#regc
> > > >
> > > > I do like your solution. And while this is server problem (regardless
> > > > of how popular it is; if it's broken, then it needs to be fixed, IMO),
> > > > in the SVN trunk we already have couple of settings to deal with this,
> > > > so if we want to handle this, why not go all the way. So I've just
> > > > added the trick (to get the expiration value from the single Contact,
> > > > if Expires header is not present) in the latest SVN version. Thanks
> > > > for the suggestion.
> > > >
> > > > Now enjoy the bank holiday. :)
> > > >
> > > > Cheers
> > > >  Benny




More information about the pjsip mailing list