ai newsFr., 30. Okt.
EilmeldungXREAL AURA Launches With Android XR, Gemini and a Wired Compute Puck

How My Google Voice AI Agent Knows When to Talk: Call-State Detection, Groq and TTS

Most AI voice demos start with a telephony API. You get webhooks, clean call events and an audio stream, and the interesting problem is the conversation. My Google Voice Dispatch Agent doesn't get any of that. It drives Google Voice inside a real Chrome window, and that changes where the hard work

dev.toDonnerstag 23:34 · 29.10.3 Min. Lesezeit
Bild: dev.to

Most AI voice demos start with a telephony API. You get webhooks, clean call events and an audio stream, and the interesting problem is the conversation.

My Google Voice Dispatch Agent doesn't get any of that. It drives Google Voice inside a real Chrome window, and that changes where the hard work is. The AI reply turned out to be the easy part. The hard part was knowing, with confidence, whether someone had actually picked up.

This post walks through how the agent is put together, based on what's in the repo.

Repo: https://github.com/mafzalkalwardev/google-voice-dispatch-agent (MIT licensed)

In short, it's an outbound AI calling console for Windows:

The README describes the flow in ten steps, and I'll keep it close to that:

Step 4 is small but matters a lot. If you generate the greeting after someone says "hello", they hear dead air and hang up. Pre-generating it means the agent can talk the moment the call is confirmed.

Here's the thing about automating a web UI: the DOM is noisy. Buttons appear early, old "call ended" banners linger, and voicemail-looking cues can show up while the phone is still ringing. If you trust the first signal you see, the bot either talks over the ring tone or hangs up on a real person.

So the core of the project is a conservative gate in src/google_voice.py. The rules it enforces:

Every decision is logged too: current state, elapsed ring time, DOM cues, answered controls, call-active status, voicemail cues, the audio classifier result and the timeout reason. When a call goes wrong, I can read exactly why the agent thought what it thought.

The design principles in the README sum it up:

Once the gate says "connected", conversation_loop.py takes over. The modules split up cleanly:

src/ google_voice.py Selenium Google Voice automation and call-state detection call_session.py Call session model and CallState transitions conversation_loop.py Realtime capture, VAD, STT, LLM, TTS, voicemail handoff voicemail_detector.py Audio classifier for greeting/beep/live-call signals ai_groq.py Groq-backed AI response behavior realtime_tts.py Edge TTS playback and cache integration audio_capture.py Input capture and VAD framing audio_routing.py Windows audio-device discovery and playback routing Enter fullscreen mode Exit fullscreen mode The loop works like this:

Several knobs in dialer_config.json relate directly to this loop:

{ "min_ring_seconds": 2, "max_ring_seconds": 45, "voicemail_detect_seconds": 15, "silence_does_not_end_call": true, "call_cooldown_seconds": 10, "tts_warmup": true, "stt_retry_count": 2, "vad_silence_frames": 12, "vad_speech_frames": 2 } Enter fullscreen mode Exit fullscreen mode silence_does_not_end_call is a nice example of a lesson baked into config: people go quiet on the phone, and that shouldn't be read as a hang-up.

The minimum VB-CABLE setup from the README:

For unattended runs, the README recommends separate routes for TTS and inbound capture, and warns against capturing the same speaker output that plays the agent's voice. Otherwise the agent can end up transcribing itself. CAPTURE_DEVICE=default uses Windows speaker loopback, which is fine for testing but less reliable for nonstop calling.

There are CLI helpers for checking this before going live:

python -m src.main --list-audio-devices python -m src.main --audio-route-test python -m src.main --preflight Enter fullscreen mode Exit fullscreen mode Parallel lines without crossed wires The agent can also run more than one line. Each worker gets its own Chrome profile and pulls from one shared contact queue. The important safety rule: shared audio routes are rejected by default, "because one AI response would otherwise be broadcast into multiple calls." Each slot needs its own loopback and capture pair, like CABLE-A and CABLE-B.

Google Voice accounts can be managed from the console. Saved passwords are protected with Windows DPAPI and never returned by the web API, and MFA or CAPTCHA challenges still have to be completed by a human in the visible Chrome window.

If you're working on voice agents on top of tools you already use, I'd like to hear what broke first for you.

Open to freelance & remote work Portfolio: https://mafzalkalwardev.github.io/#hire-me GitHub: https://github.com/mafzalkalwardev WhatsApp: +92 307 9670503 — https://wa.me/923079670503

Quelle: dev.to (dev.to). Original öffnen