SIP.js
SIP.js copied to clipboard
sip.Parser | error parsing first line of SIP message
Describe the bug I am using sip.js in my react native application, here when I am receiving a specific SIP response from the client's SIP server the Sip parser is not able to parse the first line of the SIP response.
Logs
SIP/2.0 480 Temporarily Unavailable [call Processing Released] Via: SIP/2.0/WSS 192.0.2.252;rport=38474;received=49.34.52.208;branch=z9hG4bK4396670 Record-Route: sip:xx.xx.xx.xxx;lr;ep Record-Route: sip:_sip_server_:5060;r2=on;lr;ftag=ba6jpgsua4;did=39e.5d07f992 Record-Route: sip:_sip_server:port_;transport=wss;r2=on;lr;ftag=ba6jpgsua4;did=39e.5d07f992 To: sip:[email protected];tag=GAYHZDDL6AQDGBND7EZQ____.i From: "B_display_name" sip:[email protected];tag=ba6jpgsua4 Call-ID: av1on3d1tb2sb1ksftfa CSeq: 2 INVITE Allow: INVITE, ACK, BYE, CANCEL, INFO, SUBSCRIBE, NOTIFY, REFER, MESSAGE, OPTIONS, UPDATE, PRACK Server: PortaSIP Content-Length: 0
2022-06-29T07:20:16.964Z [WARN] Wed Jun 29 2022 12:50:16 GMT+0530 (IST) | sip.Parser | error parsing first line of SIP message: "SIP/2.0 480 Temporarily Unavailable [call Processing Released]" 2022-06-29T07:20:16.971Z [WARN] Wed Jun 29 2022 12:50:16 GMT+0530 (IST) | sip.UserAgent | Failed to parse incoming message. Dropping. 2022-06-29T07:20:17.183Z [INFO] Wed Jun 29 2022 12:50:17 GMT+0530 (IST) | sip.Transport | Received WebSocket text message:
SIP/2.0 481 Call Leg Does Not Exist Via: SIP/2.0/WSS 192.0.2.252;rport=38474;received=49.34.52.208;branch=z9hG4bK1252611 Call-ID: av1on3d1tb2sb1ksftfa CSeq: 4 PRACK From: "B_display_name" sip:[email protected];tag=ba6jpgsua4 To: sip:[email protected];tag=GAYHZDDL6AQDGBND7EZQ____.i Server: PortaSIP Allow: INVITE, ACK, BYE, CANCEL, INFO, SUBSCRIBE, NOTIFY, REFER, MESSAGE, OPTIONS Content-Length: 0
To Reproduce (if possible) It's reproduced in case some additional text is there in the SIP response's first line. The parser should be resilient to it.
Expected behavior Sip.js should be able to parse the SIP response and behave accordingly.
Observed behavior Sip.js is not able to parse the SIP response and not sending any relevant response back to the server.
Environment Information
- SIP.js version: npm:sip.js@^0.20.0
- React native WebRTC version: 1.94.1
- react-native: 0.62.3
when I am receiving a specific SIP response from the client's SIP server the Sip parser is not able to parse the first line of the SIP response
The parser is rejecting invalid input - this is what parsers are supposed to do. Neither [
nor ]
(separators
in the BNF) are permitted in the status line. The problem is with the server, not SIP.js.
@seanbright - thank you!
Not a bug.