# Enable WebSocket Audio Streaming

WebSocket Audio Streaming lets Cloud Voice push the audio of active calls to an external service in real time. WebSocket is a protocol that opens a single, persistent two-way connection and keeps it open for the length of the call, so audio can flow continuously without repeated requests. Use it to feed live conversations into transcription engines, analytics tools, AI assistants, or any platform that accepts an audio stream over WebSocket.

## Before you begin

Confirm the following before turning the feature on:

- Firmware version **84.20.0.74** or later.
- An **Ultimate Plan** subscription.
- The WebSocket server address of the third-party platform that will receive the stream.
- Any credentials the third-party platform requires for authentication.

:::note
This feature is gated by both the firmware version and the Ultimate Plan subscription. If **WebSocket Audio Streaming** does not appear under **Integrations**, verify that both requirements above are met before continuing.
:::

## Set up audio streaming

1. Sign in to the management portal and go to **Integrations > WebSocket Audio Streaming**.
2. Switch **WebSocket Audio Streaming** on.
3. Fill in the streaming settings.

   ![WebSocket Audio Streaming configuration form with server address, secret, sample rate, and subscription object fields](/images/pbx/websocket-audio-streaming-setting.png)

   a. **Server Address**: Choose the protocol the receiving platform expects (`ws://` or `wss://`), then enter the address where the audio stream should be delivered.

   b. **Secret** (optional): Enter the authentication value supplied by the third-party platform. To match a platform that expects a specific credential field name, click the edit icon ![Edit](/images/pbx/edit.png) and rename the option accordingly.

   c. **Sample Rate**: Select the rate for the transmitted audio. The rate determines how audio is chopped into fixed-length fragments:

      - **8000 Hz**: 80 ms per fragment.
      - **16000 Hz**: 40 ms per fragment.

   d. **Subscription Object**: Choose which calls are streamed to the third-party platform. You can subscribe by extension, trunk, or DID (Direct Inward Dialing, an external phone number that routes callers straight to a destination) number:

      | Object | What gets streamed |
      | --- | --- |
      | Extension | Audio from any call involving the selected extensions. |
      | Trunk | Audio from inbound and outbound calls routed over the selected trunks. |
      | DID Number | Audio from inbound calls placed to the selected DID numbers. |

4. Click **Save**.

:::caution
**Server Address:** Prefer `wss://`, the encrypted (TLS) form of the protocol. The `ws://` option sends live call audio across the network unencrypted, where it can be intercepted. Use `ws://` only if the receiving platform genuinely cannot accept a secure connection.
:::

:::caution
**Sample Rate:** The receiving platform must be configured to expect the same sample rate you select here. A mismatch makes the audio play back distorted or at the wrong speed.
:::

## Result

Whenever a subscribed extension, trunk, or DID number is on a call, the audio of every participant is delivered to the third-party platform over WebSocket in real time.

:::note
Audio is encoded as 16-bit little-endian `PCM` (Pulse-Code Modulation, raw uncompressed audio), Base64-encoded, and sent inside JSON messages. For the structure of those messages, see [Audio Stream Fields](/pbx/administrator-guide/audio-stream-fields/).
:::
