[Home]

Summary:ASTERISK-28958: Continue reading string when ping received by websocket
Reporter:Nickolay V. Shmyrev (nshmyrev)Labels:
Date Opened:2020-06-22 10:30:50Date Closed:2020-07-07 08:55:57
Priority:MinorRegression?
Status:Closed/CompleteComponents:Resources/res_http_websocket
Versions:GIT Frequency of
Occurrence
Related
Issues:
Environment:Attachments:
Description: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 (https://github.com/asterisk/asterisk/blob/9445dac43b68ea3adff9c52cd8722f0adb86c079/res/res_http_websocket.c#L1439):

{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:

**edit by [~kharwell]: removed inline patch.
Comments:By: Asterisk Team (asteriskteam) 2020-06-22 10:30:51.211-0500

Thanks for creating a report! The issue has entered the triage process. That means the issue will wait in this status until a Bug Marshal has an opportunity to review the issue. Once the issue has been reviewed you will receive comments regarding the next steps towards resolution.

A good first step is for you to review the [Asterisk Issue Guidelines|https://wiki.asterisk.org/wiki/display/AST/Asterisk+Issue+Guidelines] if you haven't already. The guidelines detail what is expected from an Asterisk issue report.

Then, if you are submitting a patch, please review the [Patch Contribution Process|https://wiki.asterisk.org/wiki/display/AST/Patch+Contribution+Process].

Please note that once your issue enters an open state it has been accepted. As Asterisk is an open source project there is no guarantee or timeframe on when your issue will be looked into. If you need expedient resolution you will need to find and pay a suitable developer. Asking for an update on your issue will not yield any progress on it and will not result in a response. All updates are posted to the issue when they occur.

By: Kevin Harwell (kharwell) 2020-06-22 12:06:56.137-0500

[~nshmyrev] Unfortunately we cannot accept inline patches within the issue description or comments. Instead please attach any patch as a contribution.

Or even better would you like, and be willing to go ahead and push the patch to gerrit [1]?

[1] https://wiki.asterisk.org/wiki/display/AST/Code+Review

By: Nickolay V. Shmyrev (nshmyrev) 2020-06-22 12:26:08.488-0500

Ok, I submitted one in gerrit

By: Kevin Harwell (kharwell) 2020-06-22 12:48:25.475-0500

Excellent! I'll assign to you then for now then.

Thanks for the submission!

By: Friendly Automation (friendly-automation) 2020-07-07 08:55:58.502-0500

Change 14642 merged by Friendly Automation:
res_http_websocket.c: Continue reading after ping/pong

[https://gerrit.asterisk.org/c/asterisk/+/14642|https://gerrit.asterisk.org/c/asterisk/+/14642]

By: Friendly Automation (friendly-automation) 2020-07-07 09:05:52.588-0500

Change 14570 merged by Friendly Automation:
res_http_websocket.c: Continue reading after ping/pong

[https://gerrit.asterisk.org/c/asterisk/+/14570|https://gerrit.asterisk.org/c/asterisk/+/14570]

By: Friendly Automation (friendly-automation) 2020-07-07 09:35:17.614-0500

Change 14643 merged by George Joseph:
res_http_websocket.c: Continue reading after ping/pong

[https://gerrit.asterisk.org/c/asterisk/+/14643|https://gerrit.asterisk.org/c/asterisk/+/14643]

By: Friendly Automation (friendly-automation) 2020-07-07 09:36:04.176-0500

Change 14644 merged by George Joseph:
res_http_websocket.c: Continue reading after ping/pong

[https://gerrit.asterisk.org/c/asterisk/+/14644|https://gerrit.asterisk.org/c/asterisk/+/14644]