# herlesupreeth/kamailio_ims_config architecture

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

- Interactive diagram: https://gitdiagram.com/herlesupreeth/kamailio_ims_config
- Repository: https://github.com/herlesupreeth/kamailio_ims_config

## Overview

##### Project type and purpose
- This is an IMS (IP Multimedia Subsystem) configuration repository. It provides Kamailio‐based implementations of P-CSCF, I-CSCF, and S-CSCF for VoLTE and VoIP testing, integrating with an EPC (Open5GS) and HSS (Fraunhofer OpenHSS), plus RTPEngine for media anchoring.

##### File structure
- Top‐level files: README.md, two host files (epc.mnc001…, ims.mnc001…)
- Subdirectories for each network function:
- kamailio_pcscf/  (P-CSCF configs, dispatcher lists, route scripts, SEMS profiles, TLS)
- kamailio_icscf/  (I-CSCF configs, XML schemas, SQL schema)
- kamailio_scscf/  (S-CSCF configs, XML schemas, dispatcher list)
- Each directory contains:
- .cfg files (Kamailio configuration)
- .xml/.xsd files (SIP headers & Diameter interfaces)
- SQL or dispatcher lists (database schema, load balancing)

##### README for additional insights
- Components: Kamailio (5.2.4), RTPEngine (7.4.1.5), Fraunhofer OpenHSS
- Testbed: UEs ↔ eNodeB ↔ EPC+IMS VM (OpenStack or bare metal)
- Two scenarios: VoLTE (UE–IMS+EPC–UE) and VoIP (UE–IMS–UE)

##### Main components & their relationships
a. User Equipment (UE1, UE2 or Alice/Bob SIP clients)
b. eNodeB (radio access)
c. EPC Core (MME, SGW, PGW from Open5GS)
d. IMS Core:
- P-CSCF (kamailio_pcscf) – first SIP contact point
- I-CSCF (kamailio_icscf) – SIP routing/discovery
- S-CSCF (kamailio_scscf) – SIP session control
- HSS (Fraunhofer OpenHSS) – subscriber database (uses Diameter)
- RTPEngine – RTP media anchoring / NAT traversal
e. Network elements: DNS (dispatcher lists), TLS for SIP over TLS

Data flows:
- SIP REGISTER/INVITE from UE → P-CSCF → I-CSCF → S-CSCF → (S-CSCF→HSS via Diameter for auth)
- RTP/RTCP streams anchored via RTPEngine
- Diameter Cx and Sh between S-CSCF/I-CSCF and HSS

##### Architectural patterns & design principles
- Microservices‐style split of IMS functions (three separate Kamailio instances)
- Dispatcher lists provide load balancing/failover
- SEMS scripting for SBC‐like media policy enforcement in P-CSCF
- Config directories mirror 3GPP IMS functional split (Cx interfaces, XML schemas)

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Access Network
    subgraph "Access Network" 
        class AccessNetwork infra
        UE1["User Equipment (UE1)"]:::access
        UE2["User Equipment (UE2)"]:::access
        ENB["eNodeB"]:::infra
    end

    %% Core Network
    subgraph "Core Network"
        class CoreNetwork infra
        subgraph "EPC Core"
            MME["MME"]:::core
            SGW["SGW"]:::core
            PGW["PGW"]:::core
        end
        subgraph "IMS Core"
            PCSCF["P-CSCF"]:::cscf
            ICSCF["I-CSCF"]:::cscf
            SCSCF["S-CSCF"]:::cscf
        end
    end

    %% Supporting Services
    HSS["HSS"]:::db
    RTPE["RTPEngine"]:::media

    %% Connections SIP signaling
    UE1 -->|"SIP REGISTER/INVITE"| PCSCF
    UE2 -->|"SIP REGISTER/INVITE"| PCSCF
    PCSCF -->|"SIP Proxy"| ICSCF
    ICSCF -->|"SIP Proxy"| SCSCF
    SCSCF -->|"SIP Proxy"| UE1
    SCSCF -->|"SIP Proxy"| UE2

    %% Diameter signaling
    SCSCF -->|"Diameter Cx/Sh"| HSS
    ICSCF -->|"Diameter Cx"| HSS

    %% RTP media
    UE1 -->|"RTP/RTCP"| RTPE
    UE2 -->|"RTP/RTCP"| RTPE

    %% GTP signaling
    UE1 --> ENB
    UE2 --> ENB
    ENB -->|"GTP-U/C"| MME
    MME --> SGW
    SGW --> PGW

    %% Click Events
    click PCSCF "https://github.com/herlesupreeth/kamailio_ims_config/tree/master/kamailio_pcscf/"
    click ICSCF "https://github.com/herlesupreeth/kamailio_ims_config/tree/master/kamailio_icscf/"
    click SCSCF "https://github.com/herlesupreeth/kamailio_ims_config/tree/master/kamailio_scscf/"
    click HSS "https://github.com/herlesupreeth/kamailio_ims_config/blob/master/README.md"
    click RTPE "https://github.com/herlesupreeth/kamailio_ims_config/blob/master/README.md"
    click MME "https://github.com/herlesupreeth/kamailio_ims_config/blob/master/epc.mnc001.mcc001.3gppnetwork.org"
    click PGW "https://github.com/herlesupreeth/kamailio_ims_config/blob/master/ims.mnc001.mcc001.3gppnetwork.org"

    %% Styles
    classDef access fill:#E3F2FD,stroke:#42A5F5,color:#0D47A1
    classDef infra fill:#ECEFF1,stroke:#607D8B,color:#37474F
    classDef core fill:#BBDEFB,stroke:#2196F3,color:#0D47A1
    classDef cscf fill:#E8F5E9,stroke:#43A047,color:#1B5E20
    classDef db fill:#FFF3E0,stroke:#FB8C00,color:#E65100
    classDef media fill:#F3E5F5,stroke:#9C27B0,color:#4A148C
    classDef AccessNetwork infra
    classDef CoreNetwork infra
```
