Pipecat Acefone Telephony Serializer
Host your Pipecat voice agents on the Acefone bi-directional audio streaming stack.
AcefoneFrameSerializer converts between Pipecat frames and the Acefone Media
Streams WebSocket protocol, enabling real-time, two-way audio over a single
WebSocket connection so you can serve an agent on an Indian phone number.
Maintainer: Himanshu Gunwant
Installation
pip install pipecat-acefone
Or via uv, add it to your pyproject.toml:
[project]
name = "your-project"
version = "0.1.0"
dependencies = [
"pipecat-acefone",
"another-package"
]
uv sync
Prerequisites
- An Acefone account with a phone number.
- Bi-directional audio streaming enabled on that number, pointed at your WebSocket endpoint (see the protocol docs under Protocol).
- Python 3.11+.
Usage
Construct the serializer with AcefoneFrameSerializer.InputParams and pass it to
your Pipecat WebSocket transport:
from pipecat_acefone.serializer import AcefoneFrameSerializer, AcefoneMediaFormat
from pipecat.audio.vad.silero import SileroVADAnalyzer
from pipecat.transports.websocket.fastapi import (
FastAPIWebsocketTransport,
FastAPIWebsocketParams,
)
serializer = AcefoneFrameSerializer(
AcefoneFrameSerializer.InputParams(
# Required: the Media Stream SID for the call.
stream_sid=stream_id,
# Required only when auto_hang_up is enabled.
call_sid=call_id,
# Terminate the call via a WebSocket "end" event on EndFrame/CancelFrame.
auto_hang_up=True,
# Wire format: ULAW (default, 8kHz G.711 μ-law) or PCM (16-bit slin16).
media_format=AcefoneMediaFormat.ULAW,
acefone_sample_rate=8000,
)
)
transport = FastAPIWebsocketTransport(
websocket=websocket_client,
params=FastAPIWebsocketParams(
audio_out_enabled=True,
add_wav_header=True,
vad_audio_passthrough=True,
serializer=serializer,
audio_out_sample_rate=8000,
),
)
See bot.py for a complete working example including STT/LLM/TTS
services, event handlers, and transport setup.
Configuration
All configuration is passed through AcefoneFrameSerializer.InputParams:
| Parameter | Type | Default | Description |
|---|---|---|---|
media_format |
AcefoneMediaFormat |
ULAW |
Wire audio format. ULAW = 8kHz G.711 μ-law; PCM = 16-bit linear PCM (slin16). |
acefone_sample_rate |
int |
8000 |
Sample rate used by Acefone, in Hz. |
sample_rate |
int |
0 |
Pipeline input rate override. 0 takes the rate from the StartFrame during setup. |
stream_sid |
str |
required | Media Stream SID for the call. |
call_sid |
str | None |
None |
Associated Call SID. Required when auto_hang_up is enabled. |
auto_hang_up |
bool |
False |
Emit a WebSocket end event to terminate the call on the first EndFrame/CancelFrame. |
Regardless of the wire media_format, inbound audio is normalized to PCM
InputAudioRawFrame for the pipeline, and outbound audio is converted back to the
configured wire format.
Features
- Audio streaming —
mediaevents in both directions, with automatic μ-law ⇄ PCM conversion and resampling between the pipeline andacefone_sample_rate. - Configurable wire format — 8kHz μ-law (default) or 16-bit linear PCM.
- DTMF input — inbound
dtmfevents becomeInputDTMFFramekeypad entries. - Interruptions —
InterruptionFrameemits aclearevent to flush queued audio on the provider side. - Auto hang-up — when enabled, terminates the call over the same WebSocket via
an
endevent instead of a separate REST call.
Running the Example
-
Start ngrok to tunnel the local server:
ngrok http 7860
-
Point your Acefone number's bi-directional audio streaming at your ngrok WebSocket endpoint (e.g.
wss://foo.bar.ngrok-free.dev/ws). See the Protocol docs for the dashboard/API configuration. -
Install dependencies:
uv sync -
Set up your environment:
cp .env.example .env
-
Run the bot:
uv run bot.py --transport acefone --proxy your_ngrok_url
The bot creates a WebSocket that accepts connections from your Acefone number. Once it's running, call the number to interact with the agent.
Protocol
Reference docs for the wire protocol and events:
Compatibility
- Tested with Pipecat v1.5.0
- Python 3.11+
License
BSD-2-Clause — see LICENSE.
Support
- Protocol docs: see Protocol above for message formats.
- Pipecat Discord: https://discord.gg/pipecat (
#community-integrations) - Issues: https://github.com/monster-anshu/pipecat-acefone/issues
Metadata
Release files for pipecat-acefone 0.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pipecat_acefone-0.1.3.tar.gz | 6.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pipecat_acefone-0.1.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 13.9 kB
Release files / pipecat_acefone-0.1.3.tar.gz
| Download URL | pipecat_acefone-0.1.3.tar.gz |
|---|---|
| Size | 6.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7662c62e88f37a839985b5c271e775c55017ca5f3c663d459c542339a57dcbd1
|
|
BLAKE2b-256 checksum How to use checksums |
ec72b9ce47a97abebcf08f10aa60fde4eecc961baa50ea77e5dae5bb29269aec
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / pipecat_acefone-0.1.3-py3-none-any.whl
| Download URL | pipecat_acefone-0.1.3-py3-none-any.whl |
|---|---|
| Size | 7.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5a7b7d46d9abb2b6b2f1d11571137b76c6a6e9271e702ebe57778edc09198f3e
|
|
BLAKE2b-256 checksum How to use checksums |
7c9f69d7ceeddedcf196551436f27432069633f2a0bca3e231b9bc9ed48acef7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|