[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
Tue Jun 17 01:39:36 CDT 2008


A NOTE has been added to this issue. 
====================================================================== 
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-17-2008 01:39 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++;

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

---------------------------------------------------------------------- 
 tobias_e - 06-17-08 01:39  
---------------------------------------------------------------------- 
The patch seems to be working - I can now register and make calls via the
Cisco BTS. 

Issue History 
Date Modified   Username       Field                    Change               
====================================================================== 
06-17-08 01:39  tobias_e       Note Added: 0088785                          
======================================================================




More information about the asterisk-bugs mailing list