DEV Community

Haider Jarral
Haider Jarral

Posted on

Giving "Hands" to AI Voice: Building a Self-Hosted, Tool-Capable Agent with Asterisk

Most AI voice platforms today are "SaaS black boxes." You send your audio to a proprietary API, pay a per-minute tax, and pray the latency stays low. As developers, we lose three things: Privacy, Visibility, and Control.

I’ve been working on the Asterisk AI Voice Agent—an open-source project designed to bring the "Home Assistant" philosophy to telephony. In my latest release, I’ve moved beyond simple "chatting" bots to create an agent that can actually do work using a tri-stage tooling architecture.

The Architecture: Why Asterisk?
For the Linux-savvy developer, the stack is straightforward but powerful:

  • Asterisk: The battle-tested telephony engine.
  • Python/Node.js Logic: Handling the bridge between audio streams and LLMs.
  • REST Webhooks: The universal language for "Skills."

By running this locally (or on your own VPS), you eliminate the per-minute SaaS cost and keep your voice data within your own network.

The New Feature: Tool-Calling (Pre, In, and Post-Call)
The real "magic" happens when the AI can interact with your existing stack. I’ve implemented three specific hooks using standard REST webhooks:

1. Pre-Call (Data Enrichment)
Before the agent even says "Hello," it performs a lookup. If the Caller ID matches a record in your CRM or database, the agent is initialized with that context.

Example: "Hi [User Name], I see your last order was [Order #]..."

2. In-Call (Real-Time Agency)
During the conversation, the LLM can decide to trigger a tool. Since these are standard REST calls, your agent can:

  • Query a live calendar.
  • Toggle a smart home device.
  • Check shipping status via an external API.

3. Post-Call (The Automation Hand-off)
Once the call ends, the agent summarizes the interaction and pushes it to an endpoint like n8n, Make, or a custom webhook. I personally use this to send call summaries directly to WhatsApp via an n8n workflow.

See the Implementation
I’ve documented the full setup and a demo of these tools in action here:

Join the Project (Open Source)
This is a project for builders. If you are tired of proprietary voice wrappers and want to contribute to a universal open-source voice AI platform, come join us.

GitHub Repo: hkjarral/Asterisk-AI-Voice-Agent

Status: Looking for contributors to help build more "Skills" and refine the core engine.

I’d love to hear your thoughts: What is the first "Skill" you would give a self-hosted voice agent? A private receptionist? A voice-activated server monitor? Let’s discuss in the comments.

Top comments (0)