CodePrism Technologies logoCodePrism Technologies
Case Study — Voice AI & Telephony

Replacing Exotel with a Self-Hosted Voice AI Gateway — 60% Cost Reduction at 500K Calls/Day

A production-grade telephony gateway that bridges PSTN networks with AI voice applications, enabling a large social-impact foundation to cut per-minute call costs by 60% while handling half a million calls daily — with zero changes to existing AI application code.

PlatformOn-Premises / Cloud (DigitalOcean + Azure)
Duration4 Months
TypeVoice AI & Telephony
Stack12 technologies
PROJECT OVERVIEW

60%

Cost reduction

500K

Calls/day capacity

<200ms

One-way audio latency

THE CHALLENGE

WhatsApp messaging gets complicated at scale.

A large social-impact foundation running AI-powered voice surveys across India was spending over Rs 10 million per month on Exotel Voicebot at Rs 0.50 per minute. Migrating away from Exotel seemed impossible because the AI applications were tightly integrated with Exotel’s proprietary WebSocket protocol. Additionally, the cheaper BSNL SIP trunk required a Pritunl VPN that blocked the gateway’s outbound internet access — creating an impossible networking constraint.

Challenge 1

Exotel vendor lock-in at Rs 0.50/min — 60% higher than direct BSNL trunk rates

Challenge 2

AI applications hardcoded to Exotel’s WebSocket protocol — migration would require rewriting every voice bot

Challenge 3

BSNL SIP trunk requires Pritunl VPN which blocks internet access — the gateway cannot reach AI apps

Challenge 4

Need to scale from 100K to 500K calls/day (3,000–6,000 concurrent) with high availability

Challenge 5

Real-time audio quality requirements: <200ms latency, <1% packet loss across the bridge

Measurable Impact
60%Cost reduction (Rs 0.50 to Rs 0.20/min)
0AI application code changes required
<200msOne-way audio latency achieved
500KDaily call capacity (design target)
<1%Packet loss rate
$400/moInfrastructure cost vs Rs 10M/mo Exotel
WHAT WE LEARNED
01

Protocol-level compatibility eliminates migration friction — the AI apps never knew they switched providers

02

Network constraints (VPN conflicts) can be solved architecturally by separating concerns across servers

03

Custom audio codecs outperform generic libraries when latency budgets are tight (<200ms)

04

Pluggable provider interfaces prevent future lock-in — switching trunks is now a config change, not a code change

Technologies Background
Our Technologies

Built with technologies we trust.

NestJS
Asterisk PBX
PJSIP
TypeScript
PostgreSQL
Redis
BullMQ
WebSockets
RTP/UDP
Docker
PM2
Prometheus

Project Goals

Build a drop-in Exotel replacement with 100% WebSocket protocol compatibility
Connect directly to BSNL SIP trunks at Rs 0.20/min — cutting costs by 60%
Solve the VPN networking constraint without compromising security or reliability
Achieve sub-200ms audio latency for natural AI voice conversations
Design for 500K calls/day with horizontal scaling and zero single points of failure

The Outcome

Replaced Exotel Voicebot with a self-hosted Asterisk-based gateway that connects directly to BSNL SIP trunks. Achieved 60% cost reduction (from Rs 0.50 to Rs 0.20 per minute), 100% Exotel WebSocket protocol compatibility with zero AI code changes, and a distributed architecture that handles the BSNL VPN constraint.

Conclusion & Impact

"This project proved that enterprise telephony vendor lock-in is solvable with precise protocol engineering. By replicating Exotel’s exact WebSocket format, we eliminated the migration barrier entirely. The distributed architecture — born from a real-world VPN constraint — became a strength: it enables independent scaling of the media gateway and PBX layers."

Have a project in mind?

Let's discuss how we can help you build your next big thing.
Reach out and our team will be in touch.

Protected by reCAPTCHA. Google Privacy & Terms apply.

Building systems that hold up in production.

Bring up the problem others won't attempt.