Moving to a real SIP trunk
The examples run against SIPp, which stands in for a carrier. Moving to a real trunk is configuration of the PBX and the package; a real trunk stays a manual check, because the automated suites do not reach a carrier. Start with the voice-assistant example’s checklist and adapt it to your carrier.
Steps
- The trunk. In the PBX configuration (
deploy/rustpbx/config.toml, section[proxy.trunks.carrier]) setdestto the carrier’s SIP proxy,usernameandpasswordto your credentials, anddid_numbersto your number. Keep thecodeclist (pcmu,pcma): rustpbx builds an originated call’s offer from it and refuses the call without. - Inbound recognition. rustpbx recognises a trunk by the source address of the carrier’s
signalling. Set
inbound_hoststo the carrier’s signalling addresses and nothing else. - The number. Change the route’s
"to.user"match and thecall-startchannel’sbind: "number:..."in the package. - The network. Set
external_ipto the address the carrier sends media to, publish the SIP port and exactly the RTP range (rtp_start_porttortp_end_port, kept small) over UDP, and restrictacl_rules. - Secrets. Replace the development control and media tokens, use
wss://for the control socket over an untrusted network (SUTRA_VOIP_RWI_CA_FILEfor a private CA), and put the engine behind TLS for the media WebSocket. Secrets are references (env:,file:), never literals. - The trunk size. Set the capacity pool’s slots to the carrier’s concurrent-call limit.
Registration and authentication
Some carriers authenticate by source IP, others require the PBX to register with a username and
password (SIP digest). Use the mechanism the carrier documents: IP authentication needs the correct
inbound_hosts and a stable public address; registration needs the credentials in the trunk
section and keep-alives through any NAT. Carrier credentials belong in secret references, not in a
committed file. Extension phones that register with your PBX need their own strong passwords: the
examples ship development-only ones.
Toll fraud
A PBX exposed to the internet is a target for toll fraud: attackers register or call through it to premium-rate and international numbers at your expense.
- Keep the SIP port reachable only from the carrier where possible, and apply
acl_rules. - Never leave default or example passwords on extensions or trunks.
- Restrict outbound destinations (country and premium-rate prefixes) at the PBX and at the carrier. Flows that dial numbers supplied by users should validate them first.
- The engine refuses too:
voip://originatedials nothing untilSUTRA_VOIP_ORIGINATE_ALLOWlists what it may (glob patterns such as+1555*, orsip:*@pbx.internal). Premium-rate prefixes (SUTRA_VOIP_ORIGINATE_BLOCK_PREFIXES, a built-in list) and international numbers (outsideSUTRA_VOIP_ORIGINATE_HOME_PREFIX) are refused unless an allow pattern names them specifically or_ALLOW_PREMIUM/_ALLOW_INTERNATIONAListrue; each destination may be dialled_RATE_PER_DESTINATIONtimes an hour (10) and all of them_RATE_GLOBALtimes a minute (60). Every refusal is avoip.ORIGINATE_REFUSEDorvoip.ORIGINATE_RATE_LIMITEDevent in the requesting instance’s audit trail. - Set a spending limit and call-rate alerts with the carrier, and use the capacity pool to cap concurrent calls.
- Watch call records for unusual destinations and off-hours volume.
See also Security notes.