# farzanali/call-ivr architecture

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

- Interactive diagram: https://gitdiagram.com/farzanali/call-ivr
- Repository: https://github.com/farzanali/call-ivr

## Overview

##### Main Components

a) Frontend Layer:
- React-based web interface (indicated by the /calling directory structure)
- Main UI components from /calling/src
- Call.js component as a key interface element

b) Backend Services:
- Python-based services (multiple .py files in root)
- Server component (calling/server/server.py)
- Speech processing bridge (SpeechClientBridge.py)

c) External Services Integration:
- Google Cloud Services (indicated by google-creds.json)
- Telephony System Interface

##### Component Relationships

**[Frontend Layer]**

- v
**[Backend Server Layer]**

**[Speech Processing]  [Call Processing]**

- v                v
**[Google Cloud]    [Phone System]**

##### Specific Implementation Details

- Hexagons for external services
- Green for backend services
- Yellow for external integrations

##### Data Flow Indicators

- User input flow from frontend to backend
- Audio stream processing path
- Call system interaction flow
- Speech recognition data flow

##### Key Components to Highlight

a) Audio Processing Pipeline:
- Flow from stream.py to rec.py
- Decoded.bin and voice.mp3 as artifacts

b) Client Interface:
- Demonstrate the relationship between client.py and the main application
- How SpeechClientBridge.py interfaces with Google services

##### Integration Points

Clearly mark:
- API endpoints from server.py
- External service connection points
- File system interaction points

##### Technical Stack Indicators

Labels for:
- React (Frontend)
- Python (Backend)
- Google Cloud Services
- WebSocket connections (if applicable)

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph Frontend
        WebUI["React Web Interface"]:::frontend
        CallComponent["Call Interface Component"]:::frontend
        StaticAssets["Static Assets"]:::frontend
        FrontConfig["Frontend Configuration"]:::frontend
        
        WebUI --> CallComponent
        WebUI --> StaticAssets
        WebUI --> FrontConfig
    end

    subgraph Backend
        Server["Backend Server"]:::backend
        MainApp["Main Application"]:::backend
        ClientInterface["Client Interface"]:::backend
        
        Server --> MainApp
        MainApp --> ClientInterface
    end

    subgraph AudioProcessing
        SpeechBridge["Speech Processing Bridge"]:::processing
        StreamProcessor["Audio Stream Processor"]:::processing
        RecordingComponent["Audio Recording Component"]:::processing
        AudioFiles["Audio Output Files"]:::processing
        
        StreamProcessor --> RecordingComponent
        RecordingComponent --> AudioFiles
        SpeechBridge --> StreamProcessor
    end

    subgraph ExternalServices
        GoogleCloud[("Google Cloud Services")]:::external
        PhoneSystem[("Phone System")]:::external
    end

    %% Component Relationships
    Frontend --> Backend
    Backend --> AudioProcessing
    AudioProcessing --> ExternalServices
    Backend --> ExternalServices

    %% Click Events
    click WebUI "https://github.com/FarzanAli/Call-IVR/tree/main/calling/src"
    click CallComponent "https://github.com/FarzanAli/Call-IVR/blob/main/calling/src/call.js"
    click Server "https://github.com/FarzanAli/Call-IVR/blob/main/calling/server/server.py"
    click SpeechBridge "https://github.com/FarzanAli/Call-IVR/blob/main/SpeechClientBridge.py"
    click ClientInterface "https://github.com/FarzanAli/Call-IVR/blob/main/client.py"
    click StreamProcessor "https://github.com/FarzanAli/Call-IVR/blob/main/stream.py"
    click RecordingComponent "https://github.com/FarzanAli/Call-IVR/blob/main/rec.py"
    click GoogleCloud "https://github.com/FarzanAli/Call-IVR/blob/main/google-creds.json"
    click AudioFiles "https://github.com/FarzanAli/Call-IVR/blob/main/voice.mp3"
    click MainApp "https://github.com/FarzanAli/Call-IVR/blob/main/main.py"
    click StaticAssets "https://github.com/FarzanAli/Call-IVR/tree/main/calling/public"
    click FrontConfig "https://github.com/FarzanAli/Call-IVR/blob/main/calling/package.json"

    %% Styling
    classDef frontend fill:#3498db,stroke:#2980b9,color:white
    classDef backend fill:#2ecc71,stroke:#27ae60,color:white
    classDef processing fill:#e74c3c,stroke:#c0392b,color:white
    classDef external fill:#f1c40f,stroke:#f39c12,color:black

    %% Legend
    subgraph Legend
        Frontend_L["Frontend Components"]:::frontend
        Backend_L["Backend Services"]:::backend
        Processing_L["Audio Processing"]:::processing
        External_L["External Services"]:::external
    end
```
