[asterisk-dev] Asterisks CSeq parsing not RFC 3261 compliant
Raj Jain
rj2807 at gmail.com
Wed Jun 11 08:23:07 CDT 2008
Thanks for pointing that out Olle. I'm curious if anybody has run RFC
4475 (SIP torture tests) against chan_sip. I guess, the resolution of
this issue would be to call ast_skip_blanks() as opposed to strchr()
in handle_response() where CSeq: is being parsed.
By the way, I love the comment in __get_header() (quoted below).
Actually, there is quite a bit truth in this comment. There is a
realization now that things like SHOULD keywords in the normative text
in RFCs are really harmful and should be avoided at all costs.
/*
* Technically you can place arbitrary whitespace both before
and after the ':' in
* a header, although RFC3261 clearly says you shouldn't
before, and place just
* one afterwards. If you shouldn't do it, what absolute
idiot decided it was
* a good idea to say you can do it, and if you can do it, why
in the hell would.
* you say you shouldn't.
* Anyways, pedanticsipchecking controls whether we allow
spaces before ':',
* and we always allow spaces after that for compatibility.
*/
--
Raj Jain
On Wed, Jun 11, 2008 at 7:52 AM, Johansson Olle E <oej at edvina.net> wrote:
>
> 11 jun 2008 kl. 13.01 skrev Raj Jain:
>
>> On Wed, Jun 11, 2008 at 5:55 AM, Tobias Engel <t-asterisk-dev at tobias.org
>> > wrote:
>>> The registration failed, and after some tcpdumping I found out that
>>> Asterisk sends the following CSeq header:
>>>
>>> CSeq: 4 REGISTER
>>>
>>> and the CSeq header in the response by the BTS looks like this:
>>>
>>> CSeq: 4 REGISTER
>>>
>>> Asterisk fails to match that response to its request.
>>
>> This gets even more interesting than that. Not only any can you have
>> tabs as whitespaces, SIP ABNF rules allow you to fold header lines.
>> For instance, the following is a valid header:
>>
>> Cseq: 4
>> REGISTER
>>
>> The reality is that the current chan_sip doesn't really support proper
>> SIP ABNF parsing.
>
> We sure do support multiline if you turn on pedantic.
>
> It surprises me that no test tools I've met during my tests with
> chan_sip has caught this case,
> and I've tested with a lot of evil test tools that tests SIp parsing.
> We do better than most
> devices, Raj :-)
>
> We need to fix this issue though.
>
> /O
>
> _______________________________________________
> --Bandwidth and Colocation Provided by http://www.api-digital.com--
>
> asterisk-dev mailing list
> To UNSUBSCRIBE or update options visit:
> http://lists.digium.com/mailman/listinfo/asterisk-dev
>
More information about the asterisk-dev
mailing list