What a SIP trunk is
A SIP trunk is a service that connects a private phone system (a PBX) to the public telephone network over an IP connection rather than over physical telephone lines. The PBX and the provider exchange call-control messages using the Session Initiation Protocol (SIP), and the audio for each call travels as a stream of data packets. The provider then hands the call to the public network, where it reaches mobiles, landlines and international numbers in the usual way.
The word “trunk” comes from traditional telephony, where a trunk is a shared connection that carries many calls between two switches. A SIP trunk performs the same role. The difference is that capacity is defined in configuration rather than by the number of copper pairs or digital circuits installed in the building.
For the people making and receiving calls, very little changes. Extensions, hunt groups, menus and voicemail are still provided by the PBX. The trunk only replaces the connection between that PBX and the outside world.
How a call travels over a trunk
Every call has two parts: signalling, which sets the call up and tears it down, and media, which is the audio itself. The sequences below describe a typical call in each direction. Exact messages vary slightly between platforms, but the pattern is the same.
An inbound call
- A caller dials one of your numbers. The public network routes that number to your SIP provider.
- The provider sends a SIP
INVITEto your PBX. It contains the dialled number, the caller’s number and a description of the audio formats on offer. - Your PBX replies that it is processing the call and, when a phone starts ringing, sends a ringing indication back.
- When someone answers, the PBX sends a
200 OKresponse confirming the agreed audio format, and the provider acknowledges it. - Audio now flows in both directions as RTP packets, usually on a different set of ports from the signalling.
- When either side hangs up, a
BYEmessage ends the call and both sides release the channel.
An outbound call
- A user dials a number. The PBX applies its dial plan, chooses the trunk and sets the caller ID to present.
- The PBX sends an
INVITEto the provider. Depending on the authentication method, the provider either accepts it because it comes from a known IP address or asks the PBX to prove its credentials. - The provider checks that the destination is permitted for your account and routes the call towards the public network.
- Ringing and answer indications come back to the PBX, audio is established and the call proceeds as above.
Because signalling and media are separate, it is possible for a call to connect correctly while the audio fails in one or both directions. That symptom almost always points to firewall or NAT settings, which are covered below.
Channels and numbers
Two terms cause more confusion than any others. A channel is capacity for one simultaneous call. A number (often called a DID, for direct inward dialling) is a phone number that callers dial and that the provider routes to your trunk. The two are sized independently.
Channels and numbers are separate parts of a SIP trunk
-
Channels
- Represents
- One call in progress at a time, inbound or outbound
- Sized by
- Peak concurrent calls during the busiest hour
- If you run out
- Further calls are rejected or receive a busy signal
- Example
- 12 channels allow 12 calls at the same moment
-
Numbers (DIDs)
- Represents
- A dialable phone number routed to your PBX
- Sized by
- How many distinct numbers people need to reach
- If you run out
- You cannot give a team or person a direct number
- Example
- 80 numbers, one per employee plus departments
An organisation with 80 staff and a direct number for each of them might need far fewer than 80 channels, because not everyone is on the phone at once. A contact centre with a single published number might need many channels. Estimating the right figure from call records is explained in How to estimate SIP channel requirements.
Signalling, media and codecs
Signalling
SIP is defined in RFC 3261. It is a text-based protocol, similar in structure to HTTP, and by convention uses port 5060 over UDP or TCP and port 5061 when encrypted with TLS. Each call-setup message carries a session description (SDP) listing the audio formats each side can use and the address where it expects to receive audio.
Media and codecs
The audio travels as RTP packets. A codec determines how speech is encoded, which in turn affects audio quality, bandwidth and processing load. Both ends must agree on a codec for each call; if they cannot, the call fails or a device in the path must convert between formats (transcoding), which adds delay and can reduce quality.
Common codecs on SIP trunks (approximate figures per call, each direction)
-
G.711 (µ-law / A-law)
- Audio payload
- 64 kbit/s; roughly 90–100 kbit/s with packet overhead
- Typical use
- The common baseline. Uncompressed narrowband audio that avoids transcoding.
-
G.729
- Audio payload
- 8 kbit/s; roughly 30 kbit/s with packet overhead
- Typical use
- Compressed audio for constrained links, with some loss of quality. Support varies by route.
-
G.722
- Audio payload
- 64 kbit/s
- Typical use
- Wideband (higher-fidelity) audio, mainly useful when both ends stay on IP.
Keypad tones
When a caller presses a key to navigate a menu or enter a PIN, the tone must reach the far end reliably. On SIP trunks this is usually done by sending the key presses as separate RTP events (RFC 4733, which replaced RFC 2833) rather than as sound inside the audio stream. The PBX and the provider must use the same method.
How the provider recognises your PBX
A trunk must only accept calls from your PBX, otherwise anyone could place calls at your expense. Two methods are in common use:
- IP authentication. The provider accepts calls only from your PBX’s fixed public IP address. Nothing is registered; the address itself is the credential. This suits PBXs and session border controllers with a static IP.
- Registration. The PBX logs in with a username and password and renews the registration periodically. The provider then knows where to send inbound calls. This suits connections whose address can change.
Some deployments combine both. Whichever method is used, outbound calls should be restricted to the destinations you actually need, and credentials should be long, unique and never left at default values.
What you need to use one
- A SIP-capable phone system. Most current IP PBXs support SIP trunks natively. Older digital systems can often connect through a gateway that converts between ISDN and SIP.
- A suitable connection. Bandwidth for your peak number of calls in both directions, plus your other traffic. Stable latency and low packet loss matter more than raw speed.
- Firewall and NAT configuration. SIP permitted from the provider’s addresses, the agreed RTP port range open, and SIP ALG disabled on routers where it rewrites SIP messages incorrectly.
- Quality of service. Voice traffic prioritised over bulk data on your network and, where possible, on your internet link.
- Number and emergency details. The numbers you will use, any you intend to port, and the address information required for emergency calls in your country.
Limitations and risks
SIP trunking moves voice onto your data network, which brings flexibility but also new dependencies.
- Dependence on the IP connection. If the internet link or PBX fails, outbound calling stops. Inbound calls can be redirected to an alternative destination if this has been arranged in advance, and a second connection or site improves resilience further.
- Call quality depends on the network. Congestion, jitter and packet loss show up as choppy or delayed audio. Sizing bandwidth and prioritising voice prevent most problems.
- Toll fraud. An exposed or poorly secured PBX can be used to place large volumes of calls to expensive destinations. Layered controls on the PBX, network and trunk reduce the risk; see SIP trunking security best practices.
- Emergency calling. Rules differ by country and usually require a registered address for each number or site. Requirements should be confirmed before go-live.
- Fax and analogue devices. Fax machines, alarm diallers and similar equipment can be unreliable over IP and may need T.38 support or a different approach.
Is SIP trunking right for you?
SIP trunking usually suits organisations that already run an IP PBX, or plan to, and want to keep control of it while replacing analogue or ISDN lines. It also suits those with fluctuating capacity needs or numbers in several locations that should all reach one system.
If you would rather not operate a phone system at all, a hosted alternative may be a better fit. The trade-offs are set out in SIP trunking vs hosted PBX. If you are moving from existing lines, SIP trunking vs traditional phone lines covers the migration path. When you are ready, Khaltrix can review your PBX and network and propose a trunk configuration on our SIP Trunking service.