> ## Documentation Index
> Fetch the complete documentation index at: https://daily-docs-source-analytics-user-turn-strategies.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Asterisk

> Frame serializer for connecting Pipecat pipelines to an Asterisk WebSocket channel

export const CommunityMaintained = ({maintainer, maintainerUrl, repo}) => <Note>
    <strong>Community-maintained integration.</strong> This service is built and
    maintained by{" "}
    <a href={maintainerUrl} target="_blank" rel="noreferrer">
      {maintainer}
    </a>
    . Pipecat does not test or officially support it. Please report issues and
    request changes on the{" "}
    <a href={repo} target="_blank" rel="noreferrer">
      source repository
    </a>
    . Learn more about{" "}
    <a href="/api-reference/server/services/community-integrations">
      community integrations
    </a>
    .
  </Note>;

<CommunityMaintained maintainer="NikolayShakin" maintainerUrl="https://github.com/NikolayShakin" repo="https://github.com/NikolayShakin/pipecat-asterisk" />

## Overview

`AsteriskFrameSerializer` converts between Pipecat frames and the media stream
of an [Asterisk](https://www.asterisk.org/) 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`.

<CardGroup cols={2}>
  <Card title="Source Repository" icon="github" href="https://github.com/NikolayShakin/pipecat-asterisk">
    Source code, examples, and issues for the Asterisk integration
  </Card>

  <Card title="PyPI Package" icon="cube" href="https://pypi.org/project/pipecat-asterisk/">
    The `pipecat-asterisk` package on PyPI
  </Card>

  <Card title="Asterisk" icon="phone" href="https://www.asterisk.org/">
    Learn more about the Asterisk open-source telephony platform
  </Card>

  <Card title="WebSocket Channel Docs" icon="book" href="https://docs.asterisk.org/Configuration/Channel-Drivers/WebSocket/">
    Asterisk WebSocket channel driver documentation
  </Card>
</CardGroup>

## Installation

This is a community-maintained package distributed separately from `pipecat-ai`:

```bash theme={null}
uv add pipecat-asterisk
```

Or use `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:

1. **An Asterisk server** with a WebSocket channel configured. The serializer
   and transport are based on the
   [Asterisk WebSocket channel](https://docs.asterisk.org/Configuration/Channel-Drivers/WebSocket/).
2. **`slin`-encoded audio**: The serializer works with `slin` audio, since
   Asterisk natively supports all flavors of `slin` and Pipecat audio frames
   must be `slin`-encoded. Transcode on the Asterisk side if you need a
   different codec.

The repository includes an example `docker-compose.yml` and Asterisk
configuration files under `examples/pipecat_asterisk/` to spin up a local
testing environment. See the
[source repository](https://github.com/NikolayShakin/pipecat-asterisk) for
details.

## Configuration

`AsteriskFrameSerializer` is constructed with a single optional parameter:

<ParamField path="sample_rate" type="int" default="0">
  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.
</ParamField>

<Note>
  This serializer does not use the Pipecat Settings dataclass pattern. See the
  [source repository](https://github.com/NikolayShakin/pipecat-asterisk) for the
  authoritative, up-to-date implementation.
</Note>

## Usage

Pass the serializer to a `FastAPIWebsocketTransport` through
`FastAPIWebsocketParams`, then build your pipeline as usual:

```python theme={null}
from fastapi import WebSocket
from pipecat.pipeline.pipeline import Pipeline
from pipecat.pipeline.task import PipelineTask
from pipecat.transports.websocket.fastapi import (
    FastAPIWebsocketTransport,
    FastAPIWebsocketParams,
)
from pipecat_asterisk import AsteriskFrameSerializer


async def run_bot(websocket: WebSocket):
    transport = FastAPIWebsocketTransport(
        websocket=websocket,
        params=FastAPIWebsocketParams(
            serializer=AsteriskFrameSerializer(),
            audio_in_enabled=True,
            audio_out_enabled=True,
        ),
    )

    pipeline = Pipeline(
        [
            transport.input(),
            # ... VAD, STT, LLM, TTS, etc.
            transport.output(),
        ]
    )

    task = PipelineTask(pipeline)
    # ... run the pipeline
```

<Tip>
  The package also ships an `AsteriskWebsocketTransport`, which wraps this
  serializer together with flow-control logic for managing buffer utilization
  between Pipecat and Asterisk. See the [source
  repository](https://github.com/NikolayShakin/pipecat-asterisk) for the full
  example.
</Tip>

## Compatibility

Tested with Pipecat v1.1.0 and Python 3.12+. Check the
[source
repository](https://github.com/NikolayShakin/pipecat-asterisk) for the latest
tested version and changelog.
