On Wed, Apr 2, 2008 at 10:07 AM, Michael CHRISTOPHER <pjsip at encambio.com> wrote: > >I don't think that's the reason why pjsip thinks that the registration > >had failed. Probably what happened is the server returned modified > >Contact header than what pjsua had put in the request, and pjsip > >thinks that the registration had failed because it couldn't find its > >Contact header there. Maybe there is a configuration in OpenSER that > >you use that modifies the Contact header (it's probably got something > >to do with NAT, but couldn't remember the exact configuration name for > >it). > > > I assume all registrars with NAT correction logic will return a > 'Contact' header differing from that of a NATted UAs 'REGISTER' > request. Is it intentional that the pjsip component rejects this? Yes, since it's in my understanding that registrar should never ever modify the Contact header according to RFC 3261, regardless on how it thinks it may help with NAT. Unfortunately many registrars out there violate this, either misconfigured (with (Open)SER case) or just plain broken. > By the way, pjsip thinks the registration fails in regc_cb() of: > > pjsip/src/pjsua-lib/pjsua_acc.c:863: > if (param->expiration < 1) { *** <-- HERE! *** > pjsip_regc_destroy(acc->regc); > acc->regc = NULL; This is just the effect seen by application. The main work itself is done in pjsip/src/pjsip/sip_reg.c (see line 739 which looks for the matching Contact header). > I was unable to understand how regc_cb() is called or why the > expiration value from the 'Contact' header (600 in my case) is > not used. It's hard to believe that even on successful registrations > pjsua rejects the returned 'Contact' header completely. If that's > indeed the case, and unless there's a good reason not to, I might > patch that rejection logic to correctly set the expiration value. It's for the reasons above. I would say it'll be better to fix your server config though (e.g. use fix_nated_register() rather than fix_nated_contact()). > Sadly, I can't find the place where such 'Contact' header parsing > occurs. I looked at [1] trying to trace this logic, but it seems > that callbacks are not documented (?) or maybe the docs are not in > sync with the SVN tree (?). Am I going about this porting wrongly? > PJSUA-LIB is the high level API, and low level parsing is done in the PJSIP library level. Cheers Benny > Regards, > Michael > > [1] http://www.pjsip.org/pjsip/docs/html/group__PJSUA__LIB__ACC.htm >