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 the users to make and receive the calls over the internet. They are the main bridge between the PSTN, which connects to the 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 PSTN, it first connects 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.

Trunks and Trunk Groups

Similarly, the backward communication is made from the user with an IP-based application to the API endpoint and then through the trunks in the trunk group to the 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, the communication would be lost. Trunk groups allow the trunks to become interchangeable to secure the communication channel: in the case one trunk fails, the other will pick up the call and calling parties will not even notice anything.

Trunk Group Routing Types

The behavior of the trunks inside the trunk group depends on the routing type set for the trunk group. There are two main routing types used with CarrierX trunk groups:

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 load balancer.


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 the trunk with the highest priority first. If the call fails, attempts will be made to call other trunks one by one in order of their priority.

Trunk Groups: Failover Routing Type

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 the 2 Priority—thus to the external application #3.

With the proper switching set up, this will allow not to lose the important call and redirect it to the right person.


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 each trunk, will be distributed among these trunks according to their Weight value.

Trunk Groups: Round-Robin Routing Type

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 the less powerful hardware (or a connection with narrower bandwidth) for the hosting of the external application #2, or engage a bigger staff in the location where the external application #3 is hosted.

Advanced Trunk Settings

Beside the Priority and Weight options, partners can set up 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.

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:

How It Works

Read the following articles to get a better understanding of how things work in CarrierX: