A purpose-built bidirectional media bridge.
Twilio streams G.711 μ-law at 8 kHz; Gemini expects PCM16 at 16 kHz. Relay converts both directions in-process, moves frames through bounded System.Threading.Channels, tunes server-side voice activity detection, and measures latency from caller turn-end to first model audio.
- →Separate send and receive loops prevent one direction from starving the other.
- →Abnormal provider closes use bounded reconnects and Gemini session resumption.
- →Terminal failures become persisted state and a localized caller response—not dead air.