# SMPP ESME trunk

An **SMPP ESME** (External Short Messaging Entity) **trunk** lets your
application connect directly to the DIDWW SMSC (Short Message Service Center)
to send and receive SMS. Once bound, your application can submit outbound SMS.
To also receive SMS, assign the trunk to one or more DIDs that support inbound
SMS.

Use this trunk type when your application connects to DIDWW as an SMPP client.
If DIDWW should bind to your own SMSC instead, use an [SMPP SMSC trunk](../smpp-smsc/smpp-smsc-trunk.html).

## How SMPP ESME trunks work

In SMPP, an ESME is an external application that connects to an SMSC to send
and receive SMS. With an SMPP ESME trunk, your application is the ESME and
DIDWW is the SMSC. Your application opens the connection and performs the bind
with the trunk's **System ID** and **Password**.

Each trunk uses the DIDWW SMPP server of its **Server location**: **US, NY**
or **NL, AMS**. The location determines the **Host** that your application
binds to. Your application connects on port `2775` for SMPP over plain TCP
or on port `2776` for SMPP over TLS. Both ports use the same credentials.
For the TLS requirements, see [SMPP over TLS](../technical-data/smpp-specification.html#smpp-tls).

Your firewall must allow your application to open connections to the IP
address of the trunk's **Server location**. The trunk's **Allowed IP
addresses** setting can also limit the IP addresses that are authorized to
connect. If the setting is empty, all IP addresses are allowed.

The DIDWW User Panel shows whether your application is currently bound to the
trunk. Checking the status does not connect your application. Only your
application can establish the bind.

## Inbound and outbound message flows

Your application and DIDWW exchange messages over the bind as SMPP Protocol
Data Units (PDUs):

- **Outbound SMS:** Your application submits each message with
  `submit_sm`.
- **Inbound SMS:** DIDWW delivers messages sent to the DIDs assigned to the
  trunk with `deliver_sm`.
- **Delivery receipts:** DIDWW returns delivery receipts (DLRs) for outbound
  messages with `deliver_sm`.

The receiving side acknowledges `submit_sm` with `submit_sm_resp` and
`deliver_sm` with `deliver_sm_resp`. For the PDU details, see
[SMPP message flow](../technical-data/smpp-specification.html#smpp-pdu-flow).

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

flowchart TB

    subgraph outbound["Outbound SMS"]
        direction LR
        app_out["Your application (ESME)"] --> |"submit_sm"| trunk_out["SMPP ESME trunk"]
        trunk_out --> |"SMS"| recipient["Recipient"]
        trunk_out -.-> |"deliver_sm (DLR)"| app_out
    end

    subgraph inbound["Inbound SMS"]
        direction LR
        sender["Sender"] --> |"SMS to DID"| did["Assigned DID number"]
        did --> trunk_in["SMPP ESME trunk"]
        trunk_in --> |"deliver_sm"| app_in["Your application (ESME)"]
    end

    outbound ~~~ inbound

    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 app_out,app_in,recipient,sender endpoint
    class trunk_out,trunk_in,did process

    style outbound fill:#f8fafc,stroke:#cbd5e1,color:#1f2d3d
    style inbound fill:#f8fafc,stroke:#cbd5e1,color:#1f2d3d

    linkStyle 0,1,2,3,4,5 stroke:#0066cc,stroke-width:1.5px
```

Long SMS are sent as concatenated (multipart) messages. DIDWW delivers each
part of an inbound multipart SMS in a separate `deliver_sm` that carries a
User Data Header (UDH) in the `short_message` field. Your application must
process the UDH and reassemble the parts. When your application sends a long
SMS, it submits each part with its own UDH. For encoding limits,
concatenation, and how message parts are billed, see [SMS encoding
reference](../technical-data/sms-encoding-reference.html#sms-encoding-reference).

## Sender IDs and DID numbers

DID numbers have a different role in each direction:

- **Inbound SMS:** The trunk, or an SMS trunk group that contains it, must be
  [assigned](../../../phone-numbers/my-numbers/how-to-guides/assign-sms-trunk.html#assigning-sms-trunk) to one or more DIDs that support
  inbound SMS. Messages sent to those DIDs are then delivered to your
  application.
- **Outbound SMS:** DID assignment is not required. The sender ID, also called
  the source address, depends on the type of message:

  - **P2P messages** use one of your DID numbers as the sender ID. By default,
    all DIDs with Outbound P2P SMS enabled in your account can be used. In
    **Source Address Settings**, you can limit the trunk to specific DID
    numbers. See [P2P Outbound SMS access](../../how-sms-service-works.html#how-sms-service-works-p2p-access).
  - **A2P messages** use a verified Sender ID, such as an Alphanumeric Sender
    ID. Associate an active [Sender ID Verification](../../sender-id-verifications/index.html) with the SMPP ESME trunk.

## Failover with SMS trunk groups

An SMPP ESME trunk can be added to an [SMS trunk group](../trunk-groups/sms-trunk-groups.html) with other SMS trunks.
When
the group is assigned to a DID, DIDWW attempts the member trunks for inbound
SMS in priority order, starting with the highest-numbered priority, and tries
the next trunk if one is unavailable.

---

## Get started

Create a trunk, bind your application, and assign the trunk to DIDs to
receive SMS.

**Create an SMPP ESME trunk**

Select the Server location, limit IP addresses and sender IDs, and
create the trunk.

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

**Bind an SMPP ESME trunk**

Configure your application with the bind parameters and connect over
plain TCP or TLS.

[Bind an SMPP ESME trunk](how-to-guides/bind-smpp-esme-trunk.html)

**Assign an SMS trunk**

Assign the trunk to DIDs that support inbound SMS to start receiving
messages.

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

## Credentials and connection status

Find the values your application binds with and confirm that it is connected.

**View SMPP ESME trunk credentials**

Look up the Host, Port, System ID, Password, and System Type of a
trunk.

[View SMPP ESME trunk credentials](how-to-guides/view-smpp-esme-trunk-credentials.html)

**Regenerate SMPP ESME trunk credentials**

Replace the trunk credentials and update every application that binds
with them.

[Regenerate SMPP ESME trunk credentials](how-to-guides/regenerate-smpp-esme-trunk-credentials.html)

**Check SMPP ESME trunk connection status**

Confirm in the DIDWW User Panel whether your application is connected.

[Check SMPP ESME trunk connection status](how-to-guides/check-smpp-esme-trunk-connection-status.html)

## Manage trunks and failover

Change existing trunks and combine them with other SMS trunks for failover.

**Manage SMPP ESME trunks**

Edit trunk settings, move a trunk to another Server location, or delete
trunks that are no longer required.

[Manage SMPP ESME trunks](how-to-guides/manage-smpp-esme-trunk.html)

**Create an SMS trunk group**

Combine SMS trunks into one group for failover.

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

**Set priorities in an SMS trunk group**

Control the order in which the member trunks of a group are attempted.

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

## Technical references

**SMPP ESME trunk settings reference**

Find field definitions, defaults, and constraints for SMPP ESME trunk
settings and credentials.

[SMPP ESME trunk settings reference](smpp-esme-trunk-settings-reference.html)

**SMPP specification**

Review detailed protocol information, including bind parameters, PDUs,
TLS, and all available DIDWW endpoints.

[SMPP Specifications](../technical-data/smpp-specification.html#service-incoming-sms)

**SMS encoding reference**

Look up encoding limits, concatenation, and how message parts are
billed.

[SMS encoding reference](../technical-data/sms-encoding-reference.html#sms-encoding-reference)

## Related resources

Connect an SMPP platform, prepare Sender IDs, and review message activity.

**Send and receive SMS with OpenSIPS**

Connect OpenSIPS 4.0 to an SMPP ESME trunk to send SMS, receive SMS,
and receive delivery receipts.

[SMS over SMPP](../../../integrations/opensips/sms.html#opensips-sms-integration)

**Sender ID Verifications**

Register sender IDs for application-to-person (A2P) messaging.

[Sender ID Verifications](../../sender-id-verifications/index.html)

**Inbound SMS logs**

Review inbound SMS delivered through your SMS trunks.

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

**Outbound SMS logs**

Review outbound SMS sent from your account.

[Outbound SMS Logs](../../../logs-analytics/sms-logs/outbound-logs.html#outbound-logs)

**SMPP SMSC trunk**

Let DIDWW bind to your own SMSC instead.

[SMPP SMSC trunk](../smpp-smsc/smpp-smsc-trunk.html)
