Skip to content

Instantly share code, notes, and snippets.

@bbaranoff
Created March 15, 2026 18:08
Show Gist options
  • Select an option

  • Save bbaranoff/0164d9355d7ab6d9b21a27a5ec64de16 to your computer and use it in GitHub Desktop.

Select an option

Save bbaranoff/0164d9355d7ab6d9b21a27a5ec64de16 to your computer and use it in GitHub Desktop.

osmo_egprs — Architecture multi-échelle

Niveau 1 — Un opérateur (1 conteneur)

flowchart TB
    subgraph container["Conteneur osmo-operator-N"]
        direction TB

        subgraph radio["Couche Radio (Um)"]
            MS1["MS 1<br/>mobile + trxcon"]
            MS2["MS 2<br/>mobile + trxcon"]
            MSn["MS n<br/>mobile + trxcon"]
            FAKETRX["fake_trx<br/>(TRXD bridge)"]
            BTS["osmo-bts-trx<br/>ARFCN 512+N×2"]
            MS1 & MS2 & MSn <-->|"TRXD v0<br/>UDP 6700+"| FAKETRX
            FAKETRX <-->|"TRXD v0<br/>UDP 5700"| BTS
        end

        subgraph core["Core Network (signalisation)"]
            STP["osmo-stp<br/>PC N.23.2<br/>:2905 M3UA"]
            BSC["osmo-bsc<br/>PC N.23.3"]
            MSC["osmo-msc<br/>PC N.23.1"]
            HLR["osmo-hlr<br/>:4222 GSUP"]
            MGW["osmo-mgw<br/>:2427 MGCP"]
            BTS -->|"Abis/IP<br/>OML+RSL"| BSC
            BSC -->|"SCCP via<br/>127.0.0.1:2905"| STP
            MSC -->|"SCCP via<br/>127.0.0.1:2905"| STP
            MSC -->|"GSUP<br/>127.0.0.2:4222"| HLR
            MSC -->|"MGCP"| MGW
        end

        subgraph data["Couche Data (GPRS/EGPRS)"]
            PCU["osmo-pcu"]
            SGSN["osmo-sgsn"]
            GGSN["osmo-ggsn<br/>apn0 TUN<br/>176.16.32.0/24"]
            BTS ---|"PCU socket"| PCU
            PCU -->|"Gb/NS-UDP"| SGSN
            SGSN -->|"GTP-U"| GGSN
        end

        subgraph voice["Voix (SIP/RTP)"]
            SIP["osmo-sip-connector<br/>MNCC ↔ SIP"]
            AST["Asterisk<br/>PJSIP :5060"]
            LP_A["Linphone A<br/>ext 100"]
            LP_B["Linphone B<br/>ext 200"]
            MSC -->|"MNCC socket<br/>/tmp/msc_mncc"| SIP
            SIP -->|"SIP<br/>127.0.0.1:5061→:5060"| AST
            MGW ---|"RTP 4002-16001"| AST
            AST --- LP_A & LP_B
        end

        subgraph sms["SMS (GSUP + interop)"]
            SMSC["proto-smsc-daemon<br/>GSUP → HLR"]
            RELAY["sms-interop-relay.py<br/>TCP :7890"]
            SENDMT["proto-smsc-sendmt"]
            HLR <-->|"GSUP IPA"| SMSC
            SMSC -->|"MO log parse"| RELAY
            RELAY -->|"MT injection"| SENDMT
            SENDMT -->|"UNIX socket"| SMSC
        end

        subgraph audio["Audio (isolé PulseAudio)"]
            GAPK["mobile io-handler gapk"]
            ALSAOUT["ALSA gsm_out"]
            PULSE["PulseAudio<br/>null-sink gsm_audio<br/>8kHz mono"]
            LOOP["module-loopback<br/>50ms"]
            HP["HP / casque"]
            GAPK --> ALSAOUT --> PULSE --> LOOP --> HP
        end
    end

    style container fill:#1a1a2e,stroke:#16213e,color:#e0e0e0
    style radio fill:#0f3460,stroke:#533483,color:#e0e0e0
    style core fill:#16213e,stroke:#0f3460,color:#e0e0e0
    style data fill:#1a1a2e,stroke:#533483,color:#e0e0e0
    style voice fill:#1e3a5f,stroke:#0f3460,color:#e0e0e0
    style sms fill:#2a1a4e,stroke:#533483,color:#e0e0e0
    style audio fill:#1a3a2e,stroke:#16213e,color:#e0e0e0
