Autonomous 24/7 emergency call-to-dispatch pipeline: instant 2:14 AM voice screening, <300ms zone & photo capture, deterministic SLA severity triage, atomic CRM/Supabase lock, and cascading on-call technician claim.
PROBLEM & ARCHITECTURE
How the system works
PROBLEM ADDRESSED
Why naive automation fails here
Missed after-hours emergency calls cost home-service contractors high-ticket jobs, while naive LLM receptionists cannot safely handle gas/fire hazards, verify postal service zones mid-call, bypass carrier SMS URL blocks, or prevent two on-call technicians from double-claiming the same dispatch.
Retell AI answers inbound calls (Web Call or +63 / global SIP trunk), enforces Gate 0 life-safety screening first, and invokes n8n WF01 mid-call to validate 4-digit PH postal codes or 5-digit ZIP codes and trade eligibility in under 300ms.
WF01 emails the caller an HMAC-signed, zero-login mobile camera upload button (/upload?token=...) via Gmail—achieving 100% link deliverability without Philippine NTC telco SMS URL-blocking—and attaches up to 3 issue photos to the pending call_id.
Post-call WF02 enforces call_id idempotency, runs a pure-JavaScript deterministic rules engine (LIFE_SAFETY, REJECTED, P1, P2, P3), syncs tickets and photos to Supabase PostgreSQL, and updates the live /dispatch web board.
For approved P1 emergencies, WF03 triggers a cascading Telegram Bot escalation loop (Tech 1 -> Tech 2 -> Ops Manager) with inline 1-Click Accept buttons backed by an atomic claim_ticket() lock.
RELIABILITY CONTROLS
Deterministic safeguards
Zero LLM urgency guessing: life-safety hard stops, geofencing, and P1/P2/P3 scoring execute strictly in deterministic JavaScript with defense-in-depth transcript regex scanning.
Cryptographic expiring HMAC-SHA256 tokens (crypto.timingSafeEqual) protect both caller photo uploads (/upload) and technician 1-click acknowledgments (/api/ack).
Unique call_id idempotency and atomic database claiming guarantee zero duplicate wakeups and cleanly block race-condition double claims.
EVIDENCE & HONEST BOUNDARIES
Verified scope and limitations
November 30, 2026 verification: all 3 operational n8n workflows active (WF01 Mid-Call Voice Tools, WF02 Deterministic Triage & Ticket Sync, WF03 On-Call Escalation Ladder) plus 7/7 passing automated end-to-end simulation scenarios covering P1 flooding escalation, life-safety hard stop, out-of-area rejection, mid-call photo linking, idempotent replay, and atomic technician claim races.
Active MVP deployed on the developer's self-hosted n8n instance, Supabase database, and Express dispatch app using simulated caller/technician rosters—not a paid-client deployment or public 911 emergency service.