[asterisk-bugs] [JIRA] (ASTERISK-28958) Continue reading string when ping received by websocket
Nickolay V. Shmyrev (JIRA)
noreply at issues.asterisk.org
Mon Jun 22 10:31:25 CDT 2020
[ https://issues.asterisk.org/jira/browse/ASTERISK-28958?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Nickolay V. Shmyrev updated ASTERISK-28958:
-------------------------------------------
Severity: Minor (was: Major)
> Continue reading string when ping received by websocket
> -------------------------------------------------------
>
> Key: ASTERISK-28958
> URL: https://issues.asterisk.org/jira/browse/ASTERISK-28958
> Project: Asterisk
> Issue Type: Improvement
> Security Level: None
> Components: Resources/res_http_websocket
> Affects Versions: GIT
> Reporter: Nickolay V. Shmyrev
> Severity: Minor
>
> While implementing websocket-based speech recognition server https://github.com/alphacep/vosk-asterisk I had the following issue.
> According to websocket specification client can receive ping control frame any time. In that case the following error is thrown by client reading for the string when client uses ast_websocket_read_string:
> {code}
> if (opcode != AST_WEBSOCKET_OPCODE_TEXT) {
> ast_log(LOG_ERROR, "Client WebSocket string read - "
> "non string data received\n");
> return -1;
> }
> {code}
> The proposed change should solve this problem by continue reading the string after ping is recieved:
> {code}
> @@ -1435,6 +1435,12 @@ int AST_OPTIONAL_API_NAME(ast_websocket_
> return -1;
> }
>
> + if (opcode == AST_WEBSOCKET_OPCODE_PING) {
> + /* Try again, we have sent pong already */
> + fragmented = 1;
> + continue;
> + }
> +
> if (opcode == AST_WEBSOCKET_OPCODE_CONTINUATION) {
> continue;
> }
> {code}
--
This message was sent by Atlassian JIRA
(v6.2#6252)
More information about the asterisk-bugs
mailing list