Skip to main content

High-Level Flow

Runtime Services

Call Room Contract

The scheduler creates one LiveKit room per lead:
The SIP participant identity must be:
The agents use this identity format to detect that the participant is a phone caller and to extract the lead ID.

Concurrency Control

The scheduler limits active outbound calls using:
Active calls are rows in calls with status='calling'. Before starting more calls, the scheduler also fails stale calling rows older than:
This prevents stuck call records from permanently blocking the queue.

Calling Window

Calls only start when the local time is inside the configured window:
The end hour is exclusive. With the values above, calls can start from 09:00 through 19:59.

Deployment Shape

docker-compose.yml runs:
  • db: PostgreSQL 16
  • agent: defaults to python agent_realtime.py start
  • lead_fetcher: lead ingestion service
  • scheduler: call scheduler and CRM push loop
  • dashboard: Streamlit dashboard on container port 8501, bound to host 127.0.0.1:8502
  • web: token server