System Overview
Astradial is a multi-tenant cloud PBX platform for hotels and hospitals. The system handles inbound/outbound calls, AI voice bots, call queuing, recording, and automated workflows.
High-level architecture
┌──────────────┐
│ Tata PSTN │
│ (NNI SIP) │
└──────┬───────┘
│
┌──────┴───────┐
│ NUC Gateway │ On-premise (192.168.0.13)
│ Asterisk │ Receives PSTN, forwards via WireGuard
└──────┬───────┘
│ WireGuard (10.10.10.x)
┌──────┴───────┐
│ Cloud VPS │ Contabo (89.116.31.109)
│ │
│ ┌─────────┐ │
│ │Asterisk │ │ Multi-tenant PBX engine
│ │(PJSIP) │ │ Per-org contexts, DIDs, queues
│ └────┬────┘ │
│ │ │
│ ┌────┴────┐ │
│ │AstraPBX │ │ Node.js REST API (:8000)
│ │ API │ │ Org/DID/trunk/user management
│ └────┬────┘ │
│ │ │
│ ┌────┴────┐ │
│ │ Editor │ │ Next.js dashboard (:3001)
│ │ (UI) │ │ Admin panel, call logs, tickets
│ └─────────┘ │
│ │
│ ┌─────────┐ │
│ │Workflow │ │ Node.js + Bull + Postgres (:3002)
│ │ Engine │ │ Scheduled automations
│ └─────────┘ │
│ │
│ ┌─────────┐ │
│ │Pipecat │ │ Python + Gunicorn (:7860)
│ │Gateway │ │ AI voice bots (Gemini Live)
│ └─────────┘ │
│ │
│ ┌─────────┐ │
│ │MariaDB │ │ Org data, CDR, users, DIDs
│ │Postgres │ │ Workflows, scheduled jobs
│ │Redis │ │ Bull job queue
│ └─────────┘ │
└──────────────┘
│
┌──────┴───────┐
│ External │
│ Services │
│ │
│ Firebase │ Auth, Firestore (tickets, call logs)
│ GCS │ Recording storage
│ LogsUpdate │ Cloud Run (webhooks, auto-ticket)
│ Cloudflare │ DNS, CDN, Access policies
└──────────────┘
Services
| Service | Runtime | Port | Source repo | Role |
| Asterisk | C (20.18.2) | 5060/5080 UDP | astradial/sip-gateway | Multi-tenant PBX engine |
| AstraPBX API | Node.js | 8000 | astradial/astrapbx | REST API for all management |
| Flow Editor | Next.js | 3001 | astradial/astradial-editor | Dashboard + admin UI |
| Workflow Engine | Node.js | 3002 | astradial/workflow-engine | Scheduled automations (Bull) |
| Pipecat Gateway | Python | 7860 | astradial/pipecat-flow | AI voice bots |
| LogsUpdate | Python | Cloud Run | harisuryaa/LogsUpdate | Webhook processor |
Environments
| Production | Staging |
| VPS | 89.116.31.109 | 94.136.188.221 |
| Branch | main | staging |
| Deploy | Auto (self-hosted runner) | Auto (self-hosted runner) |
| Firestore | astrapbx/{orgId}/... | astrapbx_stage/{orgId}/... |
| Access | Public (Cloudflare) | Cloudflare Access gated |
Data flow for a phone call
1. Guest dials +918065978001
2. Tata PSTN → NUC Asterisk (SIP over NNI)
3. NUC → Cloud Asterisk (SIP over WireGuard)
4. Cloud Asterisk:
a. Identifies DID → routes to org context
b. Plays consent announcement (if enabled)
c. Starts recording (MixMonitor)
d. Routes to extension/queue/IVR/bot
5. Call ends → CDR written to MariaDB (ODBC)
6. CDR poller (30s) → classifies → POSTs to LogsUpdate
7. LogsUpdate → creates auto-ticket in Firestore (if missed call)
8. Recording → local disk → hourly cron → Firebase Storage (GCS)
9. Editor reads CDR via GET /api/v1/calls