Overview
BandwidthFrameSerializer is a FrameSerializer that converts between Pipecat
frames and Bandwidth Programmable Voice’s
bidirectional WebSocket media stream protocol. Plug it into a
FastAPIWebsocketTransport to use Bandwidth as the telephony layer for your
Pipecat voice bots.
Source Repository
Source code, examples, and issues for the Bandwidth integration
PyPI Package
The
pipecat-bandwidth package on PyPIBandwidth StartStream BXML
Bandwidth’s media-stream protocol reference
Bandwidth Voice API
Manage credentials and calls via the Bandwidth Voice API
Installation
This is a community-maintained package distributed separately frompipecat-ai:
Prerequisites
Bandwidth Account Setup
Before usingBandwidthFrameSerializer, you need:
- Bandwidth Account: Sign up at Bandwidth
- Programmable Voice: A phone number and application configured for
Programmable Voice with a
<StartStream mode="bidirectional">BXML response - OAuth 2.0 Credentials: A Client ID and Client Secret for the Bandwidth Voice API (required for auto hang-up)
Required Environment Variables
BANDWIDTH_CLIENT_ID: OAuth 2.0 Client ID for Bandwidth API authenticationBANDWIDTH_CLIENT_SECRET: OAuth 2.0 Client Secret for Bandwidth API authentication
Configuration
The Bandwidth Stream ID, available in the
start event metadata.The Bandwidth Call ID. Required when
auto_hang_up is enabled. Must come from
a server-trusted source (e.g. the signed inbound voice webhook).The Bandwidth account ID. Required when
auto_hang_up is enabled. Same trust
requirement as call_id.OAuth 2.0 Client ID for Bandwidth API authentication. Required when
auto_hang_up is enabled.OAuth 2.0 Client Secret for Bandwidth API authentication. Required when
auto_hang_up is enabled.Configuration parameters for audio encoding and hang-up behavior. See
InputParams below.
InputParams
Configuration passed via theparams constructor argument using
BandwidthFrameSerializer.InputParams(...).
Usage
Wire the serializer into aFastAPIWebsocketTransport:
DTMF is not delivered over the media-stream WebSocket on Bandwidth. It is
captured by the BXML
<Gather> verb and posted to a separate webhook, so DTMF
handling belongs in your application’s webhook handler, not the serializer.