Real-Time AI Phone Agent
A bilingual AI phone agent for real-time conversations, built with Twilio Media Streams, Google Gemini Live, and Cloud Run. It streams full-duplex audio, captures leads, and supports SIP phone transfers.
Try Live Voice AI in Browser
Voice powered by Gemini Live
Twilio Telephony & Gemini Live Multimodal Pipeline
Inbound phone calls stream telephony audio via Twilio Media Streams WebSockets into a lightweight Google Cloud Run container. A pure-software audio codec decodes G.711 μ-law audio, upsamples the stream in-memory, and feeds Gemini Live over a persistent bidirectional WebSocket session. The model delivers streaming conversational speech with natural barge-in interruption detection, while executing autonomous lead capture to Firestore and Slack, alongside warm SIP transfers to desk phones.
1. Inbound Twilio Streaming
Secure call ingestion over full-duplex WebSockets with Twilio cryptographic signature validation.
2. In-Flight Audio Transcoding
Fast lookup-table expansion and linear resampling between Twilio 8kHz and Gemini Live sample rates.
3. Gemini Live Inference
Continuous bidirectional audio loop with automatic language detection and conversational flow.
4. Voice Activity & Interruption Handling
Instant buffer purging flushes queued Twilio playback the moment the caller speaks.
5. Firestore, Slack & SIP Dispatch
Executes lead capture to Firestore & Slack, and issues live SIP call redirection to desk phones via Twilio REST API.
Direct In-Prompt Knowledge & Grounding
- Direct Context Ingestion: Embeds company services and technical project case studies directly into system instructions, avoiding external database retrieval hops.
- Spoken-Word Phone Guardrails: Restricts output formatting to natural conversational dialogue, preventing URLs, markdown, and list formatting from entering audio streams.
Pure-Software Audio Codec
- Zero Native Dependencies: In-memory G.711 μ-law lookup tables and linear resampling (8kHz ↔ 16kHz ↔ 24kHz) running in pure TypeScript without ffmpeg or C++ binaries.
- Twilio Frame Pacing: Packages outbound synthesized audio into uniform 20-millisecond chunks matching telephony stream timing specifications.
Barge-In Synchronization & Buffer Clearing
- Immediate Playback Flushing: Listens for Gemini Live interruption events and immediately emits a Twilio clear signal to purge queued audio buffers.
- Zero Audio Collisions: Prevents synthetic speech from talking over callers when they interrupt.
Telephony Routing & Enterprise Leads
- Live SIP Warm Transfer: Triggers call redirects via Twilio REST API to route callers to an IP desk phone, with automated voicemail fallback.
- Dual Lead Dispatch: Executes tool calls to persist structured lead data in Firestore and send real-time Block Kit alerts to Slack.
Interested in Autonomous Voice AI?
We build production-ready voice and multimodal agent systems with sub-second latency, custom telephony integrations, and enterprise database grounding. Get in touch to schedule a live demo or technical walkthrough.