一个 SIP/WebRTC 语音代理
active-call is a standalone Rust crate for building AI Voice Agents. It provides high-performance infrastructure bridging AI models with real-world telephony and web communications.
Documentation → English | 中文 | API Reference
Define personas, scenes, and flows in Markdown files with rich config:
…${VAR} = environment variables (config-time). {{var}} = runtime variables (per-call).{{ session_id }}, {{ call_type }}, {{ caller }}, {{ callee }}, {{ start_time }}{{ sip["X-Header-Name"] }}{{ var }}.and extend LLM capabilities at runtime.Run ASR and TTS locally — no cloud API required:
# Download models
docker run --rm -v $(pwd)/data/models:/models \
ghcr.io/miuda-ai/active-call:latest \
--download-models all --models-dir /models --exit-after-download
# Run with offline models
docker run -d --net host \
-v $(pwd)/data/models:/app/models \
-v $(pwd)/config:/app/config \
ghcr.io/miuda-ai/active-call:latestMainland China: Add
-e HF_ENDPOINT=https://hf-mirror.comto use the HuggingFace mirror.
| VAD Engine | Time (60s audio) | RTF | Note |
|---|---|---|---|
| TinySilero | ~60 ms | 0.0010 | >2.5× faster ONNX |
| ONNX Silero | ~158 ms | 0.0026 | Standard baseline |
| WebRTC VAD | ~3 ms | 0.00005 | Legacy |
Codec support: PCM16, G.711 (PCMU/PCMA), G.722, Opus.
| Feature | Description |
|---|---|
| Denoise | nnnoiseless-based real-time noise reduction |
| AGC | WebRTC AGC2 adaptive gain control |
| Ambiance | Background audio mixing with ducking |
| Interruption | Configurable VAD/ASR/None strategy + fade-out |
# Webhook handler
./active-call --handler https://example.com/webhook
# Playbook handler
./active-call --handler config/playbook/greeting.md
# Outbound SIP call
./active-call --call sip:[email protected]:5060 --handler greeting.md
# With external IP and codecs
./active-call --handler default.md --external-ip 1.2.3.4 --codecs pcmu,pcma,opusdocker run -d --net host \
--name active-call \
-v $(pwd)/config.toml:/app/config.toml:ro \
-v $(pwd)/config:/app/config \
ghcr.io/miuda-ai/active-call:latest[handler]
type = "playbook"
default = "greeting.md"
[[handler.rules]]
caller = "^\\+1\\d{10}$"
callee = "^sip:support@.*"
playbook = "support.md"
[[handler.rules]]
caller = "^\\+86\\d+"
playbook = "chinese.md"tls_port = 5061
tls_cert_file = "./certs/cert.pem"
tls_key_file = "./certs/key.pem"
enable_srtp = true| Feature | Cargo flag | Description |
|---|---|---|
| offline (default) | --features offline |
SenseVoice ASR + Supertonic TTS |
| cross | --features cross |
offline + AWS-LC bindgen (cross-compile) |
| ringback-detection | --features ringback-detection |
Ringback tone detection |
| opus | --features opus |
Opus codec support |
| not_vad | --no-default-features |
Exclude VAD (for external VAD) |
cargo build --release
cargo build --release --features ringback-detection,opus# rustc may require extra stack when compiling certain crates
export RUST_MIN_STACK=16777216
cargo build --releaseOr add to your shell profile:
echo 'export RUST_MIN_STACK=16777216' >> ~/.bashrc# OpenAI / Azure
OPENAI_API_KEY=sk-...
AZURE_OPENAI_API_KEY=...
AZURE_OPENAI_ENDPOINT=https://your-resource.openai.azure.com/
# Aliyun DashScope
DASHSCOPE_API_KEY=sk-...
# Tencent Cloud
TENCENT_APPID=...
TENCENT_SECRET_ID=...
TENCENT_SECRET_KEY=...
# Deepgram
DEEPGRAM_API_KEY=...
# Offline models
OFFLINE_MODELS_DIR=/path/to/models| Method | Path | Description |
|---|---|---|
| GET | /call |
WebSocket call handler |
| GET | /call/webrtc |
WebRTC call handler |
| GET | /call/sip |
SIP call handler |
| GET | /list |
List all active calls |
| GET | /kill/{id} |
Force-terminate an active call |
| GET | /events/{id} |
SSE event stream for a call |
| POST | /command/{id} |
Send command to an active call |
| POST | /precache |
Pre-generate TTS audio to cache |
| GET | /iceservers |
ICE server configuration for WebRTC |
| GET | /api/playbooks |
List available playbooks |
| GET | /api/playbooks/{name} |
Get playbook content |
| POST | /api/playbooks/{name} |
Save/update a playbook |
| POST | /api/playbook/run |
Associate a playbook with a new session |
| GET | /api/records |
List call event records |
| GET | / |
Serve built-in web client |
Full command/event reference → API Documentation
| Language | Links |
|---|---|
| English | Docs Hub · API Reference · Config Guide · Playbook Tutorial · Advanced Features |
| 中文 | 文档中心 · API 文档 · 配置指南 · Playbook 教程 · 高级特性 |
MIT — see LICENSE
暂无开放 Issues,或尚未同步最近议题。