# WebSocket Audio Streaming Overview

WebSocket Audio Streaming lets Cloud Voice forward the live audio of active calls to an external platform over a WebSocket connection, so that another service can transcribe, analyze, or otherwise process the conversation as it happens.

## Requirements

Before you can use this feature, your system must meet the following conditions:

- **Firmware**: Version 84.20.0.74 or later.
- **Subscription**: The Ultimate Plan.

:::caution
Both conditions must be met before the feature turns on. If the WebSocket Audio Streaming option is missing or cannot be selected, check the firmware version and confirm the account is on the Ultimate Plan before troubleshooting anything else.
:::

## Highlights

**Efficient, stable transmission**
: The connection is full-duplex (audio can flow in both directions at the same time) and low-latency, moving audio with millisecond-level delay.

**Secure, reliable connectivity**
: Audio can travel over WebSocket Secure (WSS) with authentication credentials, keeping the stream encrypted and protected.

:::tip
Call audio is sensitive. Whenever the third-party platform supports it, use WebSocket Secure (WSS) rather than plain, unencrypted WebSocket, so the audio cannot be read if it is captured on the network.
:::

**Flexible integration**
: Because the audio reaches any WebSocket-capable platform, you can layer on services such as speech-to-text transcription, call-compliance monitoring, multilingual translation, and other language-processing tasks.

## How it works

The diagram below shows how Cloud Voice opens a WebSocket connection to a third-party platform and streams the audio of a call.

![Sequence of requests and messages exchanged between Cloud Voice and a third-party platform during audio streaming](/images/pbx/websocket-audio-streaming-workflow.png)

1. Cloud Voice sends an HTTP (Hypertext Transfer Protocol) GET request to the third-party platform to start a WebSocket connection, placing the credentials in the request header.

   :::note
   To learn how to set up these credentials, see [Enable WebSocket Audio Streaming](/pbx/administrator-guide/enable-websocket-audio-streaming/).
   :::

2. The platform checks the credentials. When they are valid, it replies with an HTTP `101 Switching Protocols` status. This status completes the handshake and upgrades the connection from HTTP to WebSocket, so both sides can now exchange messages freely.

3. While the call is in progress, Cloud Voice streams the audio to the platform inside JSON (JavaScript Object Notation) messages. The audio is encoded as 16-bit little-endian PCM (pulse-code modulation), then Base64-encoded before it is placed in each message.

   :::note
   For a breakdown of what these JSON messages contain, see [Audio Stream Fields](/pbx/administrator-guide/audio-stream-fields/).
   :::

4. Once the call ends, Cloud Voice sends the end-of-call information to the platform, again as JSON messages.

   :::note
   The end-of-call message structure is also described in [Audio Stream Fields](/pbx/administrator-guide/audio-stream-fields/).
   :::

5. Cloud Voice sends a Close frame to begin shutting down the WebSocket.

6. The platform answers with its own Close frame, and the WebSocket connection closes.
