# ranjith-fullstack/ai-calling-agent architecture

> Architecture diagram of the GitHub repository ranjith-fullstack/ai-calling-agent, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-05). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ranjith-fullstack/ai-calling-agent
- Repository: https://github.com/ranjith-fullstack/ai-calling-agent

## Overview

This is a self-hosted AI calling platform with a React interface and FastAPI backend. Users import and manage contacts, build consent-checked campaigns, then simulate or queue calls; call handling includes IVR, local AI voice services, and agent handoff. Users also monitor queues and review reports. The README documents these capabilities and the limited local telephony scope. Several service and route implementations were not sampled, so edges for those documented workflows cite the README rather than implying source-level inspection.

Main entry points: [`backend/app/api/routes`](https://github.com/ranjith-fullstack/ai-calling-agent/tree/main/backend/app/api/routes) (API routes), [`frontend/src/api/client.js`](https://github.com/ranjith-fullstack/ai-calling-agent/blob/main/frontend/src/api/client.js) (HTTP client), [`backend/app/services/call_service.py`](https://github.com/ranjith-fullstack/ai-calling-agent/blob/main/backend/app/services/call_service.py) (Call handling facade), [`backend/app/services/campaigns.py`](https://github.com/ranjith-fullstack/ai-calling-agent/blob/main/backend/app/services/campaigns.py) (Campaign management)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["User interface"]
  node_webapp["React application<br/>[App.jsx]"]
  node_customer_ui["Customer management<br/>[Customers.jsx]"]
  node_upload_ui["Spreadsheet import<br/>[ExcelUpload.jsx]"]
  node_campaign_ui["Campaign controls<br/>[Campaigns.jsx]"]
  node_call_ui["Call simulation<br/>[CallSimulation.jsx]"]
  node_reports_ui["Reports and dashboards<br/>[Reports.jsx]"]
  node_api_client["HTTP client<br/>[client.js]"]
end

subgraph group_api["API and data"]
  node_api_routes["API routes"]
  node_auth["Authentication<br/>[auth.py]"]
  node_customers["Customer records<br/>[customers.py]"]
  node_imports["Import staging<br/>[imports.py]"]
  node_database[("PostgreSQL data<br/>[session.py]")]
  node_reports["Analytics and export<br/>[reports.py]"]
end

subgraph group_campaign["Campaign operations"]
  node_campaign_service["Campaign management<br/>[campaigns.py]"]
  node_campaign_model["Campaign assignments<br/>[campaign.py]"]
  node_queue["Call queue worker<br/>[queue.py]"]
end

subgraph group_calling["Call handling"]
  node_call_service["Call handling facade<br/>[call_service.py]"]
  node_simulation["Call simulation<br/>[simulation.py]"]
  node_ivr["IVR and DTMF<br/>[ivr.py]"]
  node_ai_voice["AI and voice services"]
  node_telephony["Asterisk adapter<br/>[telephony.py]"]
  node_agents["Agent transfers<br/>[agents.py]"]
end

node_user(("Operator"))
node_asterisk["Asterisk"]
node_local_ai["Local AI tools"]

node_user -->|"uses"| node_webapp
node_webapp -.->|"routes to"| node_customer_ui
node_customer_ui -->|"requests data"| node_api_client
node_upload_ui -->|"uploads data"| node_api_client
node_campaign_ui -.->|"manages campaigns"| node_api_client
node_call_ui -.->|"starts simulations"| node_api_client
node_reports_ui -.->|"requests reports"| node_api_client
node_api_client -->|"sends requests"| node_api_routes
node_api_routes -->|"mounts routes"| node_auth
node_api_routes -->|"mounts routes"| node_customers
node_api_routes -.->|"delegates imports"| node_imports
node_auth -->|"reads and writes"| node_database
node_customers -.->|"persists records"| node_database
node_imports -.->|"stages records"| node_database
node_campaign_ui -.->|"controls lifecycle"| node_campaign_service
node_campaign_service -.->|"manages assignments"| node_campaign_model
node_campaign_service -->|"queues campaign"| node_queue
node_queue -.->|"executes jobs"| node_call_service
node_api_routes -.->|"dispatches calls"| node_call_service
node_call_service -->|"delegates simulation"| node_simulation
node_call_service -->|"delegates IVR"| node_ivr
node_call_service -->|"delegates telephony"| node_telephony
node_api_routes -.->|"serves AI and voice"| node_ai_voice
node_telephony -.->|"connects locally"| node_asterisk
node_ai_voice -.->|"uses local models"| node_local_ai
node_api_routes -->|"serves agent controls"| node_agents
node_api_routes -.->|"serves analytics"| node_reports
node_reports_ui -.->|"reviews results"| node_reports

click node_webapp "https://github.com/ranjith-fullstack/ai-calling-agent/blob/main/frontend/src/App.jsx"
click node_customer_ui "https://github.com/ranjith-fullstack/ai-calling-agent/blob/main/frontend/src/pages/Customers.jsx"
click node_upload_ui "https://github.com/ranjith-fullstack/ai-calling-agent/blob/main/frontend/src/pages/ExcelUpload.jsx"
click node_campaign_ui "https://github.com/ranjith-fullstack/ai-calling-agent/blob/main/frontend/src/pages/Campaigns.jsx"
click node_call_ui "https://github.com/ranjith-fullstack/ai-calling-agent/blob/main/frontend/src/pages/CallSimulation.jsx"
click node_reports_ui "https://github.com/ranjith-fullstack/ai-calling-agent/blob/main/frontend/src/pages/Reports.jsx"
click node_api_client "https://github.com/ranjith-fullstack/ai-calling-agent/blob/main/frontend/src/api/client.js"
click node_api_routes "https://github.com/ranjith-fullstack/ai-calling-agent/tree/main/backend/app/api/routes"
click node_auth "https://github.com/ranjith-fullstack/ai-calling-agent/blob/main/backend/app/api/routes/auth.py"
click node_customers "https://github.com/ranjith-fullstack/ai-calling-agent/blob/main/backend/app/api/routes/customers.py"
click node_imports "https://github.com/ranjith-fullstack/ai-calling-agent/blob/main/backend/app/services/imports.py"
click node_database "https://github.com/ranjith-fullstack/ai-calling-agent/blob/main/backend/app/database/session.py"
click node_campaign_service "https://github.com/ranjith-fullstack/ai-calling-agent/blob/main/backend/app/services/campaigns.py"
click node_campaign_model "https://github.com/ranjith-fullstack/ai-calling-agent/blob/main/backend/app/models/campaign.py"
click node_queue "https://github.com/ranjith-fullstack/ai-calling-agent/blob/main/backend/app/services/queue.py"
click node_call_service "https://github.com/ranjith-fullstack/ai-calling-agent/blob/main/backend/app/services/call_service.py"
click node_simulation "https://github.com/ranjith-fullstack/ai-calling-agent/blob/main/backend/app/services/simulation.py"
click node_ivr "https://github.com/ranjith-fullstack/ai-calling-agent/blob/main/backend/app/services/ivr.py"
click node_ai_voice "https://github.com/ranjith-fullstack/ai-calling-agent/tree/main/backend/app/services"
click node_telephony "https://github.com/ranjith-fullstack/ai-calling-agent/blob/main/backend/app/services/telephony.py"
click node_agents "https://github.com/ranjith-fullstack/ai-calling-agent/blob/main/backend/app/api/routes/agents.py"
click node_reports "https://github.com/ranjith-fullstack/ai-calling-agent/blob/main/backend/app/services/reports.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_webapp,node_customer_ui,node_upload_ui,node_campaign_ui,node_call_ui,node_reports_ui,node_api_client toneBlue
class node_api_routes,node_auth,node_customers,node_imports,node_database,node_reports toneAmber
class node_campaign_service,node_campaign_model,node_queue toneMint
class node_call_service,node_simulation,node_ivr,node_ai_voice,node_telephony,node_agents toneRose
class node_user,node_asterisk,node_local_ai toneIndigo
```

## Components

### User interface

- [React application](https://github.com/ranjith-fullstack/ai-calling-agent/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Customer management](https://github.com/ranjith-fullstack/ai-calling-agent/blob/main/frontend/src/pages/Customers.jsx): `frontend/src/pages/Customers.jsx`
- [Spreadsheet import](https://github.com/ranjith-fullstack/ai-calling-agent/blob/main/frontend/src/pages/ExcelUpload.jsx): `frontend/src/pages/ExcelUpload.jsx`
- [Campaign controls](https://github.com/ranjith-fullstack/ai-calling-agent/blob/main/frontend/src/pages/Campaigns.jsx): `frontend/src/pages/Campaigns.jsx`
- [Call simulation](https://github.com/ranjith-fullstack/ai-calling-agent/blob/main/frontend/src/pages/CallSimulation.jsx): `frontend/src/pages/CallSimulation.jsx`
- [Reports and dashboards](https://github.com/ranjith-fullstack/ai-calling-agent/blob/main/frontend/src/pages/Reports.jsx): `frontend/src/pages/Reports.jsx`
- [HTTP client](https://github.com/ranjith-fullstack/ai-calling-agent/blob/main/frontend/src/api/client.js): `frontend/src/api/client.js`

### API and data

- [API routes](https://github.com/ranjith-fullstack/ai-calling-agent/tree/main/backend/app/api/routes): `backend/app/api/routes`
- [Authentication](https://github.com/ranjith-fullstack/ai-calling-agent/blob/main/backend/app/api/routes/auth.py): `backend/app/api/routes/auth.py`
- [Customer records](https://github.com/ranjith-fullstack/ai-calling-agent/blob/main/backend/app/api/routes/customers.py): `backend/app/api/routes/customers.py`
- [Import staging](https://github.com/ranjith-fullstack/ai-calling-agent/blob/main/backend/app/services/imports.py): `backend/app/services/imports.py`
- [PostgreSQL data](https://github.com/ranjith-fullstack/ai-calling-agent/blob/main/backend/app/database/session.py): `backend/app/database/session.py`
- [Analytics and export](https://github.com/ranjith-fullstack/ai-calling-agent/blob/main/backend/app/services/reports.py): `backend/app/services/reports.py`

### Campaign operations

- [Campaign management](https://github.com/ranjith-fullstack/ai-calling-agent/blob/main/backend/app/services/campaigns.py): `backend/app/services/campaigns.py`
- [Campaign assignments](https://github.com/ranjith-fullstack/ai-calling-agent/blob/main/backend/app/models/campaign.py): `backend/app/models/campaign.py`
- [Call queue worker](https://github.com/ranjith-fullstack/ai-calling-agent/blob/main/backend/app/services/queue.py): `backend/app/services/queue.py`

### Call handling

- [Call handling facade](https://github.com/ranjith-fullstack/ai-calling-agent/blob/main/backend/app/services/call_service.py): `backend/app/services/call_service.py`
- [Call simulation](https://github.com/ranjith-fullstack/ai-calling-agent/blob/main/backend/app/services/simulation.py): `backend/app/services/simulation.py`
- [IVR and DTMF](https://github.com/ranjith-fullstack/ai-calling-agent/blob/main/backend/app/services/ivr.py): `backend/app/services/ivr.py`
- [AI and voice services](https://github.com/ranjith-fullstack/ai-calling-agent/tree/main/backend/app/services): `backend/app/services`
- [Asterisk adapter](https://github.com/ranjith-fullstack/ai-calling-agent/blob/main/backend/app/services/telephony.py): `backend/app/services/telephony.py`
- [Agent transfers](https://github.com/ranjith-fullstack/ai-calling-agent/blob/main/backend/app/api/routes/agents.py): `backend/app/api/routes/agents.py`

### Other components

- **Operator**
- **Asterisk**
- **Local AI tools**

## Connections

- Operator → React application: uses (evidence: `README.md`)
- React application → Customer management: routes to
- Customer management → HTTP client: requests data (evidence: `frontend/src/pages/Customers.jsx`)
- Spreadsheet import → HTTP client: uploads data
- Campaign controls → HTTP client: manages campaigns (evidence: `README.md`)
- Call simulation → HTTP client: starts simulations (evidence: `README.md`)
- Reports and dashboards → HTTP client: requests reports (evidence: `README.md`)
- HTTP client → API routes: sends requests (evidence: `README.md`)
- API routes → Authentication: mounts routes (evidence: `backend/app/main.py`)
- API routes → Customer records: mounts routes (evidence: `backend/app/main.py`)
- API routes → Import staging: delegates imports (evidence: `README.md`)
- Authentication → PostgreSQL data: reads and writes (evidence: `backend/app/api/routes/auth.py`)
- Customer records → PostgreSQL data: persists records (evidence: `README.md`)
- Import staging → PostgreSQL data: stages records (evidence: `README.md`)
- Campaign controls → Campaign management: controls lifecycle (evidence: `README.md`)
- Campaign management → Campaign assignments: manages assignments (evidence: `README.md`)
- Campaign management → Call queue worker: queues campaign (evidence: `backend/app/services/campaign_service.py`)
- Call queue worker → Call handling facade: executes jobs (evidence: `backend/app/services/call_service.py`)
- API routes → Call handling facade: dispatches calls (evidence: `README.md`)
- Call handling facade → Call simulation: delegates simulation (evidence: `backend/app/services/call_service.py`)
- Call handling facade → IVR and DTMF: delegates IVR (evidence: `backend/app/services/call_service.py`)
- Call handling facade → Asterisk adapter: delegates telephony (evidence: `backend/app/services/call_service.py`)
- API routes → AI and voice services: serves AI and voice (evidence: `README.md`)
- Asterisk adapter → Asterisk: connects locally (evidence: `README.md`)
- AI and voice services → Local AI tools: uses local models (evidence: `README.md`)
- API routes → Agent transfers: serves agent controls (evidence: `backend/app/main.py`)
- API routes → Analytics and export: serves analytics (evidence: `README.md`)
- Reports and dashboards → Analytics and export: reviews results (evidence: `README.md`)
