Overview
AsteriskFrameSerializer converts between Pipecat frames and the media stream
of an Asterisk WebSocket channel. It translates the
channel’s JSON or plain-text events and raw audio payloads into Pipecat frames
(and vice versa), so a Pipecat pipeline can handle telephony calls bridged
through Asterisk. The serializer is designed to be used with Pipecat’s
FastAPIWebsocketTransport.
Source Repository
Source code, examples, and issues for the Asterisk integration
PyPI Package
The
pipecat-asterisk package on PyPIAsterisk
Learn more about the Asterisk open-source telephony platform
WebSocket Channel Docs
Asterisk WebSocket channel driver documentation
Installation
This is a community-maintained package distributed separately frompipecat-ai:
pip install pipecat-asterisk if you manage dependencies with pip.
Prerequisites
Asterisk is a self-hosted, open-source telephony platform, so there is no provider account or API key to configure. You need:- An Asterisk server with a WebSocket channel configured. The serializer and transport are based on the Asterisk WebSocket channel.
slin-encoded audio: The serializer works withslinaudio, since Asterisk natively supports all flavors ofslinand Pipecat audio frames must beslin-encoded. Transcode on the Asterisk side if you need a different codec.
docker-compose.yml and Asterisk
configuration files under examples/pipecat_asterisk/ to spin up a local
testing environment. See the
source repository for
details.
Configuration
AsteriskFrameSerializer is constructed with a single optional parameter:
Sample rate in kHz used by the Asterisk channel. When left at
0, it is
populated during setup or from the Asterisk MEDIA_START event. Supported
slin sample rates are 12, 16, 24, 32, 44, 48, 96, 192, 128 kHz.This serializer does not use the Pipecat Settings dataclass pattern. See the
source repository for the
authoritative, up-to-date implementation.
Usage
Pass the serializer to aFastAPIWebsocketTransport through
FastAPIWebsocketParams, then build your pipeline as usual: