FreeSWITCH for Self-Hosted AI Receptionists: 2026 Architecture
By Sagar Shankaran, Founder of CallSphere
How to bridge FreeSWITCH to an AI agent using mod_audio_fork, mod_unimrcp, or a SignalWire AI Agent connect, with concrete dialplan examples.
Key takeaways
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
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 --> PBXFreeSWITCH 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:
Hear it before you finish reading
Talk to a live CallSphere AI voice agent for home services in your browser — 60 seconds, no signup.
- mod_audio_fork — fork RTP audio to a WebSocket server which proxies to your AI model.
- SignalWire AI Agent bridge — let SignalWire's hosted AI Agent take over the call after a dialplan handoff.
- 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
Explore a live demo and compare current plans to find the right fit for your business.
Build and integration steps
- Install FreeSWITCH 1.10+ with mod_audio_fork and mod_sofia enabled.
- Provision a SIP profile bound to your carrier on the external interface.
- Decide on integration pattern: audio_fork to your own AI proxy, or SIP dial to a managed AI endpoint.
- For audio_fork: set up a WebSocket server that bridges to OpenAI Realtime, ElevenLabs, or your model of choice.
- For SIP dial: configure a gateway to OpenAI's SIP URI or to a managed provider's SIP URI.
- Update the dialplan to match destination numbers and route them to the AI.
- Add CDR logging and a fallback action for AI service unavailability (route to voicemail or human).
- Smoke test interruption handling, music-on-hold, and graceful hangup.
Code or config snippet
<!-- FreeSWITCH dialplan: bridge inbound to a managed AI SIP URI -->
<extension name="ai_receptionist">
<condition field="destination_number" expression="^(15555550100)$">
<action application="set" data="hangup_after_bridge=true"/>
<action application="set" data="continue_on_fail=true"/>
<action application="set" data="effective_caller_id_name=CallSphere AI"/>
<action application="bridge"
data="sofia/external/agent@sip.callsphere.ai;transport=tls"/>
<action application="answer"/>
<action application="playback" data="ivr/ivr-call_cannot_be_completed.wav"/>
<action application="hangup"/>
</condition>
</extension>
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.
Still reading? Stop comparing — try CallSphere live.
See the home services AI agent handle a real call — complete, industry-specific, and live in your browser. No signup.
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
- SignalWire Developer: Adding AI capabilities to FreeSWITCH
- Cyberpunk Tools: Add AI Voice Agent to FreeSWITCH in 30 Minutes
- Samcom Technologies: Asterisk vs FreeSWITCH in 2026
Explore a live demo and compare current plans to find the right fit for your business.

Written by
Sagar Shankaran· Founder, CallSphere
LinkedInSagar Shankaran is the founder of CallSphere, where he builds production AI voice and chat agents deployed across healthcare, hospitality, real estate, and home services. He writes about agentic AI, LLM engineering, and shipping voice agents that handle real calls in production.
Try CallSphere AI Voice Agents
See how AI voice agents work for your industry. Live demo available -- no signup required.