Skip to main content
The listen verb sends real-time audio streams to your external server over a WebSocket connection for processing. The Call Recording feature relies on this verb. This table outlines the properties related to the audio streams sent by the listen verb: One text frame is sent immediately after the WebSocket connection is established to send a JSON string with call attributes over an HTTP request. Additional metadata can also be added to this payload using the metadata parameter. The listen verb can also be nested in a dial or config verb, allowing the audio for a call between two parties to be sent to a remote WebSocket server.

Configuration

The following table lists the available parameters:

Passing DTMF

Any DTMF digits entered by the far end party on the call can optionally be passed to the WebSocket server as JSON text frames by setting the passDtmf property to true. Each DTMF entry is reported separately in a payload containing the specific DTMF key that was entered, along with its duration reported in RTP timestamp units. The payload example:

Bidirectional Audio

Audio can also be sent back over the WebSocket. This audio, if supplied, will be played out to the caller.
Bidirectional audio is not supported when the listen is nested in the context of a dial verb.
The far-end WebSocket server supplies bidirectional audio by sending a JSON text frame over the WebSocket connection:
In the example above, raw (headerless) audio is sent. The audio must comply with the standard properties of encoding and format, with a configurable sample rate of either 8000, 16000, 24000, 32000, 48000, or 64000 Hz.Alternatively, a wave file format can be supplied by using type wav (or wave), and in this case, no sampleRate property is needed. In all cases, the audio must be base64 encoded when sent over the socket.If multiple playAudio verbs are sent before the first has finished playing, they will be queued and played in order. You may have up to 10 queued playAudio verbs at any time.Once a playAudio verb has finished playing out the audio, a playDone JSON text frame will be sent over the WebSocket connection for confirmation.
A killAudio verb can be sent by the WebSocket server to stop the playback of audio that was started via a previous playAudio verb:
If the WebSocket connection wishes to end the listen, it can send a disconnect verb:
Last modified on May 12, 2026