Skip to main content

Welcome to DispatchAI

DispatchAI is a real-time emergency call triage system that uses AI to analyze incoming calls, extract critical information, and prioritize them for dispatchers. The system ingests live phone calls via Telnyx, streams audio through parallel analysis agents, and produces a ranked priority queue to help dispatchers act on the most critical calls first.
DispatchAI combines real-time speech-to-text transcription, audio distress analysis, emotion detection, and semantic classification to automatically triage emergency calls.

Key Features

Real-Time Audio Streaming

Stream live audio from Telnyx calls via WebSocket for instant analysis

Parallel Analysis Pipeline

Run audio distress detection and NLP analysis simultaneously for faster results

Intelligent Priority Ranking

Automatically score and queue calls based on risk level, category, and semantic tags

Multi-Provider Support

Integrate with Deepgram (STT), OpenAI (emotion), and Telnyx (telephony)

How It Works

DispatchAI processes emergency calls through a multi-stage pipeline:
1

Incoming Call

Telnyx sends a webhook to /api/v1/call/incoming when a call is initiated
2

Audio Streaming

The system answers the call and starts streaming audio to the WebSocket endpoint /ws
3

Parallel Analysis

Audio and NLP tracks run simultaneously:
  • Audio Track: Analyzes voice distress using RMS-based VAD and EMA smoothing
  • NLP Track: Transcribes speech with Deepgram and classifies intent
4

Packet Generation

The merger combines results into a CallPacket with transcript, distress score, emotion, and semantic tags
5

Priority Ranking

The ranking service scores the call based on:
  • Risk level (CRITICAL, ELEVATED, NORMAL, LOW)
  • Service category (EMS, FIRE, POLICE, OTHER)
  • Semantic tags (GUNSHOT, CARDIAC_ARREST, FIRE, etc.)
6

Queue Display

Dispatchers view the ranked queue via the dashboard or /api/v1/queue endpoint

CallPacket Schema

Each processed call produces a CallPacket with comprehensive analysis:
{
  "call_id": "8f3e91a2-...",
  "call_control_id": "v3:...",
  "from_masked": "••••5678",
  "to": "+15551234567",
  "duration_seconds": 45,
  "audio": {
    "sample_rate": 8000,
    "voiced_seconds": 32.4,
    "distress_score": 0.87,
    "distress_max": 0.92,
    "distress_bucket": "HIGH_RISK"
  },
  "nlp": {
    "transcript": "There's been a shooting at 123 Main Street. Someone is down and bleeding.",
    "emotion": {
      "label": "HIGHLY_DISTRESSED",
      "sentiment": "negative",
      "intensity": 0.89
    },
    "category": "EMS",
    "category_confidence": 0.95,
    "tags": ["GUNSHOT", "BLEEDING", "TRAUMA"],
    "summary": "Shooting incident with victim bleeding at 123 Main Street"
  },
  "risk": {
    "level": "CRITICAL",
    "score": 0.92
  },
  "routing": {
    "priority": "CRITICAL",
    "recommended_unit": "EMS",
    "recommended_tags": ["GUNSHOT", "BLEEDING", "TRAUMA"]
  },
  "ranking": {
    "weight": 142.5,
    "score": 0.92,
    "created_at": "2024-03-15T18:42:31Z"
  }
}
The from field is masked for privacy, showing only the last 4 digits as ••••1234

Quickstart

Get up and running in 5 minutes

Architecture

Understand the system design

API Reference

Explore the REST and WebSocket APIs

Use Cases

Emergency Call Centers (911/999)

Automatically prioritize incoming emergency calls to ensure life-threatening situations are handled first. The system detects keywords like “not breathing,” “unconscious,” or “gunshot” and elevates priority even if the caller sounds calm (shock/dissociation).

Hospital Triage Lines

Route calls to appropriate departments (EMS, trauma, cardiology) based on semantic classification and symptom tags.

Crisis Hotlines

Detect elevated distress and suicidal ideation to route high-risk callers to specialized counselors immediately.

Technical Stack

  • Backend: FastAPI (Python 3.10+)
  • Telephony: Telnyx (WebRTC & Call Control API)
  • Speech-to-Text: Deepgram (Nova-2 model)
  • Emotion Detection: Deepgram Text Intelligence / OpenAI GPT-4o
  • Audio Analysis: Custom RMS-based VAD with EMA distress scoring
  • Queue Storage: In-memory (dev) / PostgreSQL (production)

Next Steps

1

Install Dependencies

Follow the Quickstart to set up your development environment
2

Configure Providers

Obtain API keys for Telnyx, Deepgram, and OpenAI
3

Run Your First Call

Make a test call and watch it appear in the queue

Build docs developers (and LLMs) love