SIP routing
Routing
First matching rule wins. Saved table feeds /api/dialplan and the rustpbx [[proxy.routes]] below. Gateway peers 192.168.71.9:5060 — never localhost.
Active PSTN trunk
LAN PSTN192.168.71.107:5060
UDP · DID +8619921256477
Peers
Used when a rule target is blank.
Rules
Evaluated top to bottom. Catch-all is Aria-only — rustpbx never gets `.*`.
- 01
- 02
- 03
- 04
- 05
- 06
RustPBX config.toml
Paste on 192.168.71.9. Every route sets action = forward. route_originated_calls must stay true or outbound from 1001 never enters this table.
# Aria × rustpbx — on 192.168.71.9
http_addr = "0.0.0.0:8080"
[proxy]
addr = "0.0.0.0"
udp_port = 5060
external_ip = "192.168.71.9"
media_proxy = "all"
route_originated_calls = true
realms = ["127.0.0.1", "192.168.71.9"]
audio_codecs = ["pcma", "pcmu"]
[media]
rtp_start = 20000
rtp_end = 24999
[[proxy.user_backends]]
type = "memory"
users = [
{ username = "1001", password = "agent1001" },
{ username = "9955756", password = "gateway" },
]
[[proxy.routes]]
name = "did-in"
priority = 100
action = "forward"
dest = "sip:[email protected]:13050"
[proxy.routes.match]
"to.user" = "^\\+?(?:86)?19921256477$"
[[proxy.routes]]
name = "ext-agent"
priority = 99
action = "forward"
dest = "sip:[email protected]:13050"
[proxy.routes.match]
"to.user" = "^1001$"
[[proxy.routes]]
name = "trial-out"
priority = 98
action = "forward"
dest = "pstn"
[proxy.routes.match]
"to.user" = "^\\+?(?:86)?18640804547$"
[proxy.routes.rewrite]
"from.user" = "8619921256477"
"to.user" = "18640804547"
"to.host" = "192.168.71.107:5060"
[[proxy.routes]]
name = "pstn-out"
priority = 97
action = "reject"
[proxy.routes.match]
"to.user" = "^\\+?(?:86)?(\\d{5,})$"
[proxy.routes.rewrite]
"from.user" = "8619921256477"
[[trunks]]
name = "pstn"
addr = "192.168.71.107:5060"
transport = "udp"
codecs = ["PCMA", "PCMU"]
direction = "both"
# Gateway peers 192.168.71.9:5060, never localhost.
# DID +8619921256477 → sip:[email protected]:13050
# Brain stays loopback: ws://127.0.0.1:8765/v1/realtime
Test an INVITE
Runs against the saved table on this server.
Hard rules
Not configurable. The B2BUA depends on them.
- Every rustpbx route sets action = forward. Omitted action is local, not trunk.
- route_originated_calls = true or 1001 outbound never hits the table.
- DID match is ^\+?(?:86)?19921256477$ — never 86?.
- Active Call INVITEs RustPBX, never 192.168.71.107.
- Outbound From on Dialog B is the DID +8619921256477.
- speech-to-speech stays on loopback. It is not a SIP target.