Plivo Frame Serializer
Serializer for Plivo Audio Streaming WebSocket protocol
Overview
PlivoFrameSerializer
enables integration with Plivo’s Audio Streaming WebSocket protocol, allowing your Pipecat application to handle phone calls via Plivo’s voice services.
Features
- Bidirectional audio conversion between Pipecat and Plivo
- DTMF (touch-tone) event handling
- Automatic call termination via Plivo’s REST API
- μ-law audio encoding/decoding
Installation
The PlivoFrameSerializer
does not require any additional dependencies beyond the core Pipecat library.
Configuration
Constructor Parameters
The Plivo Stream ID
The associated Plivo Call ID (required for auto hang-up)
Plivo auth ID (required for auto hang-up)
Plivo auth token (required for auto hang-up)
Configuration parameters
InputParams Configuration
Sample rate used by Plivo (typically 8kHz)
Optional override for pipeline input sample rate
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 Plivo call when an EndFrame
or CancelFrame
is processed, using Plivo’s REST API:
Server Code Example
Here’s a complete example of handling a Plivo WebSocket connection:
Plivo XML Configuration
To enable audio streaming with Plivo, you’ll need to configure your Plivo application to return appropriate XML:
The bidirectional="true"
attribute is required for two-way audio
communication, and keepCallAlive="true"
prevents the call from being
disconnected after XML execution.
Key Differences from Twilio
- Stream Identifier: Plivo uses
streamId
instead ofstreamSid
- Call Identifier: Plivo uses
callId
instead ofcallSid
- XML Structure: Plivo uses
<Stream>
element directly instead of<Connect><Stream>
- Authentication: Plivo uses Auth ID and Auth Token instead of Account SID and Auth Token
See the Plivo Chatbot example for a complete implementation.