Telnyx Frame Serializer
Serializer for Telnyx WebSocket media streaming protocol
Overview
TelnyxFrameSerializer
enables integration with Telnyx’s WebSocket media streaming protocol, allowing your Pipecat application to handle phone calls via Telnyx’s voice services.
Features
- Bidirectional audio conversion between Pipecat and Telnyx
- DTMF (touch-tone) event handling
- Automatic call termination via Telnyx’s REST API
- Support for multiple audio encodings (PCMU, PCMA)
Installation
The TelnyxFrameSerializer
does not require any additional dependencies beyond the core Pipecat library.
Configuration
Constructor Parameters
The Stream ID for Telnyx
The encoding type for outbound audio (e.g., “PCMU”, “PCMA”)
The encoding type for inbound audio (e.g., “PCMU”, “PCMA”)
The Call Control ID for the Telnyx call (required for auto hang-up)
Your Telnyx API key (required for auto hang-up)
Configuration parameters
InputParams Configuration
Sample rate used by Telnyx (typically 8kHz)
Optional override for pipeline input sample rate
Audio encoding for data sent to Telnyx
Audio encoding for data received from Telnyx
Whether to automatically terminate call on EndFrame
Basic Usage
Hang-up Functionality
When auto_hang_up
is enabled, the serializer will automatically hang up the Telnyx call when an EndFrame
or CancelFrame
is processed, using Telnyx’s REST API:
Server Code Example
Here’s a complete example of handling a Telnyx WebSocket connection:
See the Telnyx Chatbot example for a complete implementation.