vonage

Vonage Audio Connector WebSocket serializer for Pipecat.

class pipecat.serializers.vonage.VonageFrameSerializer(params: InputParams | None = None)[source]

Bases: FrameSerializer

Serializer for Vonage Video API Audio Connector WebSocket protocol.

This serializer converts between Pipecat frames and the Vonage Audio Connector WebSocket streaming protocol.

class InputParams(*, ignore_rtvi_messages: bool = True, vonage_sample_rate: int = 16000, sample_rate: int | None = None)[source]

Bases: InputParams

Configuration parameters for VonageFrameSerializer.

Parameters:
  • vonage_sample_rate – Sample rate used by Vonage, defaults to 16000 Hz. Common values: 8000, 16000, 24000 Hz.

  • sample_rate – Optional override for pipeline input sample rate.

  • ignore_rtvi_messages – Inherited from base FrameSerializer, defaults to True.

vonage_sample_rate: int
sample_rate: int | None
__init__(params: InputParams | None = None)[source]

Initialize the VonageFrameSerializer.

Parameters:

params – Configuration parameters.

async setup(frame: StartFrame)[source]

Sets up the serializer with pipeline configuration.

Parameters:

frame – The StartFrame containing pipeline configuration.

async serialize(frame: Frame) str | bytes | None[source]

Serializes a Pipecat frame to Vonage WebSocket format.

Handles conversion of various frame types to Vonage WebSocket messages.

Parameters:

frame – The Pipecat frame to serialize.

Returns:

Serialized data as string (JSON commands) or bytes (audio), or None if the frame isn’t handled.

async deserialize(data: str | bytes) Frame | None[source]

Deserializes Vonage WebSocket data to Pipecat frames.

Handles conversion of Vonage events to appropriate Pipecat frames. - Binary messages contain audio data (16-bit linear PCM) - Text messages contain JSON events (websocket:connected, websocket:cleared, dtmf, etc.)

Parameters:

data – The raw WebSocket data from Vonage.

Returns:

A Pipecat frame corresponding to the Vonage event, or None if unhandled.