Hi All,
I started a new asterisk transport + serializer for pipecat (Open source framework for voice and multimodal conversational AI.)
It’s not finished, but it works with chan_websocket
you can find it here: https://github.com/Mickaelh51/pipecat/commit/49e16786a22004e6a03e95fccf2ccc7b1a66c8ab
# Test
## Example script
Use pipcat/examples/foundational/49-asterisk-transport.py
:warning: To test we use own STT, but it's not yet intagrated to pipcat (but soon :smiley: )
# Docker compose with asterisk
```
networks:
asterisk:
driver: bridge
ipam:
config:
- subnet: 172.38.0.0/16
services:
asterisk_json:
image: andrius/asterisk:git_debian-trixie
container_name: asterisk-voicebot-json
ports:
- "5090:5060/udp"
volumes:
- ./extensions.conf:/etc/asterisk/extensions.conf
- ./modules.conf:/etc/asterisk/modules.conf
- ./pjsip.conf:/etc/asterisk/pjsip.conf
- ./res_parking.conf:/etc/asterisk/res_parking.conf
- ./ari.conf:/etc/asterisk/ari.conf
- ./websocket_client.conf:/etc/asterisk/websocket_client.conf
- ./extensions.ael:/etc/asterisk/extensions.ael
- ./docker_data/asterisk_records/:/var/spool/asterisk/monitor/
restart: always
networks:
asterisk:
ipv4_address: 172.38.0.7
asterisk_pain_text:
image: andrius/asterisk:latest
container_name: asterisk-voicebot-pain-text
ports:
- "5091:5060/udp"
volumes:
- ./extensions.conf:/etc/asterisk/extensions.conf
- ./modules.conf:/etc/asterisk/modules.conf
- ./pjsip.conf:/etc/asterisk/pjsip.conf
- ./res_parking.conf:/etc/asterisk/res_parking.conf
- ./ari.conf:/etc/asterisk/ari.conf
- ./websocket_client.conf:/etc/asterisk/websocket_client.conf
- ./extensions.ael:/etc/asterisk/extensions.ael
- ./docker_data/asterisk_records/:/var/spool/asterisk/monitor/
restart: always
networks:
asterisk:
ipv4_address: 172.38.0.9
```
## Configuration files
### websocket_client.conf
```
[media_connection_pipecat_fastapi]
type = websocket_client
uri = ws://172.38.0.1:7860/media
protocols = media
username = medianame
password = mediapassword
connection_type = per_call_config
connection_timeout = 1000
reconnect_interval = 1000
reconnect_attempts = 5
tls_enabled = no
```
### extensions.conf
```
[globals]
[general]
[default]
; For mow_echo_test_server
exten = 127,1,NoOp(Echo test)
same = n,Answer()
same = n,Echo()
; Test without stasis and use pipcat
exten = 131,1,Answer()
same = n,Dial(WebSocket/media_connection_pipecat_fastapi/c(slin16)f(json))
```
## Calls
- To send json `MEDIA_START` call sip:131@localhost:5090
- To send plain text `MEDIA_START` call sip:131@localhost:5091