Exotel

class pipecat.serializers.exotel.ExotelFrameSerializer(stream_sid, call_sid=None, params=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.

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

Parameters:
  • stream_sid (str)

  • call_sid (str | None)

  • params (InputParams | None)

class InputParams(*, exotel_sample_rate=8000, sample_rate=None)[source]

Bases: BaseModel

Configuration parameters for ExotelFrameSerializer.

Parameters:
  • exotel_sample_rate (int)

  • sample_rate (int | None)

exotel_sample_rate

Sample rate used by Exotel, defaults to 8000 Hz.

Type:

int

sample_rate

Optional override for pipeline input sample rate.

Type:

int | None

exotel_sample_rate: int
sample_rate: int | None
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

property type: FrameSerializerType

Gets the serializer type.

Returns:

The serializer type, either TEXT or BINARY.

async setup(frame)[source]

Sets up the serializer with pipeline configuration.

Parameters:

frame (StartFrame) – The StartFrame containing pipeline configuration.

async serialize(frame)[source]

Serializes a Pipecat frame to Exotel WebSocket format.

Handles conversion of various frame types to Exotel WebSocket messages.

Parameters:

frame (Frame) – The Pipecat frame to serialize.

Returns:

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

Return type:

str | bytes | None

async deserialize(data)[source]

Deserializes Exotel WebSocket data to Pipecat frames.

Handles conversion of Exotel media events to appropriate Pipecat frames.

Parameters:

data (str | bytes) – The raw WebSocket data from Exotel.

Returns:

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

Return type:

Frame | None