[asterisk-bugs] [Asterisk 0012834]: Asterisk can not register as SIP client to Cisco BTS due to faulty CSeq header parsing

noreply at bugs.digium.com noreply at bugs.digium.com
Thu Jun 12 14:34:30 CDT 2008


The following issue is now READY FOR TESTING. 
====================================================================== 
http://bugs.digium.com/view.php?id=12834 
====================================================================== 
Reported By:                tobias_e
Assigned To:                
====================================================================== 
Project:                    Asterisk
Issue ID:                   12834
Category:                   Channels/chan_sip/Interoperability
Reproducibility:            always
Severity:                   major
Priority:                   normal
Status:                     ready for testing
Asterisk Version:           1.4.21-rc1 
SVN Branch (only for SVN checkouts, not tarball releases): N/A 
SVN Revision (number only!):  
Disclaimer on File?:        N/A 
Request Review:              
====================================================================== 
Date Submitted:             06-11-2008 07:53 CDT
Last Modified:              06-12-2008 14:34 CDT
====================================================================== 
Summary:                    Asterisk can not register as SIP client to Cisco BTS
due to faulty CSeq header parsing
Description: 
I came across a problem yesterday when I wanted to use Asterisk as a SIP 
client for a Cisco BTS.

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. At first I thought 
that this was a problem of the BTS behaving badly, since RFC 3261 states 
in 8.2.6.2: "The CSeq header field of the response MUST equal the CSeq 
field of the request."

But in 20.16 it says: "Two CSeq header fields are considered equal if 
the sequence number and the request method are identical."

So the fields *are* identical according to RFC 3261.

The problem lies in chan_sip.c in the method "handle_response":

	const char *c = get_header(req, "Cseq");
	const char *msg = strchr(c, ' ');

	if (!msg)
		msg = "";
	else
		msg++;
	sipmethod = find_sip_method(msg);


The strchr(c, ' ') would have to be replaced by something else since not 
only spaces but also tabs are allowed. Also, the "else" part of the if 
would have too look something like this:

else
	while(*msg == ' ' || *msg == '\t')
		msg++;

====================================================================== 

---------------------------------------------------------------------- 
 putnopvut - 06-12-08 14:34  
---------------------------------------------------------------------- 
Please test the attached patch to be sure it will work with the Cisco. I
have checked to be sure that it still works with UAs which place a single
space between the Cseq and request method. 

Issue History 
Date Modified   Username       Field                    Change               
====================================================================== 
06-12-08 14:34  putnopvut      Note Added: 0088643                          
06-12-08 14:34  putnopvut      Status                   new => ready for testing
======================================================================




More information about the asterisk-bugs mailing list