Trunk Groups and Trunks
CarrierX call routing connects IP communications infrastructure with the public switched telephone network (PSTN).
Trunks are virtual phone lines that allow users to make and receive calls over the internet. They are the main bridge between the PSTN, which connects to a rented DID number, and API endpoints used for external applications connection.
Trunks are organized into trunk groups for more robust and failproof communication.
A trunk group is a group of trunks serving the same special purpose. Trunk groups hold settings to determine to which trunk calls are sent. Each trunk group consists of one or more trunks. It is theoretically possible to create a trunk group with no trunks, but you will not be able to associate a trunk group with an endpoint in this case. Only trunks can be associated with an endpoint, but you cannot create a trunk without a trunk group.
When a call is placed from the PSTN, it first connects to the rented DID number assigned to the trunk group. Then it goes to the trunk group where a trunk is selected to pass the call further to the API endpoint, and then to the external application. These external applications can use either CarrierX API endpoints or third-party endpoints to connect the caller and the receiving party that uses an IP-based application.
Similarly, the backward communication is made from the user with an IP-based application to an API endpoint and then through trunks in a trunk group to a rented DID number and on to the PSTN.
This is why the robustness of trunks is so important: if a single trunk was used to connect the callers, in the case it failed, communication would be lost. Trunk groups allow the trunks to become interchangeable to secure the communication channel: in the case one trunk fails, another one will pick up the call and the calling parties will not even notice anything.
Trunk Group Routing Types
The behavior of trunks inside a trunk group depends on the routing type set for the trunk group. There are two main routing types used with CarrierX trunk groups:
- Failover. The trunks in a trunk group are used to strengthen connections: if one computer connected to the endpoint fails, another one will catch up the call.
- Round-robin. The trunks in a trunk group are used to distribute the call traffic among the applications connected to the endpoints.
This might be useful, if the partners have several computers with different IPs, which are used to accept the calls. Trunk group routing type allows providing additional robustness to the call flow, or serve as a load balancer.
Failover
Each trunk inside the trunk group has a Priority field that can be assigned a value from 0
up. The lower the value, the higher the priority.
With the trunk group routing type set to Failover, CarrierX will attempt to call a trunk with the highest priority first. If the call fails, attempts will be made to call other trunks one by one in the order of their priority.
In the figure above, the call will be initially routed to the trunk with the Priority set to 0
, which will route it to the external application #2. If the application (or the computer hosting it) fails, the trunk group will redirect the call to the trunk with the Priority value set to 1
(and to the external application #1). If this IP address also fails, the call traffic will be routed to the trunk with Priority 2
—thus to the external application #3.
Properly set-up switching will allow you not to lose an important call and redirect it to the right person.
Round-Robin
Basically, the round-robin concept means that calls are sent to different trunks one by one inside a trunk group, e.g. call 1 is sent to trunk 1 and the next call is sent to trunk 2, etc.
CarrierX supports the so-called weighted round-robin concept. Each trunk inside the trunk group also has a Weight field that can have numeric values. The larger the value, the more call traffic can be routed via this trunk.
With the trunk group routing type set to Round-robin, CarrierX will alternatively send the call traffic to all the trunks inside the trunk group. The volume of the traffic, which passes through each trunk, will be distributed among these trunks according to their Weight value.
In the figure above, the call traffic will be distributed among the three trunks (and thus among the external applications) the following way: the largest volume of traffic will be directed to the trunk with the Weight value set to 10
and to the external application #3; less traffic will be sent to the trunk with the 5
Weight value (and to the external application #1); and the lowest load will be with the trunk that has the 2
Weight value set (and to the external application #2).
This will allow the partner to use less powerful hardware (or a connection with a narrower bandwidth) to host the external application #2, or engage more staff in the location where the external application #3 is hosted.
Advanced Trunk Settings
Beside the Priority and Weight options, partners can make additional advanced settings for trunks. These mostly include features that define the trunk behavior concerning the transfer of different properties from the incoming to the outgoing leg, as well as some other settings.
- Trunk additional management settings:
- In Capacity/Out Capacity defines the number of simultaneous calls that the trunk can process in either direction. By default this is not limited (set to
0
). You can use these settings together with the Weight to further restrict the volume of call traffic routed via a trunk. - Call Type defines the type of call, which can be used with the current trunk. These can include the settings for regular call traffic, which can carry media inside the stream, SIP carrier data only, or 302 redirects.
- Codec defines the codec that the current trunk will be forced to use to handle the media.
- Allow Forward defines the way how the trunk handles the redirects from legB.
- Allow Transfer defines whether or not the transfer is allowed.
- In Capacity/Out Capacity defines the number of simultaneous calls that the trunk can process in either direction. By default this is not limited (set to
- Information pass-through settings define the properties, which will be accepted from the incoming leg and relayed to the outgoing leg:
- Certain SIP headers, specified explicitly or using regular expressions (the Relay SIP Headers setting).
- Remote Party ID (RPID) and P-Asserted-Identity (PAI) headers (the In Identity Mode/Out Identity Mode settings).
- The number portability parameters for the “tel” URI (the In RFC4694 Mode/Out RFC4694 Mode settings).
- The PASSCALLERCSRC, PASSCALLEECSRC variables for ASN proxy (the ASN Mode setting).
- Reference settings define the secure IDs of other objects, which are associated with the current trunk and referenced from it:
- Endpoint SID defines the secure ID of the endpoint associated with this trunk where the trunk routes the call traffic. One trunk can be associated with a single endpoint only, while a trunk group can have several endpoints assigned to it (each to its own trunk).
- Location SID defines the secure ID of the location object that identifies this trunk as belonging to a specific location.
Refer to the Trunk Object section of the Core API documentation for more information about the values, which can be set for these parameters.
Further Reading
Trunk Group and Trunk Objects API Reference
Refer to the Trunk Group and Trunk objects API reference to get the complete list of their attributes and methods used with them:
Trunk Group Object
Trunk Object
How It Works
Read the following articles to get a better understanding of how things work in CarrierX: