Architecture Note · Operations & RevOps
Inbound-Only AI Voice Receptionist: Consent Gates, Timezone Locks, and Escalation Sign-Off
Why prompt-only voice agents fail across regulated call desks—and the deterministic FastAPI and SQLite WAL architecture that enforces consent, prevents double-booking, and locks escalation sign-off.
The Problem: Missed Inbound Calls and High-Stakes Routing Across Timezones
Service operations teams, specialist clinics, and B2B support desks lose revenue and breach response SLAs whenever inbound calls hit voicemail during peak hours or after-hours gaps. Front desks spanning London, New York, Toronto, Sydney, and Tokyo must qualify intent, respect local office hours and recording laws, convert calendar slots accurately across Daylight Saving transitions, and route urgent clinical, legal, or outage calls immediately to a live specialist.
Why Naive AI Voice Wrappers Fail in Production
Wrapping a speech-to-text stream around a generic chat completion prompt breaks down along four operational failure modes:
- Unbounded call direction and consent drift: Without schema-level locks, conversational agents can trigger unapproved outbound callbacks, skip mandatory AI-disclosure greetings, or persist raw audio buffers after a caller declines recording.
- Nondeterministic scheduling and timezone races: Prompt-driven slot math misreads local offsets around DST boundaries and lacks atomic database locks, allowing concurrent calls to double-book the same provider.
- Silent failure on low ASR confidence or emergencies: When background noise drops transcription confidence or a caller reports chest pain, a legal subpoena, or a production outage, a chatty model tends to improvise scheduling instead of halting automation.
- Missing custody and auditability: Ephemeral voice logs either vanish without disposition history or linger indefinitely on disk with raw caller audio intact and zero tamper-evident audit trails.
The Deterministic Architecture That Fixes It
Production inbound reception treats language models as bounded intake extractors inside a deterministic FastAPI and SQLite WAL control plane, enforcing policy in code and database constraints before any booking or handoff completes.
- Strict inbound-only and consent enforcement: On
POST /api/voice/inbound-session, any request withdirection != "inbound",outbound_dial=true, or a non-inboundcall_typeis rejected with HTTP422, logged tocompliance_events, and blocked at the storage layer by SQLiteCHECKconstraints. Whenrecording_consentis false, audio uploads andrecording_urlbuffers are never persisted (recording_status="non_recorded"or"redacted"), while temporary text uploads inVOICE_UPLOAD_DIR(0600) auto-wipe after one hour (3600s). - Zero-key deterministic intake and local hours policy: An
OfflineDeterministicAdapterextracts structured caller intent and CRM summaries with zero external API keys (with an optional OpenAI-compatible fallback). Local office schedules are evaluated deterministically via Pythonzoneinforather than prompt heuristics. - Atomic cross-timezone slot locking:
POST /api/voice/book-slotrejects sessions missingai_disclosure_given=true(HTTP422) or already escalated (HTTP409), validates business hours in the target IANA timezone, converts windows to UTC, and checks overlaps inside aBEGIN IMMEDIATEtransaction backed by the partial unique indexidx_appointments_unique_active_slot. - Deterministic escalation and human sign-off gates: Urgent keywords (such as
chest pain,legal subpoena, oroutage), caller handoff phrases, or ASR confidence below0.65triggerPOST /api/voice/escalate, halting autonomous booking and creating a ticket withsignoff_required=true. Tickets remain inpending_human_signoffuntil closed viaPOST /api/voice/escalations/{ticket_id}/disposition. - Immutable hash-chained audit logs and safe analytics: Every intake, booking, escalation, and human sign-off appends to
audit_logswith sequential SHA-256 chaining (prev_hash|canonical) protected by SQLiteBEFORE UPDATEandBEFORE DELETEabort triggers.GET /api/voice/analyticsand/api/voice/analytics.csvreport containment rate, average handle time, and booking conversion with OWASP CSV formula neutralization.
Operational Takeaway
Reliable voice automation does not come from freer prompting; it comes from constraining AI intake behind strict inbound-only schema locks, UTC-normalized slot transactions, automatic escalation halts, ephemeral upload auto-wipes, and mandatory human sign-off records backed by verifiable SHA-256 audit chains that withstand compliance review.