Hi,

No, this option was not set. If I set it explicitly to "no", the behavior stays the same. However, if I set it to "yes", then the error message disappears.

From the documentation, I would have expected it exactly the other way round. However, xhttp module README says, that you have to set it to yes to prevent errors. So thanks for the hint.

Regards,
Sebastian

From: Daniel-Constantin Mierla <miconda@gmail.com>
Sent: Wednesday, September 11, 2024 19:10
To: Kamailio (SER) - Users Mailing List <sr-users@lists.kamailio.org>
Cc: Sebastian Damm <sdamm@pascom.net>
Subject: Re: [SR-Users] SIP parse error for self-generated Websocket reply
 

Hello,

On 11.09.24 18:02, Sebastian Damm via sr-users wrote:
Hello,

We try to introduce a small websocket sidecar to our Kamailio servers, which runs on the same host. It connects to the regular TCP socket of our Kamailios, and in the XHTTP request route, we do just this:

        if path == "/sidecar":
            KSR.websocket.handle_handshake()
            return 1

On every new connect, Kamailio logs a parse error for the reply it generates.

Sep 11 15:42:35 sipproxy /usr/sbin/kamailio[552]: ERROR: <core> [core/parser/parse_fline.c:272]: parse_first_line(): parse_first_line: bad message (offset: 22)
Sep 11 15:42:35 sipproxy /usr/sbin/kamailio[552]: ERROR: <core> [core/parser/msg_parser.c:790]: parse_msg(): ERROR: parse_msg: message=<HTTP/1.1 101 Switching Protocols
                                                  Sia: SIP/2.0/TCP 100.74.11.1:46422
                                                  Sec-WebSocket-Protocol: sip
                                                  Upgrade: websocket
                                                  Connection: upgrade
                                                  Sec-WebSocket-Accept: 60dPbzcRW6up7z92kDlxkqL2WlY=
                                                  Content-Length: 0

                                                  >
Sep 11 15:42:35 sipproxy /usr/sbin/kamailio[552]: ERROR: <core> [core/msg_translator.c:3402]: build_sip_msg_from_buf(): parsing failed


I saw this error in other questions from a while ago, but without a solution. What could be the reason for this?

is this parameter set?


  - https://www.kamailio.org/wikidocs/cookbooks/5.8.x/core/#http_reply_parse

Cheers, Daniel

-- 
Daniel-Constantin Mierla (@ asipto.com)
twitter.com/miconda -- linkedin.com/in/miconda
Kamailio Consultancy, Training and Development Services -- asipto.com
Kamailio Advanced Training, October 8-10, 2024 -- asipto.com