Project Source: github.com/GAN-007/FREEPBX-AI-
Author: George Alfred Nyamema
The most powerful, flexible open-source AI voice agent for Asterisk/FreePBX. Featuring a modular pipeline architecture that lets you mix and match STT, LLM, and TTS providers, plus 4 production-ready golden baselines validated for enterprise deployment. Now includes a Claude (Sonnet 4.5) hybrid pipeline option for teams with Anthropic access.
- π§ Complete Tool Support for Pipelines: Tool execution now works across ALL pipeline types, including
local_hybrid- All 6 tools validated and production-ready: hangup, transfer, email, transcript, voicemail, cancel
- Session history persistence for full conversation context
- Production-tested with real call flows
- π Documentation Overhaul: Completely reorganized and professional documentation structure
- New developer documentation with guides and references
- Comprehensive provider setup guides (Deepgram, OpenAI, Google)
- Technical implementation references for all providers
- π¬ Discord Community: Official Discord server integration for community support and discussions
- π Critical Bug Fixes: OpenAI Realtime tool schema, execution flow, and Pydantic compatibility issues resolved
v4.2 - Google Live API & Enhanced Setup
- π€ Google Live API: Gemini 2.0 Flash integration with multimodal capabilities
- π Interactive Setup:
agent quickstartwizard with API key validation - π Unified Transfer Tool: Single tool for extensions, queues, and ring groups
- π¬ Voicemail Integration: Leave voicemail tool with configurable routing
- π©Ί Config Validation:
agent config validatewith auto-fix capabilities
v4.1 - Tool Calling & Agent CLI
- π§ Tool Calling System: AI agents can transfer calls and send emails
- π©Ί Agent CLI Tools:
doctor,troubleshoot,demo,initcommands - π Warm Transfers: Direct SIP origination with bidirectional audio
- π§ Email Integration: Transcripts and call summaries via Resend API
- ποΈ Unified Architecture: Write tools once, use with any provider
- Asterisk-Native: Works directly with your existing Asterisk/FreePBX - no external telephony providers required
- Truly Open Source: MIT licensed with complete transparency and control
- Modular Architecture: Choose cloud, local, or hybrid - mix providers as needed
- Production-Ready: Battle-tested with validated configurations and enterprise monitoring
- Cost-Effective: Local Hybrid costs ~$0.001-0.003/minute (LLM only)
- Privacy-First: Keep audio local while using cloud intelligence
-
OpenAI Realtime (Recommended for Quick Start)
- Modern cloud AI with natural conversations
- Response time: <2 seconds
- Best for: Enterprise deployments, quick setup
-
Deepgram Voice Agent (Enterprise Cloud)
- Advanced Think stage for complex reasoning
- Response time: <3 seconds
- Best for: Deepgram ecosystem, advanced features
-
Google Live API (Multimodal AI)
- Gemini 2.0 Flash with multimodal capabilities
- Response time: <2 seconds
- Best for: Google ecosystem, advanced AI features
-
Local Hybrid (Privacy-Focused)
- Local STT/TTS + Cloud LLM (OpenAI)
- Audio stays on-premises, only text to cloud
- Response time: 3-7 seconds
- Best for: Audio privacy, cost control, compliance
- Tool Calling System: AI-powered actions (transfers, emails) work with any provider
- Agent CLI Tools:
doctor,troubleshoot,demo,initcommands for operations - Modular Pipeline System: Independent STT, LLM, and TTS provider selection
- Dual Transport Support: AudioSocket (full agents) and ExternalMedia RTP (pipelines)
- High-Performance Architecture: Separate
ai-engineandlocal-ai-servercontainers - Enterprise Monitoring: Prometheus + Grafana with 5 dashboards and 50+ metrics
- State Management: SessionStore for centralized, typed call state
- Barge-In Support: Interrupt handling with configurable gating
- Docker Deployment: Simple two-service orchestration
- Customizable: YAML configuration for greetings, personas, and behavior
Experience all four production-ready configurations with a single phone call:
Dial: (254) 736-6718
- Press 5 β Google Live API (Multimodal AI with Gemini 2.0)
- Press 6 β Deepgram Voice Agent (Enterprise cloud with Think stage)
- Press 7 β OpenAI Realtime API (Modern cloud AI, most natural)
- Press 8 β Local Hybrid Pipeline (Privacy-focused, audio stays local)
Each configuration uses the same Ava persona with full project knowledge. Compare response times, conversation quality, and naturalness across providers!
Try it out: Ask the agent to "transfer me to support" or "email me a transcript"!
Your AI agent can perform real-world telephony actions through tool calling, now validated across all pipeline types including local hybrid:
Single tool handles all transfer types:
Caller: "Transfer me to the sales team"
Agent: "I'll connect you to our sales team right away."
[Transfer to sales queue with queue music]
Caller: "I need technical support"
Agent: "Let me transfer you to technical support."
[Direct transfer to support agent extension]
Caller: "Connect me to customer service"
Agent: "I'll transfer you to our customer service ring group."
[Transfer to ring group, multiple agents ring]
Transfer Destinations:
- Extensions: Direct SIP/PJSIP endpoint transfers
- Queues: ACD queue transfers with position announcements
- Ring Groups: Multiple agents ring simultaneously
Cancel Transfer (during ring):
Agent: "Let me transfer you to support..."
Caller: "Actually, cancel that"
Agent: "No problem, I've cancelled the transfer. How can I help?"
Hangup Call (with farewell):
Caller: "That's all I needed, thanks!"
Agent: "Thank you for calling. Goodbye!"
[Call ends gracefully]
Caller: "Can I leave a voicemail for John?"
Agent: "Of course! I'll transfer you to John's voicemail."
[Routes to voicemail box, caller records message]
Automatic Call Summaries: After every call, admins receive:
- Full conversation transcript
- Call duration and metadata
- Caller information
- Professional HTML formatting
Caller-Requested Transcripts:
Caller: "Can you email me a transcript of this call?"
Agent: "I'd be happy to! What email address should I use?"
Caller: "john dot smith at gmail dot com"
Agent: "That's john.smith@gmail.com - is that correct?"
Caller: "Yes"
Agent: "Perfect! I'll send the transcript there shortly."
[Email sent with full conversation transcript]
| Tool | Description | Status |
|---|---|---|
transfer |
Transfer to extensions, queues, or ring groups | β |
cancel_transfer |
Cancel in-progress transfer (during ring) | β |
hangup_call |
End call gracefully with farewell message | β |
leave_voicemail |
Route caller to voicemail extension | β |
send_email_summary |
Auto-send call summaries to admins | β |
request_transcript |
Caller-initiated email transcripts | β |
Setup: See Tool Calling Guide for configuration.
Production-ready CLI for operations and setup:
# NEW: Interactive setup wizard
agent quickstart
# NEW: Generate dialplan snippets
agent dialplan
# NEW: Validate configuration
agent config validate --fix
# System health check
agent doctor --fix
# Analyze specific call
agent troubleshoot
# Demo features
agent demo
# Interactive setup
agent initBinary Installation (one-line):
curl -sSL https://raw.githubusercontent.com/hkjarral/Asterisk-AI-Voice-Agent/main/scripts/install-cli.sh | bashSupports Linux, macOS (Intel + Apple Silicon), and Windows. See CLI Tools Guide for complete reference.
Get up and running in 5 minutes with our new interactive wizard:
# Clone repository
git clone https://github.com/GAN-007/FREEPBX-AI-.git
cd Asterisk-AI-Voice-Agent
# Run installer (sets up Docker and offers CLI installation)
./install.sh
# After installation, run interactive setup wizard
agent quickstartThe wizard will:
- β Guide you through provider selection
- β Validate your API keys
- β Test Asterisk ARI connection
- β Generate dialplan configuration
- β Provide next steps
git clone https://github.com/GAN-007/FREEPBX-AI-.git
cd Asterisk-AI-Voice-Agent
./install.shThe installer will:
- Guide you through 3 simple configuration choices
- Prompt for required API keys (only what you need)
- Set up Docker containers automatically
- Offer CLI installation
Choose Your Configuration:
- [1] OpenAI Realtime - Fastest setup, modern AI (requires
OPENAI_API_KEY) - [2] Deepgram Voice Agent - Enterprise features (requires
DEEPGRAM_API_KEY+OPENAI_API_KEY) - [3] Local Hybrid - Privacy-focused (requires
OPENAI_API_KEY, 8GB+ RAM)
Option 1: Use the CLI helper:
agent dialplan --provider openai_realtimeOption 2: Manual configuration:
Add this to your FreePBX (Config Edit β extensions_custom.conf):
[from-ai-agent]
exten => s,1,NoOp(Asterisk AI Voice Agent v4.3)
same => n,Stasis(asterisk-ai-voice-agent)
same => n,Hangup()
Then create a Custom Destination pointing to from-ai-agent,s,1 and route calls to it.
Make a call to your configured destination and have a conversation!
Health check:
agent doctorView logs:
docker compose logs -f ai-engineThat's it! Your AI voice agent is ready. π
For detailed setup, see CLI Tools Guide or FreePBX Integration Guide
config/ai-agent.yaml- Golden baseline configs.env- Secrets and API keys (git-ignored)
The installer handles everything automatically. To customize:
Change greeting or persona:
Edit config/ai-agent.yaml:
llm:
initial_greeting: "Your custom greeting"
prompt: "Your custom AI persona"Add/change API keys:
Edit .env:
OPENAI_API_KEY=sk-your-key-here
DEEPGRAM_API_KEY=your-key-here
ASTERISK_ARI_USERNAME=asterisk
ASTERISK_ARI_PASSWORD=your-passwordSwitch configurations:
# Copy a different golden baseline
cp config/ai-agent.golden-deepgram.yaml config/ai-agent.yaml
docker compose up -d --force-recreate ai-engineIf you enabled monitoring during installation, you have Prometheus + Grafana running:
Access Grafana:
http://your-server-ip:3000
Username: admin
Password: admin (change after first login)
If you didn't enable monitoring during install, you can start it anytime:
docker compose -f docker-compose.monitoring.yml up -dStop monitoring:
docker compose -f docker-compose.monitoring.yml downNote: Monitoring is completely optional. The AI agent works without it. See monitoring/README.md for dashboards, alerts, and metrics.
For advanced tuning, see:
- docs/Configuration-Reference.md - Complete reference
- docs/Transport-Mode-Compatibility.md - Transport modes
Two-container architecture for performance and scalability:
ai-engine (Lightweight orchestrator)
- Connects to Asterisk via ARI
- Manages call lifecycle
- Routes audio to/from AI providers
- Handles state management
local-ai-server (Optional, for Local Hybrid)
- Runs local STT/TTS models
- Vosk (speech-to-text)
- Piper (text-to-speech)
- WebSocket interface
βββββββββββββββββββ βββββββββββββ βββββββββββββββββββββ
β Asterisk Server βββββββΆβ ai-engine βββββββΆβ AI Provider β
β (ARI, RTP) β β (Docker) β β (Cloud or Local) β
βββββββββββββββββββ βββββββββββββ βββββββββββββββββββββ
β β²
β WS β (Local Hybrid only)
βΌ β
βββββββββββββββββββ
β local-ai-server β
β (Docker) β
βββββββββββββββββββ
Key Design Principles:
- Separation of concerns - AI processing isolated from call handling
- Modular pipelines - Mix and match STT, LLM, TTS providers
- Transport flexibility - AudioSocket (legacy) or ExternalMedia RTP (modern)
- Enterprise-ready - Monitoring, observability, production-hardened
For Cloud Configurations (OpenAI Realtime, Deepgram):
- CPU: 2+ cores
- RAM: 4GB
- Disk: 1GB
- Network: Stable internet connection
For Local Hybrid (Local STT/TTS + Cloud LLM):
- CPU: 4+ cores (modern 2020+)
- RAM: 8GB+ recommended
- Disk: 2GB (models + workspace)
- Network: Stable internet for LLM API
- Docker + Docker Compose
- Asterisk 18+ with ARI enabled
- FreePBX (recommended) or vanilla Asterisk
| Configuration | Required Keys |
|---|---|
| OpenAI Realtime | OPENAI_API_KEY |
| Deepgram Voice Agent | DEEPGRAM_API_KEY + OPENAI_API_KEY |
| Local Hybrid | OPENAI_API_KEY |
| Claude Hybrid | CLAUDE_API_KEY + local STT/TTS |
- Activate env & setup (auto-activates venv if present):
./setup.sh openai --pipeline=claude_hybrid --run-install --run-quickstart --run-engine - Fill
.envwith your keys:CLAUDE_API_KEY(for Claude Sonnet 4.5), plusOPENAI_API_KEY/DEEPGRAM_API_KEY/GOOGLE_API_KEYas needed. - Health check:
http://127.0.0.1:15000/health(metrics at/metrics). Logs:logs/engine.log. - Switch pipelines/providers per call via dialplan vars (
AI_PROVIDER/AI_CONTEXT) or setactive_pipelineinconfig/ai-agent.yaml.
- FreePBX Integration Guide - Complete setup with dialplan examples
- Installation Guide - Detailed installation and deployment
- Configuration Reference - All YAML settings explained
- Transport Compatibility - AudioSocket vs ExternalMedia RTP
- Tuning Recipes - Performance optimization guide
- Monitoring Guide - Prometheus + Grafana dashboards (coming soon)
- Production Deployment - Production best practices (coming soon)
- Hardware Requirements - System specs and sizing (coming soon)
- Developer Documentation - Complete developer guide and index
- Architecture Overview - 10-minute system overview
- Architecture Deep Dive - Complete technical architecture
- Common Pitfalls - Production issues and solutions
- Contributing Guide - How to contribute
- Changelog - Release history and changes
Contributions are welcome! Please see our Contributing Guide for more details on how to get involved.
If you want to contribute features (providers, tools, pipelines) or run the project in a development setup, start with:
- Developer Quickstart β 15-minute dev environment setup
- Developer Documentation β Complete developer guide and index
AVA.mdcβ AVA, the project manager persona, for guidance via your AI-powered IDE
Have questions or want to chat with other users? Join our community:
- Discord Server - Community support and discussions
- GitHub Issues - Bug reports and feature requests
- GitHub Discussions - General discussions
This project is licensed under the MIT License. See the LICENSE file for details.
If you find this project useful, please give it a βοΈ on GitHub! It helps us gain visibility and encourages more people to contribute.