How azure-samples/realtime-call-center-accelerator works
Project Type and Purpose
• This is a full-stack Azure Solution Accelerator that demonstrates an AI-assisted, phone-based call center using Azure Communication Services (ACS), Azure Container Apps, Azure AI Search, and OpenAI models.
• It provides both a browser-based UI and a telephone interface to interact with an AI agent, backed by a Python Flask-style API.
Main Architectural Components
A. Client Layer
– Web browser UI: static assets (index.html, app.js, style.css) served by the container app.
– Telephone endpoint: Customer dials ACS-provisioned phone number.
B. API & Business Logic (deployed as Azure Container App)
– app.py: Flask-style HTTP API for web UI and Event Grid webhooks.
– Backend modules (acs.py, azure.py, rtmt.py, helpers.py): handle ACS call control, RTM streaming websocket, metadata.
– RAG tooling (tools/rag/ai_search.py): calls Azure AI Search + OpenAI to generate agent responses.
C. Azure Platform Services
1. Azure Container Apps
• Hosts the API & static web UI.
• Exposes HTTP endpoint (/acs, /realtime-acs).
2. Azure Communication Services (ACS)
• Phone number resource receives inbound calls.
• Media streaming channel (WebSocket) to backend.
3. Azure Event Grid
• Subscribes to ACS “Incoming Call” events.
• Forwards event to backend webhook.
4. Azure Storage + AI Search
• Storage Account “prompt” container: optional system_prompt.md override.
• Storage Account “data” container: knowledge-base files (in /data).
• Azure AI Search indexes and vectorizes knowledge base.
5. OpenAI Service
• Processes RAG queries and returns chat completions.
D. Infrastructure as Code
– Bicep templates (infra/**/*.bicep): define all above resources.
– Scripts (azd-hooks/deploy.sh): build & deploy container, copy data to storage.
Relationships & Data Flows
1. Web UI → HTTP POST → API → RAG / OpenAI → API → WebSocket or HTTP response → Web UI.
2. Phone call → ACS → Event Grid → API webhook (/acs/incoming) → API answers call (via ACS SDK) → API initiates media stream over WebSocket (/realtime-acs) → API sends/receives speech frames → RAG/AI Search/OpenAI → API streams back responses → ACS → caller’s phone.
3. Deployment: azd up → Bicep templates → provision ACS, Container Apps, Storage, AI Search, Event Grid.
4. Data upload: scripts/upload_data.sh → Azure Storage → AI Search indexer runs.
Architectural Patterns & Principles
– Serverless / container-based microservices: stateless container app hosts API and UI.
– Event-driven design: Event Grid routes ACS events to the API.
– Real-time streaming: WebSocket integration with ACS for bi-directional media.
– RAG (Retrieval-Augmented Generation): calling AI Search to retrieve docs, then OpenAI for generation.
– Infrastructure as Code: all cloud resources defined as Bicep modules.
Final Touches
• Number the main flow steps if desired.
• Keep labels concise but specific (e.g., “Container App (Flask API + UI)”).