SIP Trunks
Trunks are used to route calls in and out of the phone system. The term "trunk" originates from old PBX systems, where the PBX was connected to the public telephone network using physical wires called trunks.
Today trunks transport the conversation over the network. Calls can end up on a PSTN gateway that is located close to the PBX server, but they can also end up on a service provider's network that takes care about the PSTN termination as a service.
Trunks may have several lines. These lines represent the physical cables that were used in the PSTN world and they are called "CO-lines" in the context of the PBX. A CO line can have one call appearance. CO lines are mostly not used any more and for new installations not recommended.
There are different trunk types:
- When using a PSTN gateway, the gateway is typically programmed to send all inbound calls to the PBX. The PBX is programmed to send the outbound calls to the gateway. These trunks are called "gateway" trunks.
- Many service providers started their business offering PSTN call termination for soft phones running on PC endpoints. This model is mostly used for today's SIP service providers where the PBX needs to register itself to the service provider like a soft phone. This type of trunks are called registration trunks.
- A new, evolving trunk type is using the ability of modern web browsers to terminate phone calls. These trunks are called WebRTC trunks.
- There are special trunks that use OPTIONS instead of REGISTER which are not very common but neccessary in some cases.
The PBX may have several trunks (depending on the license). For inbound calls, the PBX needs to identify the trunk first and then determine where to send the call. This is done using the settings of the trunk.
For outbound calls, the PBX first checks if the dialed number is an internal resource, for example an extension or an auto attendant. If that is not the case, the PBX needs to select the dial plan that will tell the PBX on which trunk the call should be terminated.
- If the dial plan has been explicitly assigned to the account that is initiating the call, the PBX will use that dial plan.
- Otherwise the PBX will choose the default dial plan of the domain where the call comes from.
The PBX will process the dial plan and then determine the trunk that will be used for placing the call. The headers settings of the trunk will govern the way the call is represented to the PSTN gateway or the service provider.