Skip to content

hkjarral/Asterisk-AI-Voice-Agent

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Asterisk AI Voice Agent v4.0

Version License Python Docker Asterisk

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 3 production-ready golden baselines validated for enterprise deployment.

πŸŽ‰ What's New in v4.0

  • πŸ—οΈ Modular Pipeline Architecture: Mix and match STT, LLM, and TTS providers independently
  • βœ… 3 Golden Baselines: Production-validated configurations ready to deploy
  • πŸ”’ Privacy-Focused Options: Local Hybrid keeps audio processing on-premises
  • ⚑ Simplified Setup: 3 clear configuration choices (down from 6)
  • πŸ“Š Enterprise Monitoring: Prometheus + Grafana out of the box
  • πŸš€ ExternalMedia RTP: Modern, reliable audio transport for pipelines
  • 🎯 Validated Performance: Every config tested in production

🌟 Why Asterisk AI Voice Agent?

  • 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

✨ Features

3 Golden Baseline Configurations

  1. OpenAI Realtime (Recommended for Quick Start)

    • Modern cloud AI with natural conversations
    • Response time: <2 seconds
    • Best for: Enterprise deployments, quick setup
  2. Deepgram Voice Agent (Enterprise Cloud)

    • Advanced Think stage for complex reasoning
    • Response time: <3 seconds
    • Best for: Deepgram ecosystem, advanced features
  3. 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

Technical Features

  • Modular Pipeline System: Independent STT, LLM, and TTS provider selection
  • Dual Transport Support: AudioSocket (legacy) and ExternalMedia RTP (modern)
  • High-Performance Architecture: Separate ai-engine and local-ai-server containers
  • 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

πŸŽ₯ Demo

Watch the demo

πŸ“ž Try it Live! (US Only)

Experience all three golden baseline configurations with a single phone call:

Dial: (925) 736-6718

  • 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!

Demo Monitoring Dashboards: https://demo.jugaar.llc User:Pass = demo/demo

πŸš€ Quick Start

Get up and running in 5 minutes:

1. Clone and Install

git clone https://github.com/hkjarral/Asterisk-AI-Voice-Agent.git
cd Asterisk-AI-Voice-Agent
./install.sh

The installer will:

  • Guide you through 3 simple configuration choices
  • Prompt for required API keys (only what you need)
  • Set up Docker containers automatically
  • Configure Asterisk integration

2. Choose Your Configuration

When prompted, select one of the 3 golden baselines:

  • [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)

The installer automatically starts the correct services for your choice.

3. Configure Asterisk Dialplan

Add this to your FreePBX (Config Edit β†’ extensions_custom.conf):

[from-ai-agent]
exten => s,1,NoOp(Asterisk AI Voice Agent v4.0)
 same => n,Stasis(asterisk-ai-voice-agent)
 same => n,Hangup()

That's it! Without any variables, the system uses local_hybrid by default.

Then create a Custom Destination pointing to from-ai-agent,s,1 and route calls to it.

4. Test Your Agent

Make a call to your configured destination and have a conversation!

Verify health (optional):

curl http://127.0.0.1:15000/health

View logs:

docker compose logs -f ai-engine

That's it! Your AI voice agent is ready. πŸŽ‰

For detailed setup, see docs/FreePBX-Integration-Guide.md

βš™οΈ Configuration

Two-File Configuration

  • config/ai-agent.yaml - Golden baseline configs (safe to commit)
  • .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-password

Switch configurations:

# Copy a different golden baseline
cp config/ai-agent.golden-deepgram.yaml config/ai-agent.yaml
docker compose up -d --force-recreate ai-engine

Optional: Enterprise Monitoring

If 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 -d

Stop monitoring:

docker compose -f docker-compose.monitoring.yml down

Note: Monitoring is completely optional. The AI agent works without it. See monitoring/README.md for dashboards, alerts, and metrics.

For advanced tuning, see:

πŸ—οΈ Project Architecture

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

πŸ“Š Requirements

Minimum System Requirements

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

Software Requirements

  • Docker + Docker Compose
  • Asterisk 18+ with ARI enabled
  • FreePBX (recommended) or vanilla Asterisk

API Keys Required

Configuration Required Keys
OpenAI Realtime OPENAI_API_KEY
Deepgram Voice Agent DEEPGRAM_API_KEY + OPENAI_API_KEY
Local Hybrid OPENAI_API_KEY

πŸ—ΊοΈ Documentation

Getting Started

Configuration

Operations

Development

🀝 Contributing

Contributions are welcome! Please see our Contributing Guide for more details on how to get involved.

πŸ’¬ Community

Have questions or want to chat with other users? Join our community:

πŸ“ License

This project is licensed under the MIT License. See the LICENSE file for details.

πŸ™ Show Your Support

If you find this project useful, please give it a ⭐️ on GitHub! It helps us gain visibility and encourages more people to contribute.

About

An open-source AI Voice Agent that integrates with Asterisk/FreePBX using Audiosocket/RTP technology

Resources

License

Contributing

Stars

Watchers

Forks

Packages

No packages published