Wholesale Cluster Mode

1. Architecture

            ┌──────────────┐
            │ Load Balancer│
            └──────┬───────┘
       ┌───────────┼───────────┐
       ▼           ▼           ▼
┌──────────┐ ┌──────────┐ ┌──────────┐
│ Node 1   │ │ Node 2   │ │ Node 3   │
│ RustPBX  │◄──► RustPBX│◄──► RustPBX│
│ +Wholesale│   +Wholesale   │ +Wholesale│
└─────┬────┘ └─────┬────┘ └─────┬────┘
      └─────────────┼─────────────┘
                    ▼
           ┌──────────────┐
           │ MySQL/PgSQL  │
           └──────────────┘

Each node runs a complete RustPBX + Wholesale instance, sharing a database for data consistency.

2. Configuration

2.1 Wholesale Cluster Configuration

In config.toml:

[proxy.wholesale]

[[proxy.wholesale.cluster.peers]]
name = "node-2"
url = "http://10.0.0.2:8080"
api_key = "shared-secret-key"

[[proxy.wholesale.cluster.peers]]
name = "node-3"
url = "http://10.0.0.3:8080"
api_key = "shared-secret-key"
  • api_key: Shared secret for inter-node API calls; must be identical across all nodes
  • url: HTTP address of the peer node

2.2 RustPBX Core Cluster Configuration

[cluster]
peers = [
  { addr = "10.0.0.2", sip_port = 5060, ami_port = 8080 },
  { addr = "10.0.0.3", sip_port = 5060, ami_port = 8080 },
]

3. Cross-Node Operations

Wholesale clusters support the following cross-node operations:

3.1 Active Calls List

Wholesale → Cluster → Active Calls: Aggregates current calls across all nodes.

3.2 Cross-Node Hangup

You can hang up any call on any node directly from the active calls list.

3.3 Node Health Check

The console displays the online status of each peer node.

4. Data Consistency

DataConsistency Strategy
Rate decks / Routing profilesDatabase → hot-reloaded into each node’s in-memory Trie
Balance deductionSQL UPDATE ... SET balance = balance - price atomic operation
CDR writesEach node writes independently to the shared database
Circuit breakerMaintained independently per node (local state)
CPS / Concurrency countersIndependent per node (total limits must be divided by node count)

4.1 Limit Allocation

If a tenant has a max concurrency of 300 in a 3-node cluster, configure 100 per node (300 / 3). In practice, use the load balancer for even distribution.