Dev.to
7/16/2026

AI Agent Answers the Phone and Hands You to a Real Person
Short summary
A detailed engineering walkthrough of building a voice AI phone agent using FreeSWITCH and a custom middleware layer. The middleware handles secrets, action execution, and call control between the phone system and the AI voice model. Key technical challenges include audio buffering (feeding the phone line in 20ms frames to match its rhythm), audio format down-conversion, and interruption handling for natural conversation flow. The new voice-in/voice-out models eliminate the STT-TTS relay, gaining speed and multilingual support for free.
- •Middleware architecture: FreeSWITCH phone server + custom code + voice AI model
- •Audio buffering at 20ms intervals is critical for natural-sounding phone AI
- •End-to-end voice models eliminate STT-TTS relay, enabling faster responses and automatic multilingual support
Generated with AI, which can make mistakes.
Is this a good recommendation for you?



