Skip to main content

High-Level Architecture


Vaani Dialer Architecture

Coming Soon — The Vaani Dialer is in development and available on the Dev instance for testing.
The Vaani Dialer is an AMQP-based outbound call scheduler built on Django + Twisted. It runs as a separate service alongside the main FastAPI backend, managing prospect queues, call scheduling, and dialing flows via RabbitMQ.

Dialer Pipeline

Component roles:
ComponentWhat It Does
TickerEmits CampaignTick events at the campaign’s dialer_interval (2–15 seconds)
HopperFills the prospect queue — selects prospects based on list priority, timezone windows, DNC, and expiry rules
DialerConsumes tick events and originates outbound calls via the Vaani backend, respecting call ratio and damper controls
SchedulerHandles scheduling requests — callback queuing, time-delayed prospects, and scheduling coordination

Integration with Vaani Backend

The dialer connects to the main Vaani platform through:
  • Campaign fieldsagent_id, workspace, email link each campaign to a Vaani agent and workspace
  • REST API — The v_views layer exposes campaign CRUD, prospect upload, and status endpoints consumed by the Vaani dashboard
  • Cache invalidation — Campaign updates automatically clear Redis cache via vaani_data_{slug} keys

Component Interaction Map

Frontend → Backend → Database

Widget → LiveKit → Agent Worker

Phone Call → SIP → LiveKit → Agent Worker


Runtime Flows

Application Startup

  1. gunicorn starts with Uvicorn workers → app/asgi.pyapp/main.py
  2. lifespan() context manager initializes httpx.AsyncClient singleton
  3. CORS middleware registered (all origins)
  4. 14 routers registered under their prefixes
  5. Health check at GET /

Request Lifecycle (REST API)

Voice Call Lifecycle


Authentication & Authorization

Authentication Chain

Authorization (RBAC)

OperationRequired Role
View data (calls, agents, reports)member
Create/edit agents, SIP, campaignsdeveloper
Manage workspaces, invite membersadmin
Platform administrationsuperuser (user flag)

Data Storage Design

PostgreSQL (Primary Database)

TableModelExpected Scale
agentsAgentsHundreds
usersUserThousands
workspacesWorkspaceHundreds
user_workspacesUserWorkspaceThousands
call_logsCallLogMillions
logs (SIP)SIPHundreds
campaignsCampaignHundreds
batch_jobsBatchJobThousands
batch_itemsBatchItemMillions
chat_logsChatLogHundreds of K

Redis

  • livekit:active_calls — Integer counter of concurrent calls (TTL: 600s)
  • Celery task results and queue messages

AWS S3

  • Pattern: mv/{YYYY}/{MM}/{DD}/{call_log_id}.ogg
  • Access: Pre-signed URLs (1-hour expiry)

External API Dependencies

ServicePurposeConfig Keys
LiveKitReal-time media, SIP gatewayLIVEKIT_API_KEY, LIVEKIT_API_SECRET, LIVEKIT_URL
OpenAILLM (GPT-4, GPT-4o), TTS, RAGOPENAI_API_KEY
GroqLLM (fast inference)GROQ_API_KEY
DeepgramSTT (Nova-3), TTSDEEPGRAM_API_KEY
ElevenLabsTTS (high quality)ELEVENLABS_API_KEY
CartesiaSTT, TTSCARTESIA_API_KEY
SarvamSTT, TTS (Indian languages)SARVAM_API_KEY
TwilioPhone provisioning, SIP trunkingTWILIO_ACCOUNT_SID, TWILIO_AUTH_TOKEN
VonagePhone provisioning, SIP trunkingVONAGE_API_KEY, VONAGE_API_SECRET
AWS S3Call recording storageS3_BUCKET_NAME, S3_REGION, S3_ACCESS_KEY, S3_SECRET_KEY