exotel

Exotel Media Streams serializer for Pipecat.

class pipecat.serializers.exotel.ExotelFrameSerializer(stream_sid: str, call_sid: str | None = None, params: InputParams | None = None)[source]

Bases: FrameSerializer

Serializer for Exotel Media Streams WebSocket protocol.

This serializer handles converting between Pipecat frames and Exotel’s WebSocket media streams protocol. It supports audio conversion, DTMF events, and automatic call termination.

Note: Ref docs for events:

https://support.exotel.com/support/solutions/articles/3000108630-working-with-the-stream-and-voicebot-applet

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

Bases: InputParams

Configuration parameters for ExotelFrameSerializer.

Parameters:
  • exotel_sample_rate – Sample rate used by Exotel, defaults to 8000 Hz.

  • sample_rate – Optional override for pipeline input sample rate.

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

exotel_sample_rate: int
sample_rate: int | None
__init__(stream_sid: str, call_sid: str | None = None, params: InputParams | None = None)[source]

Initialize the ExotelFrameSerializer.

Parameters:
  • stream_sid – The Exotel Media Stream SID.

  • call_sid – The associated Exotel Call SID (optional, not used in this implementation).

  • 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 Exotel WebSocket format.

Handles conversion of various frame types to Exotel WebSocket messages.

Parameters:

frame – The Pipecat frame to serialize.

Returns:

Serialized data as string or bytes, or None if the frame isn’t handled.

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

Deserializes Exotel WebSocket data to Pipecat frames.

Handles conversion of Exotel media events to appropriate Pipecat frames.

Parameters:

data – The raw WebSocket data from Exotel.

Returns:

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