nadirhamid / asterisk-audiofork

Stream Asterisk audio over Websockets
GNU General Public License v2.0
158 stars 60 forks source link

audiofork sending unmasked frames #7

Closed adambezecny closed 3 years ago

adambezecny commented 3 years ago

hi,

we are using asterisk 16 with audiofork app to receive audio data into websocket. our app is written in Node.JS using ws library(https://www.npmjs.com/package/ws). Everything just works fine.

Recently we have started to experiment with Rust where we use tungstenite-rs library for websockets. We create websocket server accepting audiofork data but we are getting this error once audio fork starts sending data: Received an unmasked frame from client

The problem is here: https://github.com/snapview/tungstenite-rs/blob/master/src/protocol/mod.rs#L453

It seems audiofork app is sending unmasked packets which must be rejected according to RFC 6455.

Can you confirm audiofork is sending unmasked frames? Any option how to make it to send masked as requested by RFC 6455?

nadirhamid commented 3 years ago

Hello @adambezecny,

Thanks for filling an issue.

This unmasking issue has been a known problem in the Asterisk res_websocket.c module for some time. See: https://issues.asterisk.org/jira/browse/ASTERISK-28914. app_audiofork uses res_websocket under the hood, so this issue is directly related to Asterisk's res_websocket.

However it appears that the masking issue was resolved in Asterisk version 18. As a result the best method to fix your issue would be just to upgrade to Asterisk 18. Alternatively (if you dont want to upgrade) you can find a Rust websocket server that does not check for masked websocket frames, which would essentially work the same as your previous setup.

I will be closing this issue.

If you have any other questions or need more info, please feel free to file another issue.

Thanks