# SMS trunk groups

An **SMS trunk group** combines multiple SMS trunks into one delivery
destination for inbound SMS. Use an SMS trunk group when messages to a DID
number must fail over to a backup trunk if the primary trunk cannot deliver
them.

An SMS trunk group can contain [SMS to Email](../sms-to-email/sms-to-email-trunk.html), [HTTP
IN](../http-in/http-in-trunk.html),
[SMPP ESME](../smpp-esme/smpp-esme-trunk.html), and [SMPP SMSC](../smpp-smsc/smpp-smsc-trunk.html) trunks. Each trunk can belong to only one SMS
trunk group, and each member trunk defines its own **Priority** within the
group. See [SMS trunk types](sms-trunk-group-reference.html#sms-trunk-group-reference-member-types).

## How SMS trunk groups work

When an SMS arrives on a DID number assigned to an SMS trunk group, DIDWW
evaluates the member trunks by **Priority**. Trunks with higher priority values
are preferred. When multiple member trunks have the same priority, DIDWW tries
them in random order.

If a delivery attempt fails, DIDWW tries the next member trunk in priority
order.

```
        %%{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

    sender["Sender"] --> |sends SMS to DID| did["DID number"]
    did --> |assigned trunk| group["SMS trunk group"]
    group --> |highest Priority first| member["Member SMS trunk"]
    member --> destination["Destination"]
    member -.-> |attempt fails| 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 sender,destination endpoint
    class did,group,member process

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

## SMS trunk groups and DID numbers

A DID number receives the inbound SMS, while the SMS trunk group defines which
SMS trunks can deliver it. To receive messages, [assign the SMS trunk
group to one or more DID numbers that support inbound
SMS](../../../phone-numbers/my-numbers/how-to-guides/assign-sms-trunk.html#assigning-sms-trunk), in the same way as a
single SMS trunk. Multiple DID
numbers can use the same SMS trunk group.

## Priority and failover

Use **Priority** to set the order in which member trunks are attempted. It is
set on each member trunk, from `0` to `32767`. See [Set priorities in
an SMS trunk group](how-to-guides/set-sms-trunk-group-priorities.html).

| Objective | Configuration | Behavior |
| --- | --- | --- |
| Primary and backup delivery | Assign a higher **Priority** to the primary trunk and a lower **Priority** to the backup trunk. | DIDWW prefers the primary trunk. DIDWW tries the backup trunk only after the attempt through the primary trunk fails. |
| Several backup levels | Assign a different **Priority** to each member trunk. | DIDWW attempts the trunks from the highest to the lowest priority. For example, with priorities `2`, `1`, and `0`, DIDWW attempts `2` first, then `1`, followed by `0`. |
| Equal priorities | Assign the same **Priority** to multiple trunks. | DIDWW tries the trunks with the same priority in random order. |

For example, use an HTTP IN trunk as the primary destination and add an SMS to
Email trunk as a backup with a lower priority.

Note

SMS trunk groups differ from voice [Trunk groups](../../../voice/inbound-trunks/trunk-groups/index.html). A higher
**Priority** value is
preferred, and SMS trunk groups have no **Weight** or **Capacity Limit**
settings.

---

## Get started

Create a group from your existing SMS trunks, assign it to your DID numbers,
and test message delivery.

**Create an SMS trunk group**

Combine existing SMS trunks into a group for inbound SMS failover.

[Create an SMS trunk group](how-to-guides/create-sms-trunk-group.html)

**Assign an SMS trunk**

Assign the trunk group to one or more DID numbers that support inbound
SMS.

[Assign an SMS trunk](../../../phone-numbers/my-numbers/how-to-guides/assign-sms-trunk.html#assigning-sms-trunk)

**Test and view SMS logs**

Send a test SMS to an assigned DID number and review it in the Inbound
SMS logs.

[Inbound SMS Logs](../../../logs-analytics/sms-logs/inbound-logs.html#inbound-logs)

## Manage and configure routing

Update the group or set the order in which its member trunks are attempted.

**Set priorities in an SMS trunk group**

Set the Priority of each member trunk in the SMS Trunks list or in the
trunk settings.

[Set priorities in an SMS trunk group](how-to-guides/set-sms-trunk-group-priorities.html)

**Manage SMS trunk groups**

Update the name or modify the members of a trunk group, or delete
groups that are no longer needed.

[Manage SMS trunk groups](how-to-guides/manage-sms-trunk-groups.html)

## Delivery behavior and references

Look up delivery behavior and configuration fields.

**SMS trunk group reference**

Look up group fields, supported trunk types, and priority settings.

[SMS trunk group reference](sms-trunk-group-reference.html)

**Inbound SMS guidelines**

Review how inbound SMS delivery works, its restrictions, and
troubleshooting.

[Inbound SMS Guidelines](../technical-data/guidelines.html#sms-in-guidelines)

## Related resources

Prepare member trunks and compare SMS trunk types.

**SMS trunks**

Compare the SMS trunk types and choose how messages travel between
DIDWW and your systems.

[SMS trunks](../index.html)

**Create an SMS to Email trunk**

Configure a trunk to forward inbound SMS messages to an email address.

[Create an SMS to Email trunk](../sms-to-email/how-to-guides/create-sms-to-email-trunk.html#user-panel-sms-to-email-trunk-create)

**Create an HTTP IN trunk**

Configure a trunk to forward inbound SMS messages to a web server.

[Create an HTTP IN trunk](../http-in/how-to-guides/create-http-in-trunk.html#user-panel-sms-to-http-in-trunk-create)

**Create an SMPP ESME trunk**

Configure a trunk that your application binds to over SMPP.

[Create an SMPP ESME trunk](../smpp-esme/how-to-guides/create-smpp-esme-trunk.html#user-panel-sms-smpp-esme-create)

**Create an SMPP SMSC trunk**

Configure a trunk that DIDWW uses to bind to your SMSC over SMPP.

[Create an SMPP SMSC trunk](../smpp-smsc/how-to-guides/create-smpp-smsc-trunk.html#user-panel-sms-smpp-smsc-create)
