versatica / JsSIP

JsSIP, the JavaScript SIP library
https://jssip.net
Other
2.42k stars 744 forks source link

Fixed REFER NOTIFY parsing in accordance to RFC 3515 section 2.4.5 #767

Closed markusatm closed 2 years ago

markusatm commented 2 years ago

I observed failures to parse the body of a refer NOTIFY in JsSIP if the body contained more than just a status line. According to RFC 3515 section 2.4.5 it is allowed for additional SIP headers to be in the NOTIFY body in addition to the status line. In accordance with that I changed the JsSIP code so the Status_Line parser is only used to parse the first line of the NOTIFY body, which according to the RFC always contains the status line. Thus the parser will no longer throw an error if there is additional data in the body after the status line.

For reference, this is the NOTIFY body that was received:

SIP/2.0 420 Bad Extension Reason: SIP;cause=183;text="Call in progress"

ibc commented 2 years ago

@jmillan?

jmillan commented 2 years ago

Can you please add the corresponding test in test/test-parser.js?

jmillan commented 2 years ago

BTW, thanks for the PR @markusatm and sorry for the delay.

Once with the test we'll be able to merge it.

markusatm commented 2 years ago

Hi @jmillan, I've added a test for status line parsing as there wasn't yet one.

Though I'm not sure if that was what you wanted as I hadn't changed anything in the parser itself. My change is to ensure that the string which is handed to the status line parser really only consists of one line.