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?


Thanks in advance,
Sebastian