# Trunk groups

An inbound **Trunk Group** combines multiple [SIP trunks](../sip-trunks/index.html) and [PSTN
trunks](../pstn-trunks/index.html) into one
routing destination. Use a Trunk Group when calls to a DID number must fail
over to a backup destination, be distributed among equivalent destinations,
or both.

A Trunk Group can contain SIP trunks, PSTN trunks, or both. Each trunk can
belong to only one Trunk Group. The group defines a shared **Capacity Limit**,
and each member trunk defines its own **Priority** and **Weight** within the
group.

## How trunk groups work

When a caller dials a DID number assigned to a Trunk Group, DIDWW evaluates
the member trunks by **Priority**. Trunks with lower priority values are
preferred. When multiple available trunks have the same priority, **Weight**
controls their relative likelihood of selection.

If an attempt meets the configured re-routing conditions, DIDWW tries another
eligible member trunk. Each routing attempt generates a separate Call Detail
Record.

```
        %%{init: {
  "theme": "base",
  "themeVariables": {
    "fontSize": "14px",
    "primaryColor": "#e0f2fe",
    "primaryBorderColor": "#38bdf8",
    "primaryTextColor": "#1f2d3d",
    "secondaryColor": "#ccfbf1",
    "secondaryBorderColor": "#2dd4bf",
    "secondaryTextColor": "#1f2d3d",
    "lineColor": "#0066cc",
    "textColor": "#1f2d3d",
    "nodeTextColor": "#1f2d3d",
    "edgeLabelBackground": "#ffffff"
  }
}}%%

flowchart LR

    caller["Caller"] --> |dials DID| did["DID number"]
    did --> |assigned trunk| group["Trunk Group"]
    group --> |Priority and Weight| member["SIP or PSTN trunk"]
    member --> destination["Destination"]
    member -.-> |re-routing| group

    classDef endpoint fill:#e0f2fe,stroke:#0066cc,color:#1f2d3d,stroke-width:1.5px
    classDef process fill:#ccfbf1,stroke:#2dd4bf,color:#1f2d3d,stroke-width:1.5px

    class caller,destination endpoint
    class did,group,member process

    linkStyle default stroke:#0066cc,stroke-width:1.5px
```

## Trunk groups and DID numbers

A DID number receives the inbound call, while the Trunk Group defines which
trunks can deliver it. To receive calls, [assign the Trunk Group to a DID
number](../../../phone-numbers/my-numbers/how-to-guides/assign-voice-trunk.html#user-panel-assign-trunk). Multiple DID
numbers can use the same Trunk
Group.

The DID number must have sufficient [Capacity](../../../phone-numbers/capacity/how-capacity-works.html) for concurrent
inbound calls.
The Trunk Group's [Capacity Limit](trunk-group-settings-reference.html#inbound-trunk-groups-settings-general)
can further restrict simultaneous calls, but it cannot increase DID Capacity.

## Priority and Weight

Use **Priority** to create routing tiers and **Weight** to distribute calls
within a tier. Both are set on each member trunk. See [**RFC 2782**](https://datatracker.ietf.org/doc/html/rfc2782.html)
for the
selection model.

| Objective | Configuration | Behavior |
| --- | --- | --- |
| Primary and backup routing | Assign a lower **Priority** to the primary trunk and a higher **Priority** to the backup trunk. | DIDWW prefers the primary trunk. DIDWW tries the backup tier only after no eligible trunk in the preferred tier can complete the call under the configured re-routing conditions. |
| Load balancing | Assign the same **Priority** to multiple trunks and configure their **Weight** values. | DIDWW distributes calls among the trunks. A higher **Weight** increases a trunk's relative likelihood of selection. |
| Load balancing with failover | Create multiple priority tiers, each with equal-priority trunks. | DIDWW balances calls within the preferred tier and continues to a later tier when re-routing applies. |

## Capacity and re-routing

The Trunk Group **Capacity Limit** restricts the total number of simultaneous
calls delivered through the group. Calls that exceed the group limit are
rejected. Each member trunk can also have its own **Capacity Limit**. When a
member trunk reaches its limit, DIDWW can attempt another eligible member.

For SIP members, **Re-routing Disconnect Codes** determine which failed
attempts continue to another trunk. A member trunk's **Ringing Timeout** can
also end an attempt when the destination does not answer in time. For
routing-attempt and Call Detail Record behavior, see [Service failover
and load
balancing](../sip-trunks/call-handling-and-delivery/service-failover-and-load-balancing.html#inbound-sip-failover-load-balancing).

---

## Get started

Create a group from your SIP and PSTN trunks, assign it to a DID number,
and test call delivery.

**Create a trunk group**

Combine existing SIP and PSTN trunks into a group and configure
its capacity.

[Create a Trunk Group](how-to-guides/create-trunk-group.html)

**Assign the group to DID numbers**

Assign the group to one or more DID numbers to receive incoming calls.

[Assign a voice trunk](../../../phone-numbers/my-numbers/how-to-guides/assign-voice-trunk.html#user-panel-assign-trunk)

**Test and view call logs**

Call an assigned DID number and review the delivery attempts in
Inbound Call Logs.

[Inbound Call Logs](../../../logs-analytics/call-logs/inbound-logs.html#inbound-cdr-logs)

## Manage and configure routing

Update the group or configure how its member trunks are selected.

**Manage trunk groups**

View or edit group settings and membership, or delete groups that
are no longer needed.

[Manage Trunk Groups](how-to-guides/manage-trunk-groups.html)

**Configure member trunk routing**

Set Priority, Weight, and SIP re-routing conditions on individual
member trunks.

[Configure member trunk routing](how-to-guides/manage-trunk-groups.html#inbound-trunk-groups-manage-member-routing)

## Delivery behavior and references

Look up routing behavior and configuration fields.

**Trunk group failover and load balancing**

Understand how DIDWW selects member trunks and when it tries another
eligible destination.

[Trunk Group failover and load balancing](../sip-trunks/call-handling-and-delivery/service-failover-and-load-balancing.html#inbound-trunk-group-failover-load-balancing)

**Trunk group settings reference**

Look up group capacity, membership, Priority, Weight, and
re-routing settings.

[Trunk Group settings reference](trunk-group-settings-reference.html)

On this page
