Voice AI & Telephony Integration
Phone calls, connected to your backend and your AI
I connect phone systems to Python backends and AI. That means Twilio Voice API integrations, Asterisk PBX and SIP trunk setups, real-time call events and audio over ASGI WebSockets, text-to-speech, and the usage-based billing that voice products usually need.
What you get
- Calls that reach your application logic in real time
- Voice features built on the same backend, auth and billing as the rest of your product
- Usage measured accurately for per-minute or per-call pricing
- A path from simple call flows to AI voice agents
Where voice meets the backend
Voice products combine three things that rarely live together: telephony, real-time networking and AI. A call arrives through a carrier or a SIP trunk, events and audio stream into your backend, and your application, increasingly an AI agent, has to respond while the caller waits.
My telephony experience comes from building an AI and backend platform that combined the Twilio Voice API, Asterisk PBX and SIP trunk integrations with ASGI and WebSocket systems, Celery and Redis background processing, LangChain and LangGraph agent workflows, and Stripe subscription and usage-based billing. I have also built text-to-speech (TTS) integrations into Django applications.
Typical projects
- Inbound call flows that route, record or hand off to your application
- Outbound calling triggered by events in your product
- AI voice agents that look up and update data through safe tools
- Usage-based pricing for minutes or calls, reported to Stripe
How I work
- 01
Choose the telephony layer
Hosted APIs like Twilio, a self-managed Asterisk PBX with SIP trunks, or both. The choice depends on cost, control and the call flows you need.
- 02
Stream events into the backend
Call events and media are handled by ASGI WebSocket services so the backend can react while the call is live.
- 03
Add speech and intelligence
TTS and agent workflows are layered on top, with latency treated as a first-class requirement.
- 04
Meter and bill
Usage is recorded per call and reported for billing without double-counting.
Typical deliverables
- Twilio Voice API integration (inbound and outbound call flows)
- Asterisk PBX configuration and SIP trunk integration
- ASGI and WebSocket services for real-time call events and media
- Text-to-speech (TTS) integration
- Agent workflows connected to calls using LangGraph
- Call usage metering and usage-based billing with Stripe
Frequently asked questions
Twilio or Asterisk, which should I use?
Twilio is the fastest way to build programmable voice, with a managed API, global numbers and no telephony servers to run. Asterisk gives you a self-hosted PBX with full control and potentially lower per-minute costs over SIP trunks, at the price of operating it yourself. Some products use both.
Why do voice integrations need WebSockets?
Calls are live. Media streams and call events arrive continuously, and the application often has to respond within milliseconds. An ASGI WebSocket service keeps a persistent connection open for that, which request-response HTTP cannot do efficiently.
Can an AI agent answer phone calls?
Yes. Speech is converted to text, the agent decides what to do, and text-to-speech answers the caller. The engineering challenges are latency, interruptions and connecting the agent's tools safely to your systems.