]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
chan_websocket: Fixed Ping/Pong messages hanging up the websocket channel
authorJoe Garlick <joe@flipcx.com>
Thu, 15 Jan 2026 14:56:47 +0000 (14:56 +0000)
committerJoe Garlick <joe@flipcx.com>
Thu, 15 Jan 2026 16:16:29 +0000 (16:16 +0000)
When chan_websocket received a Ping or a Pong opcode it would cause the channel to hangup. This change allows Ping/Pong opcodes and allows them to silently pass

channels/chan_websocket.c

index ad4e694ccf15c44072ee6dacee727981a0d7efa2..b86bac4c67bc34008012f3a2dcae9bdb66be5c64 100644 (file)
@@ -1116,6 +1116,10 @@ static int read_from_ws_and_queue(struct websocket_pvt *instance)
                return process_text_message(instance, payload, payload_len);
        }
 
+       if (opcode == AST_WEBSOCKET_OPCODE_PING || opcode == AST_WEBSOCKET_OPCODE_PONG) {
+               return 0;
+       }
+
        if (opcode == AST_WEBSOCKET_OPCODE_CLOSE) {
                ast_debug(3, "%s: WebSocket closed by remote\n",
                        ast_channel_name(instance->channel));