Stream - Websocket - close Error

I am trying to stream call in orther to use a Speech-to-teext API. I copied the exact python code from here: https://www.twilio.com/docs/voice/tutorials/consume-real-time-media-stream-using-websockets-python-and-flask and tried to create the socket. But it does not work... :(. I always receive the same log error (Stream - Websocket - close Error)

I my terminal appears the following:

Server listening on: http://localhost:5000

Traceback (most recent call last):

 File "C:\Users\usuario\AppData\Local\Programs\Python\Python39\lib\site-packages\gevent\pywsgi.py", line 999, in handle_one_response

  self.run_application()

 File "C:\Users\usuario\AppData\Local\Programs\Python\Python39\lib\site-packages\geventwebsocket\handler.py", line 75, in run_application

  self.run_websocket()

 File "C:\Users\usuario\AppData\Local\Programs\Python\Python39\lib\site-packages\geventwebsocket\handler.py", line 52, in run_websocket

  list(self.application(self.environ, lambda s, h, e=None: []))

 File "C:\Users\usuario\AppData\Local\Programs\Python\Python39\lib\site-packages\flask\app.py", line 2091, in __call__

  return self.wsgi_app(environ, start_response)

 File "C:\Users\usuario\AppData\Local\Programs\Python\Python39\lib\site-packages\flask_sockets.py", line 40, in __call__

  handler, values = adapter.match()

 File "C:\Users\usuario\AppData\Local\Programs\Python\Python39\lib\site-packages\werkzeug\routing.py", line 2030, in match

  raise WebsocketMismatch()

werkzeug.routing.WebsocketMismatch: 400 Bad Request: The browser (or proxy) sent a request that this server could not understand.

2022-01-18T12:50:14Z {'REMOTE_ADDR': '::1', 'REMOTE_PORT': '50490', 'HTTP_HOST': '7ecd-88-12-17-9.ngrok.io', (hidden keys: 28)} failed with WebsocketMismatch


Someone can help me, please?

Comments

If this is an emergency, please contact Twilio Support. This is not an official Support channel. https://support.twilio.com/
Have an urgent question?
Please contact Twilio Support. This is not an official Support channel.
Contact Support