Skip to main content

jain SIP Parser throws exception on parsing CSeq header and values

4 replies [Last post]
parasuraman
Offline
Joined: 2008-11-06
Points: 0

Hi,

I tried to parse the SIP CSeq Header and values using Jain SIP Parser.
with the following snippet
String CSeq="CSeq: 1 INVITE";
CSeqParser ccseq = new CSeqParser(CSeq);
SIPHeader CSq=ccseq.parse();
System.out.println(CSq);

and received the following exception on the console.

Exceptionjava.text.ParseException: CSeq: 1 INVITE
Expecting >>>
<<< got >>>

is there anything wrong with my approach on parsing ?
Plz provide me help.
thanks in advance
Parasuram

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
parasuraman
Offline
Joined: 2008-11-06
Points: 0

hi,

Thanks for the clue.
Each header value should be ended with a '\n'
so that desired result will be obtained.

Thanks
Parasuraman

parasuraman
Offline
Joined: 2008-11-06
Points: 0

Hi all

I tried to parse the Expires header through this SIP Parser
but received exception as mentioned below
my snippet is

String Expires1="Expires: 0\r\n";
ExpiresParser exp = new ExpiresParser(Expires1);
SIPHeader expiress = exp.parse();
System.out.println(expiress);

Exception obtained is
Exceptionjava.text.ParseException: Expires: 0

Expecting >>>
<<< got >>>
<<<

please help.. similar problem exists with Cseq header also as mentioned in previous thread. Most probably the solution obtain may be applicable to get rid of similar problems.

Thanks in advance

Parasuraman

baranowb
Offline
Joined: 2006-01-08
Points: 0

Headers MUST end with new line === \r\n
see how JSIP encodes header.
For instance: public String encode() {
return headerName + COLON + SP + encodeBody() + NEWLINE;
}

parasuraman
Offline
Joined: 2008-11-06
Points: 0

Hi,

Yeah , i agree with your reply,
where we need to add a new line in the header?
String CSeq="CSeq: 1 INVITE\r\n";

Regards
Parasuraman