This case actually demonstrates a generic problem with the SIPp code. This
is caused by the fact that strstr() is easy to use if you are writing the
code but is not really a good SIP parser.
1) It really should have strstr for "\nCSeq:". No space is allowed
before the CSeq and it cannot be on the request-uri line so this is 100%
safe.
2) The CSeq should be matched case independently (and isn't).
3) A space is allowed between CSeq and : (actually any number and
combination of HTAB and SP is allowed).
4) The match should terminate on a blank line so as not to go looking
for CSeq in a MIME body or SDP or whatever.
Note that [last_...] also has most of the same issues.
The first one I fix when I come across it, the rest I just remember when
people show me traces of things that did not match properly.
I think the long term solution is something like find_sip_header() that
obeys the parsing rules. (If you want to do it, my regex fix for hdr is a
possible starting place - it at least does 1) and 2).)
In this case I suggest making the "\nCSeq" change - it is cheap.
Peter
_____
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Brian R.
Gorham
Sent: 20 March 2007 16:42
To: [email protected]
Subject: [Sipp-users] 400 cseq problem
To answer my own question, the reason I was seeing this:
2007-03-20 11:11:37: Aborting call on unexpected message for Call-ID
'[EMAIL PROTECTED]' : while expecting '400' response, received 'SIP/2.0 400
CSeq too small for this call
From: "David F. Slaboch L."< sip:[EMAIL PROTECTED] <mailto:sip:[EMAIL
PROTECTED]>
;user=phone>;tag=269734095-1172738712030-
To: "Novodvorska Prodejna"< sip:[EMAIL PROTECTED] <mailto:sip:[EMAIL
PROTECTED]>
>;tag=6708010a-13c4-45fff9a9-517c71d-6ab1f752
Call-ID: [EMAIL PROTECTED]
CSeq: 2 INVITE
Via: SIP/2.0/UDP 10.1.32.10:5060 <http://10.1.32.10:5060/> ;branch=
<mailto:[EMAIL PROTECTED]> [EMAIL PROTECTED]
Content-Length: 0
was because call::extract_cseq_method was doing a strstr looking for "CSeq".
It was finding "CSeq" in the request-uri and then things got funky from
there. I modified call::extract_cseq_method to what you see below and that
fixed things for me.
void call::extract_cseq_method (char* method, char* msg)
{
char* cseq ;
char* cseq_test;
if (cseq = strstr (msg, "CSeq:"))
{
char * value = cseq+5;
//value++;
while ( isspace(*value)) value++; // ignore any white spaces after the
:
while ( !isspace(*value)) value++; // ignore the CSEQ numnber
value++;
char *end = value;
int nbytes = 0;
/* A '\r' terminates the line, so we want to catch that too. */
while ((*end != '\r') && (*end != '\n')) { end++; nbytes++; }
if (nbytes > 0) strncpy (method, value, nbytes);
method[nbytes] = '\0';
}
}
---------------------------------------------------------------------------------------------
This e-mail may contain confidential and/or privileged information.
If you are not the intended recipient (or have received this e-mail in error)
please
notify the sender immediately and delete this e-mail. Any unauthorized copying,
disclosure or distribution of the contents in this e-mail is strictly forbidden.
---------------------------------------------------------------------------------------------
Newport Networks Limited is registered in England. Registration number 4067591.
Registered office: 6 St. Andrew Street, London EC4A 3LX
----------------------------------------------------------------------------------------------------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Sipp-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sipp-users