Inspiration
Up to 90% of 911 requests are non-critical, yet they overwhelm emergency dispatchers during large-scale disasters. Our team was inspired by the 2018 Camp Fire in California, where dispatchers received over 1,200 calls in just a few hours, many asking for general information while life-threatening emergencies went unanswered. We set out to build an intelligent triage system that could handle routine inquiries while ensuring critical emergencies get immediate human attention.
What it does
9-1-Wonder is an AI-powered 911 dispatch system that intelligently triages incoming calls in real-time. When someone calls 911:
- Smart Classification: The system uses Groq LLM to instantly classify calls as EMERGENCY or NON-EMERGENCY and assigns a criticality level (CRITICAL/HIGH/MEDIUM/LOW)
- Intelligent Routing:
- Emergency calls are immediately transferred to human dispatchers
- Non-emergency calls are handled by an AI voice agent powered by Deepgram that can answer questions, provide information, and escalate if needed
- Live Dashboard: Dispatchers see a real-time map with color-coded incident markers, call summaries, and filtering tools to prioritize responses
- Automated Summarization: Every call gets a 2-3 sentence summary generated by AI, giving dispatchers instant context without listening to full recordings
How we built it
We built a full-stack system with:
- Backend: FastAPI server handling Twilio webhooks, WebSocket connections for real-time audio streaming, and integration with Groq for LLM-based classification
- Voice AI: Deepgram Voice Agent with GPT-4o-mini for natural conversation, supporting real-time speech-to-text and text-to-speech with barge-in capability
- Frontend: Next.js 16 with React 19, featuring an interactive Leaflet map, Server-Sent Events for real-time updates, and responsive mobile design
- Database: Supabase (PostgreSQL) for persistent call storage with location data, severity levels, and metadata
- Telephony: Twilio for phone number management and call routing with TwiML
The system uses a multi-layered AI approach: Groq's open-source models for fast classification and summarization, while Deepgram handles voice processing with sub-200ms latency.
Backend deep dive: To streamline the entire phone call and simplify deployment, we handle both the initial call discussion (e.g. “I’m wondering about the fire nearby”) and the conversation with either human or AI voice agent all via a single FastAPI server. The single-server architecture is built upon protocol switching.
The initial conversation (standard TwiML telephony) is handled with Twilio’s HTTP webhook model. If the Groq-based classification model determines that the discussion is not critical, the server dynamically transitions from the HTTP webhook to a custom WebSocket connection, allowing real-time bidirectional audio streaming with Deepgram’s Voice Agent API. Handling the transition within a unified server allows for the call context to be preserved, maintaining session continuity between the initial call and the voice agent conversation. If the discussion is critical, the server forwards to the human dispatch operator within the HTTP webhook model.
Challenges we ran into
- Audio Streaming Complexity: Getting Twilio's mulaw-encoded audio to work with Deepgram required careful buffering (20 messages = 400ms) and handling barge-in interruptions
- Real-time Frontend Updates: We initially used polling but had to implement Server-Sent Events with fallback mechanisms and heartbeat keep-alives to maintain reliable connections
- Safety-Critical AI: Ensuring the AI never misclassifies a true emergency as non-critical required extensive prompt engineering and a conservative "default to emergency" approach
- WebSocket Abstraction: Wrapping FastAPI's WebSocket to match Deepgram's expected interface while handling both text and binary messages asynchronously
Accomplishments that we're proud of
- Sub-second classification: Calls are analyzed and routed in under 1 second using Groq's fast inference
- Natural conversation: Our AI agent can handle complex, emotional calls with empathy while knowing when to escalate
- Resilient architecture: Multiple fallback layers (SSE→Polling, error recovery) ensure the dashboard never goes dark
- Production-ready: Built with security features like Twilio webhook validation, comprehensive error handling, and deployment guides for cloud platforms
- Real-world testing: Successfully processed test calls with accurate emergency detection across 15+ scenarios
What we learned
- AI safety is hard: Building trust in life-or-death situations requires conservative classification, multiple validation layers, and always keeping humans in the loop for emergencies
- WebSockets at scale: Real-time audio streaming teaches you about buffering, latency, protocol mismatches, and the importance of graceful degradation
- Prompt engineering matters: Our criticality assessment accuracy jumped from 60% to 93% after refining prompts with specific disaster scenarios and classification criteria
- Frontend resilience: Real-time dashboards need multiple update strategies (SSE, polling, reconnection logic) because networks fail
What's next for 9-1-Wonder
- Multi-language support: Add Deepgram's multilingual models to serve non-English speaking communities
- Real geolocation: Integrate Twilio's caller location API to automatically populate incident coordinates instead of hardcoded test data
- Historical analytics: Build a reporting dashboard showing call volume trends, AI accuracy metrics, and response time analytics
- Dispatcher tools: Add features like callback scheduling, resource dispatch tracking, and collaborative notes
- Mobile app: Create a native mobile app for dispatchers to manage calls on the go during field operations
- Advanced AI: Implement emotion detection to catch subtle distress signals and background audio analysis to detect sounds like gunshots or alarms

Log in or sign up for Devpost to join the conversation.