Loading

Niveau 2 — N opérateurs, 1 nœud

flowchart TB
    subgraph node["Nœud (1 serveur / VM)"]
        direction TB

        subgraph docker_net["Réseau Docker gsm-inter 172.20.0.0/24"]
            ISTP["osmo-inter-stp<br/>PC 0.0.0<br/>172.20.0.10:2908<br/>───────────<br/>N AS (1 par op)<br/>N×3 routes statiques<br/>masque 7.255.7"]
        end

        subgraph op1["Conteneur osmo-operator-1"]
            direction LR
            STP1["STP 1.1.2"]
            MSC1["MSC 1.1.1"]
            BSC1["BSC 1.1.3"]
            HLR1["HLR"]
            BTS1["BTS+MS×n"]
            AST1["Asterisk"]
            SMSC1["SMSC+Relay"]
            BTS1 --- BSC1 --- STP1 --- MSC1
            MSC1 --- HLR1
            MSC1 --- AST1
            HLR1 --- SMSC1
        end

        subgraph op2["Conteneur osmo-operator-2"]
            direction LR
            STP2["STP 1.2.2"]
            MSC2["MSC 1.2.1"]
            BSC2["BSC 1.2.3"]
            HLR2["HLR"]
            BTS2["BTS+MS×n"]
            AST2["Asterisk"]
            SMSC2["SMSC+Relay"]
            BTS2 --- BSC2 --- STP2 --- MSC2
            MSC2 --- HLR2
            MSC2 --- AST2
            HLR2 --- SMSC2
        end

        subgraph opN["Conteneur osmo-operator-N"]
            direction LR
            STPN["STP 1.N.2"]
            MSCN["MSC 1.N.1"]
            BSCN["BSC 1.N.3"]
            HLRN["HLR"]
            BTSN["BTS+MS×n"]
            ASTN["Asterisk"]
            SMSCN["SMSC+Relay"]
            BTSN --- BSCN --- STPN --- MSCN
            MSCN --- HLRN
            MSCN --- ASTN
            HLRN --- SMSCN
        end

        STP1 <-->|"M3UA SCTP<br/>172.20.0.11→:2908<br/>RCTX 150"| ISTP
        STP2 <-->|"M3UA SCTP<br/>172.20.0.12→:2908<br/>RCTX 250"| ISTP
        STPN <-->|"M3UA SCTP<br/>172.20.0.(10+N)→:2908<br/>RCTX N×100+50"| ISTP

        AST1 <-->|"SIP trunk<br/>172.20.0.11↔.12"| AST2
        AST1 <-->|"SIP trunk<br/>172.20.0.11↔.(10+N)"| ASTN
        AST2 <-->|"SIP trunk<br/>172.20.0.12↔.(10+N)"| ASTN

        SMSC1 <-->|"TCP :7890<br/>SMS interop"| SMSC2
        SMSC1 <-->|"TCP :7890"| SMSCN
        SMSC2 <-->|"TCP :7890"| SMSCN
    end

    WS["Wireshark<br/>br-gsm-inter<br/>sctp ∥ udp 4729"]
    node -.->|"GSMTAP"| WS

    style node fill:#0a0a1a,stroke:#1a1a3e,color:#e0e0e0
    style docker_net fill:#1a1a3e,stroke:#4a4a6e,color:#e0e0e0
    style op1 fill:#0f3460,stroke:#533483,color:#e0e0e0
    style op2 fill:#16213e,stroke:#533483,color:#e0e0e0
    style opN fill:#1e3a5f,stroke:#533483,color:#e0e0e0
    style ISTP fill:#533483,stroke:#e94560,color:#ffffff
Loading

Niveau 3 — N nœuds interconnectés (WAN)

