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.
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 in your browser — 60 seconds, no signup.
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 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.
<!-- 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>
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.
CallSphere ships complete AI voice agents per industry — 14 tools for healthcare, 10 agents for real estate, 4 specialists for salons. See how it actually handles a call before you book a demo.
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.
Start a 14-day trial, book a demo, or read more about the Twilio integration.
Written by
Sagar Shankaran· Founder, CallSphere
Sagar 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.
See how AI voice agents work for your industry. Live demo available -- no signup required.
An honest 2026 guide to VoIP desk phones. Hardware vs softphone, top picks, when an internet phone is worth it, and where AI voice agents fit.
The best business phone app in 2026 is the one with an AI agent attached. Compare options, costs, and what an AI phone app actually does for a small business.
A founder's guide to business phone systems in 2026. Cloud vs on-prem, AI voice agents, small business pricing, and what actually works for under 100 seats.
The 2024 NPRM proposes mandatory penetration tests every 12 months and vulnerability scans every 6 months. Here is how an AI voice agent should be tested in 2026.
AWS HealthScribe became the open scribe layer EHR vendors built on top of in 2026. Here's the API surface, the per-encounter pricing, the BAA terms.
Why Claude salon AI is reshaping voice and chat automation, with concrete patterns for appointment AI in production deployments. A field-tested view from production teams shippi...
© 2026 CallSphere LLC. All rights reserved.