Problem for Pjsip to read "Expires" value from some 200/OK REGISTER Replies

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I think I realized that the problem is not so simple.

The Fact is that I am using stun, so the Register message contains the
Public IP address :

>>
REGISTER sip:ippi.fr SIP/2.0
Via: SIP/2.0/UDP 193.253.*.*:58540;rport;branch=z9hG4b..
Max-Forwards: 70
From: "login" <sip:login@xxxxxxx <sip%3Alogin at ippi.fr>>;tag=a15177..
To: "login" <sip:login at ippi.fr <sip%3Alogin at ippi.fr>>
Call-ID: 7ec0346..
CSeq: 47136 REGISTER
User-Agent: PJSUA v0.8.0-trunk/win32
Contact: "login" <sip:login at 193.253.*.*:58540>
Expires: 3600
Authorization: Digest username="login", realm="ippi.fr", nonce="480749..",
uri="sip:ippi.fr", response="01e3c02.."
Content-Length:  0
<<


I guess the Registrar is not OK with the IP:Port I sent, because the Reply
is the following one :
(I don't even know how the Registrar as discovered my private IP
10.20.30.169, since I was using STUN in the REGISTER message)

>>
SIP/2.0 200 OK
Via: SIP/2.0/UDP 10.20.30.169:58540;rport=58540;branch=z9hG4b..
From: "login" <sip:login@xxxxxxx <sip%3Alogin at ippi.fr>>;tag=a15177..
To: "login" <sip:login at ippi.fr <sip%3Alogin at ippi.fr>>;tag=7de74f..
Call-ID: 7ec034..
CSeq: 47136 REGISTER
Contact: <sip:login at 10.20.30.169:58540>;expires=3600
Server: OpenSER (1.2.1-notls (i386/linux))
Content-Length: 0
<<

This message has two problems :

- there is no "Expires:" information
- the Contact field doesn't match anymore (that's why I need to disable the
PJSIP_REGISTER_CLIENT_CHECK_CONTACT option, if I want this to work),
so the ";expires=3600" won't be taken into account.

-> Finally, the Reply will be considered as a wrong succefull "UnRegister"

I don't know if I have to consider that the problem is server side, or if
it's Pjsip with is not able to deal with this situation.
I have the same problem with several providers.

Any idea about this ?

Bye !

Electrocut


On Thu, Apr 17, 2008 at 10:26 AM, Tanguy Floc'h <electrocut at gmail.com>
wrote:

> Hi !
>
> I think there is a problem, when pjsip tries to get the Expire value, from
> the 200 OK
>
> Reply coming from a REGISTER Request.
>
> The problem is for SIP messages like these, when "Expires" value had not
> its own header field :
>
> SIP/2.0 200 OK
> Via: SIP/2.0/UDP 172.17.20.226:1265;rport;branch=z9hG4b...
> To: <sip:101 at 172.17.20.226 <sip%3A101 at 172.17.20.226>>
> From: <sip:101@172.17.20.226 <sip%3A101 at 172.17.20.226>>;tag=c8b125...
> Call-ID: 99ed82...
> CSeq: 22778 REGISTER
> User-Agent: NCH Swift Sound Axon 1.30
> Contact: <sip:101 at 172.17.20.226:1265>;expires=300;
> Content-Length: 0
>
> As you can see, expires value has not its own header field (like "Expires:
> 300"), but is put at the end of the "Contact" header field (.. ;
> expires=300;)
>
> That's what happen in this case :
>
> When receiving the 200 OK Reply, from the REGISTER Request, the function
> tsx_callback() in sig_reg.c tries to find the "Expires= ?" header field :
>
> (line 718)
> expires = (pjsip_expires_hdr*)pjsip_msg_find_hdr(msg, PJSIP_H_EXPIRES,
> NULL);
>
> but can't find this field in the SIP message.
>
> If PJSIP_REGISTER_CLIENT_CHECK_CONTACT Param is set to 1, it is not a
> problem if expire field can not be found in SIP 200/Ok Reply, because the
> previous (and lower) value
>
> (from the REGISTER Request) will be taken into account instead :
>
> (line 760)
> if (contact[i]->expires >= 0 && contact[i]->expires < expiration)
>     expiration = contact[i]->expires;
>
> But if PJSIP_REGISTER_CLIENT_CHECK_CONTACT Param is set to 0 (that's my
> case), expiration value is set to -1, just before the callback is called,
> line 810 in sig_reg.c
>
> Consequently, when the callback function regc_cb in pjsua_acc.c test the
> expiration value, it believes that it is a "succefful UNregistration",
> instead of Registration (because expiration < 1)
>
> A way to fix the problem could be :
> - To read expires value in "pjsip_contact_hdr->expires", if
> "pjsip_contact_hdr->ivalue" doesn't exist
> or
> - to compare the Expiration value, even if
> PJSIP_REGISTER_CLIENT_CHECK_CONTACT is disable, so the previous value will
> be taken into account instead.
>
> Thanks !
>
> Electrocut
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/attachments/20080417/26c0fa92/attachment-0001.html 


[Index of Archives]     [Asterisk Users]     [Asterisk App Development]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [Linux API]
  Powered by Linux