# georgebregman/esp32-sip-voice architecture

> Architecture diagram of the GitHub repository georgebregman/esp32-sip-voice, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-08). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/georgebregman/esp32-sip-voice
- Repository: https://github.com/georgebregman/esp32-sip-voice

## Overview

This repository implements an ESP32 SIP VoIP phone. The main user-to-result path is web, keypad, touchscreen, or wake-word interaction through call control and SIP signaling; once a call is negotiated, the audio engine encodes and sends microphone audio over RTP and plays received audio. Separate branches provide network setup, persistent settings and phonebook, and device/graphical interfaces. The README documents capabilities such as STUN, themed LVGL screens, and dynamic hardware configuration; some of those implementation links are documented rather than visible in the sampled excerpts.

Main entry points: [`main/audio_pipeline.c`](https://github.com/georgebregman/esp32-sip-voice/blob/main/main/audio_pipeline.c) (Audio engine), [`main/sip_client.c`](https://github.com/georgebregman/esp32-sip-voice/blob/main/main/sip_client.c) (SIP client), [`main/ui_controller.c`](https://github.com/georgebregman/esp32-sip-voice/blob/main/main/ui_controller.c) (Web control), [`main/main.c`](https://github.com/georgebregman/esp32-sip-voice/blob/main/main/main.c) (Application bootstrap)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_connectivity["Network and SIP"]
  node_wifi["Wi-Fi manager<br/>[wifi_manager.c]"]
  node_sip["SIP client<br/>[sip_client.c]"]
end

subgraph group_voice["Voice and RTP"]
  node_audio["Audio engine<br/>[audio_pipeline.c]"]
  node_rtp["RTP and jitter buffer<br/>[rtp_handler.c]"]
  node_g711["G.711 codec<br/>[g711_codec.c]"]
  node_g722["G.722 codec<br/>[g722_codec.c]"]
  node_opus["OPUS codec<br/>[opus_codec.c]"]
  node_aec["AEC filter<br/>[aec_filter.c]"]
  node_wake["Wake-word detector<br/>[wake_word.c]"]
end

subgraph group_interaction["User interfaces"]
  node_web["Web control<br/>[ui_controller.c]"]
  node_lvgl["LVGL screens<br/>[ui_lvgl.c]"]
  node_app["Application bootstrap<br/>[main.c]"]
end

subgraph group_device["Hardware I/O"]
  node_keypad["Matrix keypad<br/>[keypad.c]"]
  node_tft["TFT display<br/>[display_tft.c]"]
  node_touch["Touch input<br/>[touch_driver.c]"]
  node_codec_driver["I2S codec driver<br/>[codec_driver.c]"]
  node_display["Status display<br/>[display.c]"]
end

subgraph group_persistence["Configuration and contacts"]
  node_config[("Settings manager<br/>[config_manager.c]")]
  node_phonebook[("Phonebook<br/>[phonebook.c]")]
end

node_user(("Phone user"))
node_sip_server(("SIP server"))
node_stun(("STUN service"))

node_user -->|"controls calls"| node_web
node_user -->|"dials with"| node_keypad
node_user -->|"uses touchscreen"| node_lvgl
node_web -->|"requests calls"| node_sip
node_web -->|"manages contacts"| node_phonebook
node_web -.->|"saves settings"| node_config
node_keypad -.->|"initiates calls"| node_sip
node_lvgl -->|"reads input"| node_touch
node_lvgl -->|"uses display"| node_tft
node_app -->|"initializes"| node_wifi
node_app -->|"initializes"| node_sip
node_app -->|"initializes"| node_web
node_app -.->|"initializes"| node_lvgl
node_wifi -.->|"loads credentials"| node_config
node_wifi -.->|"provides connectivity"| node_sip
node_sip -->|"signals calls"| node_sip_server
node_sip -->|"discovers public endpoint"| node_stun
node_sip -->|"provides negotiated media"| node_audio
node_audio -->|"sends and receives"| node_rtp
node_audio -->|"encodes and decodes"| node_g711
node_audio -->|"dispatches codec"| node_g722
node_audio -->|"dispatches codec"| node_opus
node_audio -->|"initializes audio hardware"| node_codec_driver
node_audio -.->|"uses filter"| node_aec
node_audio -->|"feeds audio"| node_wake
node_wake -.->|"triggers call"| node_web
node_audio -.->|"plays call audio"| node_user
node_config -->|"supplies hardware settings"| node_tft
node_config -->|"supplies hardware settings"| node_touch
node_config -->|"supplies pin settings"| node_keypad
node_app -.->|"initializes"| node_phonebook

click node_wifi "https://github.com/georgebregman/esp32-sip-voice/blob/main/main/wifi_manager.c"
click node_sip "https://github.com/georgebregman/esp32-sip-voice/blob/main/main/sip_client.c"
click node_web "https://github.com/georgebregman/esp32-sip-voice/blob/main/main/ui_controller.c"
click node_lvgl "https://github.com/georgebregman/esp32-sip-voice/blob/main/components/ui_lvgl/ui_lvgl.c"
click node_keypad "https://github.com/georgebregman/esp32-sip-voice/blob/main/components/board_hal/keypad.c"
click node_tft "https://github.com/georgebregman/esp32-sip-voice/blob/main/components/board_hal/display_tft.c"
click node_touch "https://github.com/georgebregman/esp32-sip-voice/blob/main/components/board_hal/touch_driver.c"
click node_audio "https://github.com/georgebregman/esp32-sip-voice/blob/main/main/audio_pipeline.c"
click node_rtp "https://github.com/georgebregman/esp32-sip-voice/blob/main/main/rtp_handler.c"
click node_g711 "https://github.com/georgebregman/esp32-sip-voice/blob/main/main/g711_codec.c"
click node_g722 "https://github.com/georgebregman/esp32-sip-voice/blob/main/components/audio_pipeline/g722_codec.c"
click node_opus "https://github.com/georgebregman/esp32-sip-voice/blob/main/components/audio_pipeline/opus_codec.c"
click node_aec "https://github.com/georgebregman/esp32-sip-voice/blob/main/components/audio_pipeline/aec_filter.c"
click node_wake "https://github.com/georgebregman/esp32-sip-voice/blob/main/components/audio_pipeline/wake_word.c"
click node_codec_driver "https://github.com/georgebregman/esp32-sip-voice/blob/main/main/codec_driver.c"
click node_config "https://github.com/georgebregman/esp32-sip-voice/blob/main/components/config_store/config_manager.c"
click node_phonebook "https://github.com/georgebregman/esp32-sip-voice/blob/main/components/storage/phonebook.c"
click node_display "https://github.com/georgebregman/esp32-sip-voice/blob/main/main/display.c"
click node_app "https://github.com/georgebregman/esp32-sip-voice/blob/main/main/main.c"

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_wifi,node_sip,node_user toneBlue
class node_audio,node_rtp,node_g711,node_g722,node_opus,node_aec,node_wake toneAmber
class node_web,node_lvgl,node_app,node_sip_server toneMint
class node_keypad,node_tft,node_touch,node_codec_driver,node_display toneRose
class node_config,node_phonebook,node_stun toneIndigo
```

## Components

### Network and SIP

- [Wi-Fi manager](https://github.com/georgebregman/esp32-sip-voice/blob/main/main/wifi_manager.c): `main/wifi_manager.c`
- [SIP client](https://github.com/georgebregman/esp32-sip-voice/blob/main/main/sip_client.c): `main/sip_client.c`

### Voice and RTP

- [Audio engine](https://github.com/georgebregman/esp32-sip-voice/blob/main/main/audio_pipeline.c): `main/audio_pipeline.c`
- [RTP and jitter buffer](https://github.com/georgebregman/esp32-sip-voice/blob/main/main/rtp_handler.c): `main/rtp_handler.c`
- [G.711 codec](https://github.com/georgebregman/esp32-sip-voice/blob/main/main/g711_codec.c): `main/g711_codec.c`
- [G.722 codec](https://github.com/georgebregman/esp32-sip-voice/blob/main/components/audio_pipeline/g722_codec.c): `components/audio_pipeline/g722_codec.c`
- [OPUS codec](https://github.com/georgebregman/esp32-sip-voice/blob/main/components/audio_pipeline/opus_codec.c): `components/audio_pipeline/opus_codec.c`
- [AEC filter](https://github.com/georgebregman/esp32-sip-voice/blob/main/components/audio_pipeline/aec_filter.c): `components/audio_pipeline/aec_filter.c`
- [Wake-word detector](https://github.com/georgebregman/esp32-sip-voice/blob/main/components/audio_pipeline/wake_word.c): `components/audio_pipeline/wake_word.c`

### User interfaces

- [Web control](https://github.com/georgebregman/esp32-sip-voice/blob/main/main/ui_controller.c): `main/ui_controller.c`
- [LVGL screens](https://github.com/georgebregman/esp32-sip-voice/blob/main/components/ui_lvgl/ui_lvgl.c): `components/ui_lvgl/ui_lvgl.c`
- [Application bootstrap](https://github.com/georgebregman/esp32-sip-voice/blob/main/main/main.c): `main/main.c`

### Hardware I/O

- [Matrix keypad](https://github.com/georgebregman/esp32-sip-voice/blob/main/components/board_hal/keypad.c): `components/board_hal/keypad.c`
- [TFT display](https://github.com/georgebregman/esp32-sip-voice/blob/main/components/board_hal/display_tft.c): `components/board_hal/display_tft.c`
- [Touch input](https://github.com/georgebregman/esp32-sip-voice/blob/main/components/board_hal/touch_driver.c): `components/board_hal/touch_driver.c`
- [I2S codec driver](https://github.com/georgebregman/esp32-sip-voice/blob/main/main/codec_driver.c): `main/codec_driver.c`
- [Status display](https://github.com/georgebregman/esp32-sip-voice/blob/main/main/display.c): `main/display.c`

### Configuration and contacts

- [Settings manager](https://github.com/georgebregman/esp32-sip-voice/blob/main/components/config_store/config_manager.c): `components/config_store/config_manager.c`
- [Phonebook](https://github.com/georgebregman/esp32-sip-voice/blob/main/components/storage/phonebook.c): `components/storage/phonebook.c`

### Other components

- **Phone user**
- **SIP server**
- **STUN service**

## Connections

- Phone user → Web control: controls calls
- Phone user → Matrix keypad: dials with
- Phone user → LVGL screens: uses touchscreen
- Web control → SIP client: requests calls (evidence: `main/ui_controller.c`)
- Web control → Phonebook: manages contacts (evidence: `main/ui_controller.c`)
- Web control → Settings manager: saves settings
- Matrix keypad → SIP client: initiates calls
- LVGL screens → Touch input: reads input (evidence: `components/ui_lvgl/ui_lvgl.c`)
- LVGL screens → TFT display: uses display (evidence: `components/ui_lvgl/ui_lvgl.c`)
- Application bootstrap → Wi-Fi manager: initializes
- Application bootstrap → SIP client: initializes
- Application bootstrap → Web control: initializes
- Application bootstrap → LVGL screens: initializes
- Wi-Fi manager → Settings manager: loads credentials
- Wi-Fi manager → SIP client: provides connectivity
- SIP client → SIP server: signals calls
- SIP client → STUN service: discovers public endpoint
- SIP client → Audio engine: provides negotiated media (evidence: `main/audio_pipeline.c`)
- Audio engine → RTP and jitter buffer: sends and receives (evidence: `main/audio_pipeline.c`)
- Audio engine → G.711 codec: encodes and decodes (evidence: `main/audio_pipeline.c`)
- Audio engine → G.722 codec: dispatches codec (evidence: `main/audio_pipeline.c`)
- Audio engine → OPUS codec: dispatches codec (evidence: `main/audio_pipeline.c`)
- Audio engine → I2S codec driver: initializes audio hardware (evidence: `main/audio_pipeline.c`)
- Audio engine → AEC filter: uses filter
- Audio engine → Wake-word detector: feeds audio (evidence: `main/audio_pipeline.c`)
- Wake-word detector → Web control: triggers call
- Audio engine → Phone user: plays call audio
- Settings manager → TFT display: supplies hardware settings (evidence: `components/board_hal/display_tft.c`)
- Settings manager → Touch input: supplies hardware settings (evidence: `components/board_hal/touch_driver.c`)
- Settings manager → Matrix keypad: supplies pin settings (evidence: `components/board_hal/keypad.c`)
- Application bootstrap → Phonebook: initializes
