# microsoft/call-center-ai architecture

> Architecture diagram of the GitHub repository microsoft/call-center-ai, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-11-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/microsoft/call-center-ai
- Repository: https://github.com/microsoft/call-center-ai

## Overview

##### Project type and purpose
- This is a cloud-native, serverless “Call Center AI” solution written in Python.
- It exposes a POST /call API to initiate AI-driven voice calls (outbound/inbound), streams voice in real time, leverages Azure Communication Services for telephony, Azure Cognitive Services for speech and translation, Azure OpenAI for LLM, and persists call transcripts, claims, reminders, and syntheses in Cosmos DB (with Redis caching, Storage queues, Event Grid).
- It also hosts a simple public website (Jinja2 templates) to display call reports.

##### File structure
- Top-level:
– cicd/ (Dockerfile, Bicep IaC templates, versioning)
– app/ (Python application)
· helpers/ (config, logging, LLM calls, event handling, monitoring)
· models/ (Pydantic domain models for call, claim, message, reminders)
· persistence/ (interfaces and adapters for Cosmos DB, Redis, Azure Queue Storage, Twilio/SMS)
· resources/ (static assets and templates for public website, local token files)
· main.py (FastAPI or similar entrypoint)
– public/ (static assets)
– config-*.yaml (local and remote config examples)
– docs/, examples/, tests/
– GitHub Actions workflows, .devcontainer, Makefile, pyproject.toml

##### README for additional insights
- Technologies: Azure Container Apps, Communication Services, Cognitive Services (STT/TTS/Translation), OpenAI GPT-4.1/4.1-nano, Cosmos DB, Azure Storage Queues, Event Grid, Redis, Application Insights.
- It uses Bicep for IaC and GitHub Actions for CI/CD, with a single Docker image deployed to Azure.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Actors
    User(["User"]):::external
    Agent(["Human Agent"]):::external

    %% Telephony Gateway
    ACS(["Azure Communication Services\n(Voice & SMS)"]):::cloud

    %% Bot Application
    BotApp(["Container App: CallCenterAI"]):::compute

    %% AI Services
    subgraph "AI Services"
        LLM(["OpenAI GPT-4.1 / nano"]):::cloud
        STT_TTS(["Speech-to-Text & Text-to-Speech"]):::cloud
        Translation(["Translation"]):::cloud
        AI_Search(["Azure AI Search\n(RAG & Embeddings)"]):::cloud
    end

    %% Data & Messaging
    subgraph "Data & Messaging"
        CosmosDB(["Cosmos DB\n(Call transcripts, claims, reminders)"]):::datastore
        Redis(["Redis Cache"]):::message
        StorageQueue(["Azure Storage Queues"]):::message
        EventGrid(["Azure Event Grid"]):::message
        BlobStorage(["Azure Blob Storage\n(Audio recordings, assets)"]):::datastore
    end

    %% Public Website
    PublicWeb(["Public Website\n(Jinja2 Templates)"]):::compute

    %% Relationships
    User -->|"places/receives call"| ACS
    ACS -->|"audio stream"| BotApp
    BotApp -->|"audio stream"| STT_TTS
    STT_TTS -->|"text transcript"| BotApp
    BotApp -->|"translate text"| Translation
    Translation -->|"translated text"| BotApp
    BotApp -->|"send prompt"| LLM
    LLM -->|"completion"| BotApp
    BotApp -->|"send text"| STT_TTS
    STT_TTS -->|"audio"| BotApp
    BotApp -->|"audio stream"| ACS
    BotApp -->|"persist data"| CosmosDB
    BotApp -->|"cache context"| Redis
    BotApp -->|"publish events"| EventGrid
    EventGrid -.->|"triggers"| StorageQueue
    BotApp -->|"query documents"| AI_Search
    AI_Search -->|"results"| BotApp
    BotApp -->|"transfer call"| ACS
    ACS -->|"connect to"| Agent
    PublicWeb -->|"API requests"| BotApp
    BotApp -->|"read reports"| CosmosDB

    %% Click Events
    click ACS "https://github.com/microsoft/call-center-ai/blob/main/app/persistence/communication_services.py"
    click BotApp "https://github.com/microsoft/call-center-ai/blob/main/app/main.py"
    click LLM "https://github.com/microsoft/call-center-ai/blob/main/app/helpers/call_llm.py"
    click STT_TTS "https://github.com/microsoft/call-center-ai/blob/main/app/helpers/translation.py"
    click AI_Search "https://github.com/microsoft/call-center-ai/blob/main/app/persistence/ai_search.py"
    click Redis "https://github.com/microsoft/call-center-ai/blob/main/app/persistence/redis.py"
    click CosmosDB "https://github.com/microsoft/call-center-ai/blob/main/app/persistence/cosmos_db.py"
    click StorageQueue "https://github.com/microsoft/call-center-ai/blob/main/app/persistence/azure_queue_storage.py"
    click EventGrid "https://github.com/microsoft/call-center-ai/blob/main/app/helpers/call_events.py"
    click PublicWeb "https://github.com/microsoft/call-center-ai/tree/main/app/resources/public_website"

    %% Styles
    classDef external fill:#f9f9f9,stroke:#666,stroke-width:1px
    classDef compute fill:#DEF,stroke:#000,stroke-width:1px
    classDef cloud fill:#D0E8FF,stroke:#0078D4,stroke-width:1px
    classDef datastore fill:#DFFFD0,stroke:#228B22,stroke-width:1px
    classDef message fill:#FFDDA0,stroke:#FFA500,stroke-width:1px
```
