Skip to content

System Architecture

This document describes the full Astradial voice infrastructure, covering the path from the PSTN through the NUC gateway to the cloud PBX.

High-Level Architecture

graph LR
    PSTN["PSTN"]
    TATA["Tata SBC<br/>10.79.215.102"]
    NUC["NUC Gateway<br/>10.54.225.90<br/>Asterisk 22"]
    WG["WireGuard Tunnel<br/>10.10.10.2 &harr; 10.10.10.1"]
    CLOUD["Cloud Server<br/>89.116.31.109<br/>Asterisk 20 + AstraPBX API"]
    ORGS["Organizations"]
    EXT["Extensions / Phones"]

    PSTN -->|"SIP/RTP"| TATA
    TATA -->|"NNI VLAN 1922"| NUC
    NUC -->|"PJSIP over WireGuard"| WG
    WG -->|"PJSIP"| CLOUD
    CLOUD --> ORGS
    ORGS --> EXT

Call Flows

Inbound (PSTN to Extension)

sequenceDiagram
    participant PSTN
    participant Tata as Tata SBC
    participant NUC as NUC Asterisk
    participant Cloud as Cloud Asterisk
    participant Ext as Extension/Phone

    PSTN->>Tata: INVITE (+918065978XXX)
    Tata->>NUC: INVITE via NNI
    Note over NUC: Context: from-tata
    NUC->>Cloud: PJSIP Dial(cloud-endpoint) via WireGuard
    Note over Cloud: Context: tata-inbound
    Cloud->>Cloud: tata-did-route (match DID to org)
    Note over Cloud: Context: org incoming
    Cloud->>Ext: Ring extension
    Ext-->>Cloud: 200 OK
    Cloud-->>NUC: 200 OK
    NUC-->>Tata: 200 OK
    Tata-->>PSTN: Connected
  1. Tata SBC sends the INVITE to the NUC over the NNI link.
  2. NUC Asterisk receives it in the from-tata context.
  3. The dialplan dials the cloud-endpoint via the WireGuard tunnel.
  4. Cloud Asterisk receives the call in the tata-inbound context.
  5. The tata-did-route logic matches the DID to an organization.
  6. The call enters the organization's incoming context and rings the target extension.

Outbound (Extension to PSTN)

sequenceDiagram
    participant Ext as Extension/Phone
    participant Cloud as Cloud Asterisk
    participant NUC as NUC Asterisk
    participant Tata as Tata SBC
    participant PSTN

    Ext->>Cloud: INVITE (dial out)
    Cloud->>NUC: PJSIP Dial(nuc-endpoint) via WireGuard
    Note over NUC: Context: from-cloud
    NUC->>Tata: PJSIP Dial(tata-endpoint)
    Tata->>PSTN: INVITE
    PSTN-->>Tata: 200 OK
    Tata-->>NUC: 200 OK
    NUC-->>Cloud: 200 OK
    Cloud-->>Ext: Connected
  1. Cloud Asterisk sends the call to the NUC over WireGuard.
  2. NUC Asterisk receives it in the from-cloud context.
  3. The dialplan dials the tata-endpoint which routes to the Tata SBC.
  4. Tata sends the call out to the PSTN.

Network Topology

NUC Interfaces

Interface Type IP Address Purpose
enp86s0 Ethernet (NNI) 10.54.225.90/30 Tata SBC connectivity
wlo1 WiFi 192.168.0.13 LAN / Internet access
enx* USB Ethernet 192.168.0.14 Backup LAN connectivity
wg0 WireGuard 10.10.10.2/24 Tunnel to cloud server

Network Diagram

graph TB
    subgraph "Tata Network"
        SBC["Tata SBC<br/>10.79.215.102"]
    end

    subgraph "NUC Gateway"
        NNI["enp86s0<br/>10.54.225.90/30"]
        WIFI["wlo1<br/>192.168.0.13"]
        USB["enx (USB Eth)<br/>192.168.0.14"]
        WG_NUC["wg0<br/>10.10.10.2"]
    end

    subgraph "Internet"
        WG_TUNNEL["WireGuard Tunnel<br/>UDP 51820"]
    end

    subgraph "Cloud Server"
        WG_CLOUD["wg0<br/>10.10.10.1"]
        CLOUD_PUB["Public IP<br/>89.116.31.109"]
        API["AstraPBX API"]
        AST["Asterisk 20"]
    end

    SBC --- NNI
    WIFI --- WG_TUNNEL
    WG_NUC --- WG_TUNNEL
    WG_TUNNEL --- WG_CLOUD
    WG_CLOUD --- AST
    CLOUD_PUB --- API

Technology Stack

Component Technology Location
SIP server (gateway) Asterisk 22, PJSIP NUC
SIP server (PBX) Asterisk 20, PJSIP Cloud
VPN tunnel WireGuard NUC + Cloud
Remote access Cloudflare Tunnel NUC
Monitoring Netdata NUC + Cloud
Uptime monitoring Upptime GitHub Pages
PBX API Node.js (AstraPBX) Cloud
Database MariaDB Cloud
DNS / CDN Cloudflare External