--- title: "☁️ Cloudflare, Multi-SBC & BSS Unified Subdomain Routing" description: "End-to-end carrier guide for configuring Cloudflare Wildcard DNS & Load Balancing, Multi-SBC TLS/Reverse Proxy, and Ring2All BSS so customers register SIP devices and manage their Mini-PBX on a single unified sub-subdomain (e.g., acme.pbx.carrier.com)." --- > Carrier architecture and deployment guide for configuring **Cloudflare**, **2+ Ring2All SBC** perimeter nodes, and **Ring2All BSS** so that every provisioned Mini-PBX sub-subdomain (e.g., `acme.pbx.carrier.com`) handles **SIP device registration, WebRTC calling, zero-touch phone provisioning, and Mini-PBX web administration** from a single unified FQDN with automatic load balancing and zero per-tenant DNS API calls. --- ## 🎯 User Roles & Key Capabilities | Role | Primary Use Case | Key Capabilities | | :--- | :--- | :--- | | **Cloud & Network Architect** | Designing multi-level wildcard DNS & Edge traffic steering. | Separate Cloudflare Orange-Cloud web portals from Gray-Cloud VoIP load balancing across multi-SBC pools without DNS record limits. | | **SBC & VoIP Perimeter Engineer** | Terminating wildcard TLS, WSS, and tenant HTTPS edge traffic. | Issue multi-level Let's Encrypt wildcard certificates (`*.pbx.carrier.com`) via Cloudflare `DNS-01`, isolate SBC admin SNI, and proxy tenant web/WebRTC/ZTP traffic to private **Ring2All PBX** clusters. | | **BSS Product Catalog Manager** | Zero-touch Mini-PBX domain provisioning on subscription checkout. | Bind a predefined **Root FQDN Domain** (`pbx.carrier.com`) in **Ring2All BSS** plans so customer orders automatically synchronize across all active **Ring2All SBC** nodes. | --- ## Table of Contents 1. [Architectural Overview: Unified Sub-Subdomain for SIP & Web](#1-architectural-overview-unified-sub-subdomain-for-sip--web) 2. [Cloudflare Proxy Modes: Orange Cloud vs. Gray Cloud for VoIP](#2-cloudflare-proxy-modes-orange-cloud-vs-gray-cloud-for-voip) 3. [Step 1: Configuring Cloudflare Wildcard DNS & Multi-SBC Load Balancing](#3-step-1-configuring-cloudflare-wildcard-dns--multi-sbc-load-balancing) 4. [Step 2: Issuing Wildcard TLS Certificates (*.pbx.carrier.com) via Cloudflare DNS-01](#4-step-2-issuing-wildcard-tls-certificates-pbxcarriercom-via-cloudflare-dns-01) 5. [Step 3: Configuring Ring2All SBC for Unified HTTPS, WebRTC & SIP Routing](#5-step-3-configuring-ring2all-sbc-for-unified-https-webrtc--sip-routing) 6. [Step 4: Configuring Ring2All BSS for Zero-Touch Subdomain Provisioning](#6-step-4-configuring-ring2all-bss-for-zero-touch-subdomain-provisioning) 7. [Unified Customer Endpoint Reference](#7-unified-customer-endpoint-reference) 8. [Optional Scenarios: When Is Cloudflare DNS API Integration Needed?](#8-optional-scenarios-when-is-cloudflare-dns-api-integration-needed) 9. [Operational Verification & Failover Testing](#9-operational-verification--failover-testing) --- ## 1. Architectural Overview: Unified Sub-Subdomain for SIP & Web When a subscriber purchases a hosted **Mini-PBX** or **Bundle** plan in **Ring2All BSS**, the operator predefines a parent domain (`Root FQDN Domain`, e.g., `pbx.carrier.com`) and the customer chooses only their unique tenant prefix (e.g., `acme`), resulting in the unified sub-subdomain **`acme.pbx.carrier.com`**. By combining a **predefined Cloudflare Wildcard (`*.pbx.carrier.com`)** in **DNS-Only (Gray Cloud)** load-balanced mode with SNI-aware **Ring2All SBC** edge routing, that single FQDN operates across all four customer planes simultaneously: 1. **SIP Hardware & Softphones**: Registers via SIP `UDP/TCP 5060` or `SIP TLS 5061` and exchanges `RTP/SRTP 16384–49152` media through **Ring2All SBC** and **RTPEngine 12.5+**. 2. **Browser WebRTC Softphones**: Establishes `wss://acme.pbx.carrier.com/webrtc` over standard HTTPS port `443`, proxied locally to the **Ring2All SBC** WSS listener (`:7443`) for `ICE + DTLS-SRTP` bridging. 3. **Zero-Touch Phone Auto-Provisioning**: Fetches device XML/CFG profiles over `https://acme.pbx.carrier.com/provisioning/...` with telephony `User-Agent` validation. 4. **Mini-PBX Web Administration, Ring2All Connect & Ring2All Switchboard**: Serves `https://acme.pbx.carrier.com`, `/portal`, and `/switchboard` via **Ring2All SBC** edge reverse proxy over the private LAN or WireGuard mesh to stateless **Ring2All PBX** Web/API nodesβ€”keeping all core PBX servers 100% shielded from direct public internet exposure. ```mermaid flowchart TD subgraph PublicClients["Customer Devices & Browsers"] StoreUser["Buyer Browser
https://store.carrier.com"] AdminBrowser["Tenant Browser
https://acme.pbx.carrier.com
(/admin, /portal, /switchboard)"] SipPhone["SIP Hardphones & Softphones
sip:101@acme.pbx.carrier.com
(UDP/TCP 5060, TLS 5061, RTP)"] end subgraph Cloudflare["Cloudflare Global DNS & Edge"] CF_Orange["Cloudflare Orange Cloud (WAF + CDN)
store.carrier.com"] CF_Gray["Cloudflare Gray Cloud Load Balancer
*.pbx.carrier.com (DNS-Only, TTL 30s, Health Checks)"] end subgraph BillingDMZ["Ring2All BSS Storefront"] BSS["Ring2All BSS Client Store
(198.51.100.50)"] end subgraph SBCPerimeter["Ring2All SBC Cluster (Public Edge)"] SBC1["Ring2All SBC Node 01 (203.0.113.10)
Kamailio 6.1 + RTPEngine 12.5 + Nginx Edge"] SBC2["Ring2All SBC Node 02 (203.0.113.11)
Kamailio 6.1 + RTPEngine 12.5 + Nginx Edge"] end subgraph PrivateCore["Private Core Network (Zero Public Exposure)"] PBXWeb["Ring2All PBX Web & API Cluster
10.10.10.20 / 10.10.10.21 (:80 / :3001)"] PBXTel["Ring2All PBX Telephony Nodes
10.9.0.2 / 10.9.0.3 (WireGuard Mesh)"] PG[("Centralized PostgreSQL 17 HA Cluster
Shared Domains, Branding & Registrations")] end StoreUser --> CF_Orange CF_Orange --> BSS AdminBrowser --> CF_Gray SipPhone --> CF_Gray CF_Gray -->|"Balanced + Health-Checked"| SBC1 CF_Gray -->|"Balanced + Health-Checked"| SBC2 SBC1 -->|"HTTPS/WSS/ZTP Proxy"| PBXWeb SBC2 -->|"HTTPS/WSS/ZTP Proxy"| PBXWeb SBC1 <-->|"SIP Dispatcher + RTP via wg0"| PBXTel SBC2 <-->|"SIP Dispatcher + RTP via wg0"| PBXTel PBXWeb --> PG PBXTel --> PG SBC1 --> PG SBC2 --> PG ``` --- ## 2. Cloudflare Proxy Modes: Orange Cloud vs. Gray Cloud for VoIP Understanding Cloudflare's proxy behavior is mandatory before exposing a unified sub-subdomain: * **Cloudflare Proxied (Orange Cloud)**: Designed exclusively for HTTP/HTTPS web applications (`store.carrier.com`, `app.carrier.com`, `docs.carrier.com`). Cloudflare replaces your origin IP with shared Anycast web IPs that **accept only HTTP/HTTPS ports** (`80`, `443`, and select web ports) and **drop all SIP (`5060`/`5061`) and UDP RTP (`16384–49152`) traffic**. * **Cloudflare DNS-Only (Gray Cloud)**: Returns your real **Ring2All SBC** public IP addresses (`203.0.113.10`, `203.0.113.11`) directly to clients, allowing **SIP, SIP TLS, RTP/SRTP, HTTPS, WebRTC WSS, and ZTP provisioning** to terminate cleanly on the **Ring2All SBC** perimeter. ### Recommended Cloudflare DNS Zone Table (`carrier.com`) | Type | Name / Host | Target / Value | Proxy Status | TTL | Purpose | | :--- | :--- | :--- | :--- | :--- | :--- | | **A** | `store` | `198.51.100.50` | **Proxied (Orange Cloud)** | Auto | Public **Ring2All BSS** Customer Storefront protected by Cloudflare WAF/CDN. | | **LB / A** | `*.pbx` | Pool: `203.0.113.10`, `203.0.113.11` | **DNS-Only (Gray Cloud)** | `30s` | Unified wildcard for all Mini-PBX tenants (`acme.pbx.carrier.com`) across SIP, WebRTC, ZTP, and Web Admin. | | **A / LB** | `pbx` | Pool: `203.0.113.10`, `203.0.113.11` | **DNS-Only (Gray Cloud)** | `30s` | Optional apex hostname for the voice cluster. | | **A** | `sbc1.pbx` | `203.0.113.10` | **DNS-Only (Gray Cloud)** | `60s` | Direct static hostname for `SBC-01` (used as Primary Outbound Proxy in **Ring2All DMS** templates). | | **A** | `sbc2.pbx` | `203.0.113.11` | **DNS-Only (Gray Cloud)** | `60s` | Direct static hostname for `SBC-02` (used as Secondary Outbound Proxy in **Ring2All DMS** templates). | | **A** | `sbc01-admin` | `203.0.113.10` | **DNS-Only (Gray Cloud)** *(or VPN)* | `60s` | Dedicated NOC management hostname for `SBC-01` Web UI. | | **A** | `sbc02-admin` | `203.0.113.11` | **DNS-Only (Gray Cloud)** *(or VPN)* | `60s` | Dedicated NOC management hostname for `SBC-02` Web UI. | > [!IMPORTANT] > **Why Predefined Wildcard Outperforms Per-Order Cloudflare API Provisioning:** > 1. **0 ms Activation & Zero External Failure Points**: Mini-PBX activation never blocks or fails due to Cloudflare API rate limits or DNS propagation delays. > 2. **Unlimited Tenant Scale**: Standard Cloudflare zones enforce per-zone DNS record quotas (typically 1,000–3,500 records). A single `*.pbx.carrier.com` wildcard supports tens of thousands of Mini-PBX customers. > 3. **Single Wildcard TLS Certificate**: One wildcard certificate (`*.pbx.carrier.com`) covers SIP TLS, WebRTC WSS, ZTP provisioning, and HTTPS Admin for all existing and future tenants. --- ## 3. Step 1: Configuring Cloudflare Wildcard DNS & Multi-SBC Load Balancing Choose **Option A** for production high availability with automated health checks, or **Option B** for zero-cost laboratory/starter clusters. ### Option A: Cloudflare Load Balancer in DNS-Only (Gray Cloud) Mode (Recommended) In the Cloudflare Dashboard, navigate to **Traffic β†’ Load Balancing**: 1. **Create an Active Health Monitor**: * **Type**: `HTTPS` * **Port**: `443` * **Path**: `/health` * **Interval**: `15 seconds` * **Timeout**: `3 seconds` * **Retries**: `2` * **Expected Response Code**: `200` * **Follow Redirects**: Disabled * **Allow Insecure Certificate**: Disabled *(once Step 2 wildcard TLS is installed)* 2. **Create an Origin Pool (`ring2all-sbc-perimeter`)**: * Add Origin 1: Name `sbc-node-01`, Address `203.0.113.10`, Weight `1`, Enabled. * Add Origin 2: Name `sbc-node-02`, Address `203.0.113.11`, Weight `1`, Enabled. * *(Add `sbc-node-03..N` seamlessly as your perimeter scales horizontally.)* * **Health Threshold**: `1` (pool stays healthy as long as at least one SBC responds). * Attach the `/health` Monitor created above. 3. **Create the Wildcard Load Balancer**: * **Hostname**: `*.pbx.carrier.com` * **Proxy Status**: **DNS Only (Gray Cloud)** *(click the orange cloud icon until it turns gray)* * **TTL**: `30 seconds` * **Fallback Pool**: `ring2all-sbc-perimeter` * **Traffic Steering**: Choose **Dynamic Steering** (routes clients to the lowest-latency healthy SBC), **Geo-Steering** (regional SBC pinning), or **Random** (equal 50/50 distribution across all healthy SBCs). When an SBC undergoes maintenance or loses connectivity, Cloudflare detects the failed `/health` probe and stops returning that SBC's IP in DNS responses within 30 seconds. ### Option B: Multi-A Wildcard DNS Round-Robin (Zero-Cost Starter) If you do not have the Cloudflare Load Balancing add-on enabled, navigate to **DNS β†’ Records** and create multiple `A` records sharing the exact same wildcard name: | Type | Name | IPv4 Address | Proxy Status | TTL | | :--- | :--- | :--- | :--- | :--- | | **A** | `*.pbx` | `203.0.113.10` | **DNS only (Gray Cloud)** | `1 min` | | **A** | `*.pbx` | `203.0.113.11` | **DNS only (Gray Cloud)** | `1 min` | * **Behavior**: Cloudflare DNS distributes queries in round-robin order across all listed SBC IPs at zero extra cost. * **Limitation**: Standard DNS `A` records lack active health checks; if `SBC-01` goes offline, Cloudflare continues returning `203.0.113.10` to 50% of DNS queries until you manually disable or remove that record. ### Complementary Carrier Best Practice: Outbound Proxy Failover via Ring2All DMS Even with a 30-second DNS TTL, physical IP phones cache resolved IP addresses until their local SIP registration timer expires. In **Ring2All DMS** hardware templates, combine the unified sub-subdomain with explicit SBC Outbound Proxies: * **SIP Server / Domain / Realm**: `.pbx.carrier.com` (e.g., `acme.pbx.carrier.com`) * **Outbound Proxy 1 (Primary)**: `sbc1.pbx.carrier.com` * **Outbound Proxy 2 (Backup)**: `sbc2.pbx.carrier.com` With this configuration, the phone keeps `acme.pbx.carrier.com` as its SIP identity and authentication realm while failing over between `SBC-01` and `SBC-02` in milliseconds without waiting for DNS TTL expiration. --- ## 4. Step 2: Issuing Wildcard TLS Certificates (`*.pbx.carrier.com`) via Cloudflare DNS-01 > [!IMPORTANT] > Cloudflare's built-in *Universal SSL* covers only first-level subdomains (`*.carrier.com`), not second-level wildcards (`*.pbx.carrier.com`). Because `*.pbx.carrier.com` runs in **Gray Cloud (DNS-Only)** mode, TLS terminates directly on your **Ring2All SBC** nodesβ€”allowing **Let's Encrypt (`certbot`)** with the **Cloudflare DNS-01 plugin** to issue and auto-renew a valid multi-level wildcard certificate (`pbx.carrier.com` + `*.pbx.carrier.com`) at zero cost. Execute the following steps on your **Ring2All SBC** nodes (or issue once on `SBC-01` and replicate `/etc/letsencrypt/` over SSH/cron to `SBC-02..N` so all SBCs share the exact same certificate): ### 1. Create a Scoped Cloudflare API Token In the Cloudflare Dashboard (**My Profile β†’ API Tokens β†’ Create Token**), create a custom token with minimal permissions: * **Permissions**: `Zone` β†’ `DNS` β†’ `Edit` * **Zone Resources**: `Include` β†’ `Specific zone` β†’ `carrier.com` ### 2. Install Certbot & Cloudflare DNS Plugin (Debian 13) ```bash apt-get update apt-get install -y certbot python3-certbot-dns-cloudflare ``` ### 3. Store the Scoped Credentials Securely ```bash cat << 'EOF' > /etc/letsencrypt/cloudflare.ini dns_cloudflare_api_token = YOUR_SCOPED_CLOUDFLARE_API_TOKEN EOF chmod 600 /etc/letsencrypt/cloudflare.ini ``` ### 4. Issue the Multi-Level Wildcard Certificate ```bash certbot certonly \ --dns-cloudflare \ --dns-cloudflare-credentials /etc/letsencrypt/cloudflare.ini \ --dns-cloudflare-propagation-seconds 30 \ --non-interactive --agree-tos -m noc@carrier.com \ -d "pbx.carrier.com" \ -d "*.pbx.carrier.com" ``` This generates: * **Certificate Chain**: `/etc/letsencrypt/live/pbx.carrier.com/fullchain.pem` * **Private Key**: `/etc/letsencrypt/live/pbx.carrier.com/privkey.pem` ### 5. Automate Nginx & Kamailio TLS Reload on Renewal Create a deploy hook so automatic 60-day renewals reload both Nginx and **Ring2All SBC** SIP TLS without dropping calls: ```bash cat << 'EOF' > /etc/letsencrypt/renewal-hooks/deploy/reload-ring2all-sbc.sh #!/bin/bash set -e nginx -t && systemctl reload nginx if command -v kamcmd >/dev/null 2>&1; then kamcmd tls.reload || true fi EOF chmod 755 /etc/letsencrypt/renewal-hooks/deploy/reload-ring2all-sbc.sh ``` --- ## 5. Step 3: Configuring Ring2All SBC for Unified HTTPS, WebRTC & SIP Routing Each **Ring2All SBC** node in your load-balanced pool must be configured so that: 1. SIP TLS (`:5061`) and WebRTC WSS (`:7443`) present the `*.pbx.carrier.com` wildcard certificate. 2. Nginx separates the **SBC Admin Console** (`sbc01-admin.carrier.com`) from **Customer Tenant Subdomains** (`*.pbx.carrier.com`) via SNI virtual hosts. ### 5.1 Bind Wildcard TLS & WebRTC WSS in Ring2All SBC 1. Log in to each **Ring2All SBC** Admin Console (e.g., `https://sbc01-admin.carrier.com`). 2. Go to **Settings β†’ Technology β†’ TLS Profiles** and configure a profile pointing to: * **Certificate**: `/etc/letsencrypt/live/pbx.carrier.com/fullchain.pem` * **Private Key**: `/etc/letsencrypt/live/pbx.carrier.com/privkey.pem` * **Server Name (`CN`)**: `*.pbx.carrier.com` 3. Go to **Settings β†’ Technology β†’ WebRTC** and verify: * **Enable WSS Gateway**: `Enabled` * **WSS Listening Port**: `7443` * **TLS Certificate Profile**: Select the `*.pbx.carrier.com` profile created above. * **ICE Handling Mode**: `force` * **DTLS Passive Role**: `Enabled` 4. Apply changes and verify active TLS listeners in **Settings β†’ Tools β†’ RPC Console**. ### 5.2 Isolate the SBC Admin Virtual Host (`softswitch-sbc`) On every **Ring2All SBC** node, edit `/etc/nginx/sites-available/softswitch-sbc` and replace the catch-all `server_name _;` in both the HTTP (`:80`) and HTTPS (`:443`) blocks with that SBC node's dedicated NOC hostname so customers browsing `https://acme.pbx.carrier.com` never land on the SBC Admin Console: ```nginx # Inside /etc/nginx/sites-available/softswitch-sbc server { listen 80; server_name sbc01-admin.carrier.com; # ... existing SBC admin HTTP config ... } server { listen 443 ssl; http2 on; server_name sbc01-admin.carrier.com; # ... existing SBC admin HTTPS config ... } ``` ### 5.3 Create the Tenant Edge Virtual Host (`ring2all-tenant-edge.conf`) On **every** **Ring2All SBC** node, create `/etc/nginx/sites-available/ring2all-tenant-edge.conf` to reverse-proxy tenant Web Admin (`/`), **Ring2All Connect** (`/portal`), **Ring2All Switchboard** (`/switchboard`), WebRTC WSS (`/webrtc`), ZTP Auto-Provisioning (`/provisioning/...`), and the Cloudflare `/health` check: ```nginx # /etc/nginx/sites-available/ring2all-tenant-edge.conf # Deploy identically across all Ring2All SBC nodes (SBC-01, SBC-02, ... SBC-N) upstream pbx_web_cluster { # Stateless Ring2All PBX Web & API nodes over private LAN or WireGuard mesh server 10.10.10.20:80 max_fails=2 fail_timeout=5s; server 10.10.10.21:80 max_fails=2 fail_timeout=5s; keepalive 32; } server { listen 80; listen [::]:80; server_name *.pbx.carrier.com pbx.carrier.com; # Optional: allow legacy IP phones to auto-provision over HTTP if required location ~* "^/provisioning/(?.+)$" { if ($http_user_agent !~* "(Yealink|Grandstream|Fanvil|Polycom|Cisco|Snom|Htek|Flyingvoice|Panasonic|Gigaset|curl|Wget)") { return 403 "Forbidden: Non-telephony device"; } proxy_pass http://pbx_web_cluster/api/apps/provisioning/devices/config/$provpath; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_connect_timeout 5s; proxy_read_timeout 15s; } location / { return 301 https://$host$request_uri; } } server { listen 443 ssl; listen [::]:443 ssl; http2 on; server_name *.pbx.carrier.com pbx.carrier.com; ssl_certificate /etc/letsencrypt/live/pbx.carrier.com/fullchain.pem; ssl_certificate_key /etc/letsencrypt/live/pbx.carrier.com/privkey.pem; ssl_protocols TLSv1.2 TLSv1.3; ssl_session_cache shared:SSL:10m; ssl_session_timeout 1d; # ── 1. Cloudflare Load Balancer Health Check ───────────────────────────── location = /health { proxy_pass http://127.0.0.1:3003/health; access_log off; proxy_connect_timeout 2s; proxy_read_timeout 3s; } # ── 2. WebRTC SIP over WSS (Standard Port 443 -> Local Kamailio :7443) ─── location /webrtc { proxy_pass https://127.0.0.1:7443; proxy_ssl_verify off; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto https; proxy_read_timeout 86400s; proxy_send_timeout 86400s; } # ── 3. HTTPS IP Phone Auto-Provisioning (ZTP / DMS) ────────────────────── location ~* "^/provisioning/(?.+)$" { if ($http_user_agent !~* "(Yealink|Grandstream|Fanvil|Polycom|Cisco|Snom|Htek|Flyingvoice|Panasonic|Gigaset|curl|Wget)") { return 403 "Forbidden: Non-telephony device"; } proxy_pass http://pbx_web_cluster/api/apps/provisioning/devices/config/$provpath; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto https; proxy_connect_timeout 5s; proxy_read_timeout 15s; } location ~* "^/(?[0-9a-fA-F]{12}\.(?:cfg|xml|htm|cnf)|cfg[0-9a-fA-F]{12}\.xml|[0-9a-fA-F]{12}-phone\.cfg|y0000000000[0-9]{2}\.cfg)$" { if ($http_user_agent !~* "(Yealink|Grandstream|Fanvil|Polycom|Cisco|Snom|Htek|Flyingvoice|Panasonic|Gigaset|curl|Wget)") { return 403 "Forbidden: Non-telephony device"; } proxy_pass http://pbx_web_cluster/api/apps/provisioning/devices/config/$devcfg; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto https; proxy_connect_timeout 5s; proxy_read_timeout 15s; } # ── 4. Unified Mini-PBX Admin, Ring2All Connect (/portal), Switchboard & API location / { proxy_pass http://pbx_web_cluster; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto https; proxy_connect_timeout 5s; proxy_read_timeout 300s; proxy_send_timeout 300s; client_max_body_size 50M; } } ``` Enable the site and validate Nginx syntax on every SBC node: ```bash ln -sf /etc/nginx/sites-available/ring2all-tenant-edge.conf /etc/nginx/sites-enabled/ nginx -t && systemctl reload nginx ``` > [!TIP] > **Automatic Per-Tenant Branding & Domain Context:** Because Nginx preserves `Host $host` (`acme.pbx.carrier.com`), **Ring2All PBX** automatically resolves the tenant's custom branding, logos, login background, and WebRTC WSS host (`wss://acme.pbx.carrier.com/webrtc`) dynamically when the administrator or end user loads the portal. --- ## 6. Step 4: Configuring Ring2All BSS for Zero-Touch Subdomain Provisioning Once Cloudflare and your **Ring2All SBC** pool are ready, configure **Ring2All BSS** so every new customer checkout provisions cleanly across all clusters. ### 6.1 Register PBX & All Active SBC Nodes in Telecom Nodes & Engines 1. Log in to the **Ring2All BSS Admin Console**. 2. Navigate to **Telecom Providers β†’ Telecom Nodes & Engines**. 3. Ensure your core **Ring2All PBX** node is registered with: * **Engine Architecture**: `ring2all_pbx` * **Default Cluster Engine**: `Enabled` * **Active Status**: `Enabled` 4. Register **every** **Ring2All SBC** node in your Cloudflare Load Balancer pool (`SBC-01`, `SBC-02`, ..., `SBC-N`) with: * **Engine Architecture**: `ring2all_sbc` * **API Endpoint URL**: Each node's internal or management HTTPS endpoint (`https://10.10.10.70`, `https://10.10.10.71`) * **Active Status**: `Enabled` Whenever a subscription is activated, **Ring2All BSS** automatically queries every active `ring2all_sbc` node and synchronizes the customer's SIP domain, channel/CPS caps, and dispatcher set across all SBCs in parallel. ### 6.2 Predefine `Root FQDN Domain` in Catalog Plans 1. Navigate to **Services & Rates β†’ Plans (Catalog)** and create or edit a plan with **Service Classification** set to `mini_pbx` or `bundle`. 2. Locate the **Root FQDN Domain** field and enter your Cloudflare-managed parent domain: * **Root FQDN Domain**: `pbx.carrier.com` 3. Set **Infrastructure Node** to `Auto` (uses least-loaded cluster placement to select Primary + Failover **Ring2All PBX** servers automatically). 4. Save the plan. In the **Customer Self-Care Portal Plan Store**, buyers simply type their desired prefix (e.g., `acme`), previewing `acme.pbx.carrier.com` before checkout. ### 6.3 End-to-End Automated Provisioning Sequence ```mermaid sequenceDiagram actor Buyer as Customer (store.carrier.com) participant BSS as Ring2All BSS participant PBX as Ring2All PBX Core participant SBC1 as Ring2All SBC-01 (203.0.113.10) participant SBC2 as Ring2All SBC-02 (203.0.113.11) Buyer->>BSS: Subscribe to Mini-PBX Plan (prefix: "acme") Note over BSS: Combines prefix + Root FQDN Domain -> acme.pbx.carrier.com BSS->>PBX: Query Optimal Cluster Placement (extensions & channels) PBX-->>BSS: Primary PBX Server + Failover PBX Server BSS->>PBX: Create Tenant & Domain "acme.pbx.carrier.com" + Module Suites par Parallel Multi-SBC Fan-Out (No Cloudflare API Calls) BSS->>SBC1: Register Dispatcher Set (Pri 10 / Failover 5) + Domain "acme.pbx.carrier.com" BSS->>SBC2: Register Dispatcher Set (Pri 10 / Failover 5) + Domain "acme.pbx.carrier.com" end SBC1-->>BSS: 200 OK (Synchronized) SBC2-->>BSS: 200 OK (Synchronized) BSS-->>Buyer: Instant Activation! Ready at acme.pbx.carrier.com ``` --- ## 7. Unified Customer Endpoint Reference After checkout completes, the customer receives **one single FQDN (`acme.pbx.carrier.com`)** that works across every service and device without memorizing different hostnames per server: | Service / Client Type | Endpoint / Configuration Value | Traffic Path | | :--- | :--- | :--- | | **Mini-PBX Admin Portal** | `https://acme.pbx.carrier.com` | Cloudflare Gray-Cloud LB β†’ Healthy SBC Nginx β†’ PBX Web/API Cluster | | **Ring2All Connect (UCaaS)** | `https://acme.pbx.carrier.com/portal` | Cloudflare Gray-Cloud LB β†’ Healthy SBC Nginx β†’ PBX Portal Cluster | | **Ring2All Switchboard** | `https://acme.pbx.carrier.com/switchboard` | Cloudflare Gray-Cloud LB β†’ Healthy SBC Nginx β†’ PBX Switchboard Cluster | | **WebRTC Softphone (WSS)** | `wss://acme.pbx.carrier.com/webrtc` (Port `443`) | Cloudflare Gray-Cloud LB β†’ Healthy SBC Nginx β†’ Kamailio WSS (`:7443`) & RTPEngine | | **SIP Hardphone / Softphone** | `acme.pbx.carrier.com` (UDP/TCP `5060` or TLS `5061`) | Cloudflare Gray-Cloud LB β†’ Healthy SBC Kamailio β†’ Primary/Failover PBX via WireGuard | | **Zero-Touch Provisioning (DMS)** | `https://acme.pbx.carrier.com/provisioning/` | Cloudflare Gray-Cloud LB β†’ Healthy SBC Nginx β†’ PBX Provisioning API | --- ## 8. Optional Scenarios: When Is Cloudflare DNS API Integration Needed? For 95% of multi-tenant UCaaS carriers, the predefined wildcard (`*.pbx.carrier.com`) handles everything with zero API dependencies. Integrating the Cloudflare REST API into your provisioning pipeline is only necessary in two specialized cases: 1. **Per-Tenant RFC 3263 `SRV` Records**: DNS specifications do not permit wildcards in the middle of a label (`_sip._udp.*.pbx.carrier.com` is invalid). If subscribers configure unmanaged third-party SIP devices manually (without **Ring2All DMS** templates setting `sbc1.pbx` and `sbc2.pbx` as Outbound Proxies) and require RFC 3263 SRV failover per domain, your provisioning hook can create `_sip._udp..pbx.carrier.com` and `_sips._tcp..pbx.carrier.com` SRV records via the Cloudflare API. 2. **Enterprise Bring Your Own Domain (BYOD / Custom Vanity Domains)**: When enterprise accounts bring their own external domain (e.g., `voice.enterpriseclient.com`) instead of using your predefined `Root FQDN Domain`, **Cloudflare for SaaS** (Custom Hostnames) or manual customer `CNAME` + TLS provisioning is used. --- ## 9. Operational Verification & Failover Testing Run the following checks from an external workstation after completing deployment: ### 1. Verify DNS Resolution Against the Multi-SBC Pool ```bash dig +short acme.pbx.carrier.com # Expected (alternating across healthy SBC public IPs): # 203.0.113.10 # 203.0.113.11 ``` ### 2. Verify HTTPS Health, Wildcard TLS Certificate & Unified Portal Routing ```bash # Confirm Gray-Cloud direct SBC response (HTTP 200 without Cloudflare proxy headers) curl -sI https://acme.pbx.carrier.com/health # Expected: HTTP/2 200 # Inspect the wildcard TLS certificate on port 443 and SIP TLS port 5061 echo | openssl s_client -connect acme.pbx.carrier.com:443 -servername acme.pbx.carrier.com 2>/dev/null | openssl x509 -noout -subject -dates echo | openssl s_client -connect acme.pbx.carrier.com:5061 -servername acme.pbx.carrier.com 2>/dev/null | openssl x509 -noout -subject -dates # Expected CN/SAN: *.pbx.carrier.com ``` ### 3. Verify Automated SBC Failover (Cloudflare Load Balancer Mode) 1. Stop Nginx or `sbc-api` temporarily on `SBC-01` (`203.0.113.10`): ```bash systemctl stop nginx ``` 2. Wait 30–45 seconds (two failed 15s probes + 30s DNS TTL) and re-query: ```bash dig +short acme.pbx.carrier.com # Expected: returns ONLY 203.0.113.11 (SBC-02) ``` 3. Browse `https://acme.pbx.carrier.com` and test a SIP registrationβ€”traffic routes seamlessly through `SBC-02` to the customer's **Ring2All PBX** domain. 4. Restore `SBC-01` (`systemctl start nginx`) and confirm it rejoins DNS rotation within 30 seconds.