Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions api-reference/server/services/community-integrations.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ Serializers convert between frames and media streams, enabling real-time communi

| Service | Repository | Maintainer(s) |
| -------------------------------- | ------------------------------------------ | ------------------------------------- |
| [Asterisk](https://www.asterisk.org/) | https://github.com/NikolayShakin/pipecat-asterisk | [Nikolai Shakin](https://github.com/NikolayShakin) |
| [AwaazAI](https://www.awaaz.ai/) | https://github.com/awaazde/pipecat-awaazai | [AwaazAI](https://github.com/awaazde) |
| [Wavix](https://wavix.com/) | https://github.com/wavix/pipecat-wavix | [Wavix](https://github.com/wavix) |

Expand Down
83 changes: 83 additions & 0 deletions pipecat/telephony/asterisk-websocket.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
---
title: "Asterisk Websocket Channel"
description: "Complete guide to Asterisk integration"
---

## Things you'll need

- Asterisk (version >= 22.8.2) installed
- Pipecat (version >= 1.1.0)
- At least configured sip profile configured both on Asteriks and your sip-devece/softphone
- API key for Gemini

## Simplest setup
- Install Docker
- Clone the [project](https://github.com/NikolayShakin/pipecat-asterisk)
- Add your API key for Germini in `.env`
- Run container with asterisk `cd examples/pipecat_asterisk && docker-compose up -d`
- Run pipecat app `uv run examples/pipecat_asterisk/ws_server.py`
- Register your sip-phone on 127.0.0.1:5060, Dial 24

## Custom setup with your Asterisk instance
### Asterisk configuration

```
extensions.conf
exten = 8,1,Dial(WebSocket/pipecat/c(slin)) ; Sampling rate 8kHz
;; Optionally
exten = 12,1,Dial(WebSocket/pipecat/c(slin12)) ; Sampling rate 8kHz
...
exten = 192,1,Dial(WebSocket/pipecat/c(slin192)) ; Sampling rate 192kHz
```

```
websocket_client.conf
[pipecat]
type = websocket_client
uri = ws://127.0.0.1:7860/ws ; Assuming pipecat running on the same host. Adjust the address if needed
protocols = media
connection_type = per_call_config
connection_timeout = 100
reconnect_interval = 50
reconnect_attempts = 3
tls_enabled = no
```
### Pipecat configuration
Create and run your pipeline using `AsteriskWebsocketTransport` like this:
```
from fastapi import FastAPI, WebSocket
from pipecat.pipeline.pipeline import Pipeline
from pipecat.pipeline.task import PipelineTask
from pipecat_asterisk import AsteriskWebsocketTransport

app = FastAPI()

@app.websocket("/ws")
async def websocket_endpoint(websocket: WebSocket):
await websocket.accept()

# Initialize the Asterisk Transport
ws_transport = AsteriskWebsocketTransport(websocket=websocket)

# Build your Pipecat pipeline
pipeline = Pipeline([
ws_transport.input(),
# ... other pipeline components (VAD, LLM, TTS, etc.)
ws_transport.output(),
])

task = PipelineTask(pipeline)

# Run the pipeline
# ...
```
`uv run your_pipeline.py`

### Dial
Configure your sip-phone to work with asterisk and dial `8` or any other configured extension if you want to test different sampling rates.


## Next Steps

- Explore the [example](https://github.com/pipecat-ai/pipecat/tree/main/examples)
- Learn about [Asterisk websocket channel](https://docs.asterisk.org/Configuration/Channel-Drivers/WebSocket/)
Loading