---
title: "FreeSWITCH for Self-Hosted AI Receptionists: 2026 Architecture"
description: "How to bridge FreeSWITCH to an AI agent using mod_audio_fork, mod_unimrcp, or a SignalWire AI Agent connect, with concrete dialplan examples."
canonical: https://callsphere.ai/blog/vw1d-freeswitch-self-hosted-ai-receptionist-2026
category: "AI Engineering"
tags: ["VoIP", "SIP", "FreeSWITCH", "Telephony", "AI Voice Agents"]
author: "CallSphere Team"
published: 2026-03-26T00:00:00.000Z
updated: 2026-05-07T09:32:10.904Z
---

# FreeSWITCH for Self-Hosted AI Receptionists: 2026 Architecture

> How to bridge FreeSWITCH to an AI agent using mod_audio_fork, mod_unimrcp, or a SignalWire AI Agent connect, with concrete dialplan examples.

> FreeSWITCH remains the open-source choice for teams who want full control of their telephony stack. In 2026 the cleanest AI integration paths are mod_audio_fork to a model proxy, a SignalWire AI Agent bridge, or a direct dial to an OpenAI SIP URI.

## Background: FreeSWITCH in 2026

```mermaid
flowchart LR
  Phone["PSTN caller"] --> Carrier["Carrier"]
  Carrier -- "SIP INVITE" --> SBC["Session Border Controller"]
  SBC -- "SIP" --> PBX["Twilio / Asterisk"]
  PBX -- "RTP · Opus" --> Bridge["AI Voice Gateway"]
  Bridge --> AI["OpenAI Realtime"]
  AI --> Bridge
  Bridge --> PBX
```

CallSphere reference architecture

FreeSWITCH was created by the same team that now runs SignalWire, and the project still has the most flexible scripting and call-routing model of any open-source PBX. It excels at edge cases: media transcoding, large-scale conferencing, custom dialplans, and complex SIP topologies. Asterisk wins on community size; FreeSWITCH wins on the kind of workloads where you need surgical control of audio.

For AI agents in 2026, FreeSWITCH offers three viable patterns:

1. **mod_audio_fork** — fork RTP audio to a WebSocket server which proxies to your AI model.
2. **SignalWire AI Agent bridge** — let SignalWire's hosted AI Agent take over the call after a dialplan handoff.
3. **Direct SIP dial to AI** — bridge the leg straight to OpenAI Realtime's SIP endpoint or to a CallSphere SIP URI on Twilio.

## How VoIP and SIP work for this use case

A call arrives on a FreeSWITCH SIP profile (typically external on UDP 5080 or TLS 5081). The dialplan matches the destination and routes through XML or Lua. For AI handoff, the simplest pattern is `bridge` to a SIP URI that terminates on the AI. For finer control, fork audio out to a WebSocket and run the model on your own infrastructure. mod_audio_fork sends 16-bit linear PCM at 8 or 16 kHz over a websocket, including dialog metadata in the first frame.

## CallSphere implementation

CallSphere is Twilio-first end-to-end, and the supported pattern for FreeSWITCH customers is the same as for Asterisk customers: the FreeSWITCH dialplan bridges out to a CallSphere-provided SIP URI, which terminates on Twilio Elastic SIP Trunking and bridges to OpenAI Realtime. CallSphere's 37 agents across 90+ tools and 115+ database tables work the same whether the call originates on FreeSWITCH, Asterisk, or directly on a Twilio number. HIPAA and SOC 2 controls apply to all paths. Pricing remains $149, $499, and $1499 for 1, 3, and 10 numbers, with a 14-day trial and a 22% affiliate. The Healthcare AI receptionist on FastAPI :8084, the Sales Calling AI with five concurrent outbound, and the After-Hours AI with simultaneous call plus SMS and 120 second timeout all behave identically regardless of front-end PBX.

## Build and integration steps

1. Install FreeSWITCH 1.10+ with mod_audio_fork and mod_sofia enabled.
2. Provision a SIP profile bound to your carrier on the external interface.
3. Decide on integration pattern: audio_fork to your own AI proxy, or SIP dial to a managed AI endpoint.
4. For audio_fork: set up a WebSocket server that bridges to OpenAI Realtime, ElevenLabs, or your model of choice.
5. For SIP dial: configure a gateway to OpenAI's SIP URI or to a managed provider's SIP URI.
6. Update the dialplan to match destination numbers and route them to the AI.
7. Add CDR logging and a fallback action for AI service unavailability (route to voicemail or human).
8. Smoke test interruption handling, music-on-hold, and graceful hangup.

## Code or config snippet

```xml

```

## FAQ

**Why pick FreeSWITCH over Asterisk for AI?**
Pick FreeSWITCH if you need fine-grained media control, large conferencing, or you already have FreeSWITCH expertise. Otherwise Asterisk's larger community is usually the safer default.

**Does mod_audio_fork affect call quality?**
Forking audio adds a WebSocket hop. Run the proxy in the same data center as FreeSWITCH and the added latency is under 5 ms.

**Can I run FreeSWITCH and Twilio in the same architecture?**
Yes. Many CallSphere customers run FreeSWITCH as their internal PBX and bridge out to Twilio for the AI agent leg.

**Is SignalWire's AI Agent a drop-in replacement for building it yourself?**
For many use cases, yes. It is hosted, opinionated, and works with any FreeSWITCH dialplan via a single bridge action.

**What about high-availability?**
Run two FreeSWITCH nodes behind a Kamailio dispatcher with shared registrar; bridge to two AI termination URIs and fail over on 5xx responses.

## Sources

- [SignalWire: Add AI Capabilities to Your FreeSWITCH](https://signalwire.com/blogs/developers/add-ai-to-freeswitch)
- [SignalWire Developer: Adding AI capabilities to FreeSWITCH](https://developer.signalwire.com/platform/integrations/freeswitch/add-ai-to-freeswitch/)
- [Cyberpunk Tools: Add AI Voice Agent to FreeSWITCH in 30 Minutes](https://www.cyberpunk.tools/jekyll/update/2025/11/18/add-ai-voice-agent-to-freeswitch.html)
- [Samcom Technologies: Asterisk vs FreeSWITCH in 2026](https://www.samcomtechnologies.com/blog/asterisk-vs-freeswitch-in-2026-which-voip-platform-should-you-choose)

Start a [14-day trial](/trial), book a [demo](/demo), or read more about the [Twilio integration](/integrations/twilio).

---

Source: https://callsphere.ai/blog/vw1d-freeswitch-self-hosted-ai-receptionist-2026