flowchart TB
    subgraph nodeA["Nœud A — Serveur 82.66.x.x"]
        direction TB

        subgraph opsA["N opérateurs locaux"]
            direction LR
            A_OP1["Op1<br/>172.20.0.11<br/>Asterisk :5060<br/>SMSC :7890"]
            A_OP2["Op2<br/>172.20.0.12<br/>Asterisk :5060<br/>SMSC :7890"]
            A_OPN["OpN<br/>172.20.0.(10+N)"]
            A_ISTP["Inter-STP<br/>172.20.0.10:2908"]
            A_OP1 & A_OP2 & A_OPN <-->|M3UA| A_ISTP
            A_OP1 <-->|"SIP + TCP"| A_OP2
        end

        subgraph fwA["iptables DNAT"]
            A_NAT1[":5080 → Op1:5060<br/>:20000-20499 → Op1 RTP"]
            A_NAT2[":5082 → Op2:5060<br/>:20500-20999 → Op2 RTP"]
            A_NATN[":5080+2(N-1) → OpN"]
            A_SMS[":7890 → relay TCP"]
        end

        opsA --> fwA
    end

    subgraph nodeB["Nœud B — Serveur 37.59.x.x"]
        direction TB

        subgraph opsB["N opérateurs locaux"]
            direction LR
            B_OP1["Op1<br/>172.20.0.11<br/>Asterisk :5060<br/>SMSC :7890"]
            B_OP2["Op2<br/>172.20.0.12<br/>Asterisk :5060<br/>SMSC :7890"]
            B_OPN["OpN<br/>172.20.0.(10+N)"]
            B_ISTP["Inter-STP<br/>172.20.0.10:2908"]
            B_OP1 & B_OP2 & B_OPN <-->|M3UA| B_ISTP
            B_OP1 <-->|"SIP + TCP"| B_OP2
        end

        subgraph fwB["iptables DNAT"]
            B_NAT1[":5080 → Op1:5060"]
            B_NAT2[":5082 → Op2:5060"]
            B_NATN[":5080+2(N-1) → OpN"]
            B_SMS[":7890 → relay TCP"]
        end

        opsB --> fwB
    end

    subgraph nodeC["Nœud C — Serveur x.x.x.x"]
        direction TB
        C_OPS["N opérateurs<br/>+ Inter-STP<br/>+ iptables DNAT"]
    end

    fwA <-->|"SIP/RTP UDP<br/>préfixe 66<br/>appels voix"| fwB
    fwA <-->|"TCP :7890<br/>préfixe 66<br/>SMS JSON relay"| fwB
    fwA <-->|"SIP + TCP"| nodeC
    fwB <-->|"SIP + TCP"| nodeC

    subgraph legend["Protocoles WAN"]
        direction LR
        L1["Voix : SIP/PJSIP + RTP<br/>composer 66NXXXX = distant"]
        L2["SMS : TCP JSON relay<br/>sms-interop-relay.py"]
        L3["Routage : iptables DNAT<br/>port → conteneur"]
    end

    subgraph iot["Extension IoT (futur)"]
        direction LR
        DEV["Capteurs GSM<br/>SIM900 / Calypso"]
        OLLAMA["Ollama local<br/>Mistral / LLaMA"]
        DEV -->|"SMS MO"| A_OP1
        A_OP1 -->|"MO log → hook"| OLLAMA
        OLLAMA -->|"MT SMS inject"| A_OP1
        A_OP1 -->|"SMS MT"| DEV
    end

    style nodeA fill:#0a0a2a,stroke:#1a3a6e,color:#e0e0e0
    style nodeB fill:#0a0a2a,stroke:#1a3a6e,color:#e0e0e0
    style nodeC fill:#0a0a2a,stroke:#1a3a6e,color:#e0e0e0
    style opsA fill:#0f3460,stroke:#533483,color:#e0e0e0
    style opsB fill:#0f3460,stroke:#533483,color:#e0e0e0
    style fwA fill:#3a1a1a,stroke:#e94560,color:#e0e0e0
    style fwB fill:#3a1a1a,stroke:#e94560,color:#e0e0e0
    style legend fill:#1a1a1a,stroke:#4a4a4a,color:#c0c0c0
    style iot fill:#1a3a1a,stroke:#2a6a2a,color:#e0e0e0
Loading

Résumé des échelles

Niveau Unité Contenu Interconnexion
1 opérateur 1 conteneur BTS+MS, BSC, MSC, HLR, MGW, STP, SGSN/GGSN, Asterisk, SMSC 127.0.0.1 (intra)
N opérateurs 1 nœud N conteneurs + Inter-STP + Wireshark M3UA/SCTP (SS7), SIP trunks (voix), TCP 7890 (SMS)
N nœuds WAN N serveurs × N opérateurs SIP/RTP + iptables DNAT (voix), TCP JSON relay (SMS), préfixe 66
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment