# SMS over SMPP

Use FreeSWITCH with a **DIDWW SMPP ESME trunk** to send and receive SMS.

FreeSWITCH binds to the DIDWW SMSC as an SMPP client using `mod_smpp`.
The module is part of the FreeSWITCH source tree but is not built by default.
This guide builds FreeSWITCH from source with the unmodified module.
For inbound and outbound calling, see [Voice over SIP](voice.html).

Warning

DIDWW does not operate or control third-party platforms or services and is
not responsible for their security, functionality, availability or data
handling practices. You are responsible for the third-party services you
connect, the access you grant, the API keys, credentials and other
information you share, as well as all resulting activity and charges on
your DIDWW account, including unauthorized or fraudulent use attributable
to such access.

---

## 1. Configure SMPP ESME trunk

Configure an SMPP ESME trunk in the DIDWW User Panel so that FreeSWITCH can
bind to the DIDWW SMSC. For every field of the form, see
[Create an SMPP ESME trunk](../../sms/sms-trunks/smpp-esme/how-to-guides/create-smpp-esme-trunk.html).

### Before you begin

- An active DIDWW account is required. [Sign in to DIDWW](https://my.didww.com/users/sign_in) or [create a DIDWW account](https://my.didww.com/users/sign_up#/users/sign_up).
- To send SMS, a sender is required. Use a DID number with **Outbound P2P
  SMS** enabled for P2P messaging, or a verified sender ID for A2P messaging.
  See [Sender ID Verifications](../../sms/sender-id-verifications/index.html#sender-id-verifications).
- To receive SMS, a DID number that supports inbound SMS is required. If you
  do not have one, see [How to buy numbers](../../phone-numbers/buy-numbers/how-to-buy.html).
- The FreeSWITCH server must be able to open a TCP connection to the DIDWW
  SMSC on port `2775`.

### Step 1: Create New SMPP ESME trunk

1. In the [DIDWW User Panel](https://my.didww.com/#/sms_trunks), go to
   **SMS > SMS Trunks**.
2. Click **Create New > SMPP ESME**.

![Creating a new SMPP ESME trunk from the Create New menu](../../_images/fig12.webp)


Creating a new SMPP ESME trunk.

### Step 2: Configure general trunk settings

In the **Create SMPP ESME Trunk** form:

1. Enter a **Friendly name** for the trunk (e.g., `FreeSWITCH`).
2. Enter a **System type** of at most 12 characters (e.g., `FreeSWITCH`).
   FreeSWITCH must send exactly this value when it binds. The value is
   case-sensitive.
3. Select the **Server location**: **US, NY** or **NL, AMS**. It determines
   the host FreeSWITCH connects to.
4. Optionally, enter the public IP address of the FreeSWITCH server in
   **Allowed IP addresses**. If the field is empty, any address can connect
   with the trunk credentials.
5. Under **Source Address Settings**, keep **Allow any DID(s) for SMS OUT**
   enabled, or turn it off and select the DIDs allowed as senders.

![General and source address settings in the Create SMPP ESME Trunk form](../../_images/fig27.webp)


SMPP ESME trunk settings.

### Step 3: Click Create and save the SMPP ESME trunk

Click **Create** to save the trunk. The trunk appears in the **SMS Trunks**
list.

![Create button in the Create SMPP ESME Trunk form](../../_images/create.webp)


Saving the SMPP ESME trunk.

### Step 4: Copy the trunk credentials

1. In the **SMS Trunks** list, click the key icon in the **Credentials**
   column of the trunk.
2. Copy the **Host**, the **System ID**, and the **Password** (click the eye
   icon to show it). You will use them to [define the gateway](#freeswitch-sms-define-gateway).

Note

The unmodified `mod_smpp` bind request uses at most 15 characters of the
**System ID**, 8 of the **Password**, and 12 of the **System type**. Longer
values are truncated. Check the credential lengths before configuring
them. Do not shorten credentials issued by DIDWW to make them fit: the
truncated value will not authenticate.

![SMPP ESME trunk credentials showing the host, System ID, and password](../../_images/credentials.webp)


SMPP ESME trunk credentials.

### Step 5: Assign the trunk to your DID numbers

This step is required only to receive SMS.

1. In the [DIDWW User Panel](https://my.didww.com/#/user_dids), go to
   **Phone Numbers > My Numbers**.
2. In the **Trunk** column of the DID, click the **SMS:** entry and select the
   trunk created in [Step 3](#freeswitch-sms-save-trunk).
3. Click **Confirm**.

To assign the trunk to several DIDs at once, see [Assign an SMS
trunk](../../phone-numbers/my-numbers/how-to-guides/assign-sms-trunk.html#user-panel-assign-sms-trunk).

---

## 2. Configure FreeSWITCH

Configure FreeSWITCH to bind to the DIDWW SMSC. Replace the uppercase
placeholders with the values for your deployment. Back up the configuration
files before replacing their contents.

Paths below are relative to the FreeSWITCH configuration directory. Source
installations commonly use `/usr/local/freeswitch/conf`; package
installations commonly use `/etc/freeswitch`.

### Before you begin

- Have the **System ID**, **Password**, **Host**, and **System type** from
  [Part 1](#freeswitch-sms-configure-trunk) at hand.
- `mod_smpp` requires `libsmpp34` version 1.10 or later. On Debian,
  install the `libsmpp34-dev` package before configuring FreeSWITCH.
- Prepare the FreeSWITCH source tree and its other build dependencies using
  the official [FreeSWITCH installation
instructions](https://developer.signalwire.com/freeswitch/foundations/getting-started/#building-from-source).

Important

`mod_smpp` connects over plain TCP. It cannot use port `2776` (TLS).

### Step 1: Build FreeSWITCH with mod\_smpp

In the FreeSWITCH source tree, after running `./bootstrap.sh`, enable the
module in `modules.conf` by removing the `#` from this line:

```
event_handlers/mod_smpp
```

Then configure, build, and install FreeSWITCH:

```
1CFLAGS="-g -O2 -Wno-error=stringop-truncation" ./configure
2make
3make install
```

Note

With GCC 12 on Debian 12, the module build can stop with
`'strncpy' specified bound 41 equals destination size`. The
`-Wno-error=stringop-truncation` flag in the build command keeps this
warning from being treated as an error.

### Step 2: Define the gateway

Replace the contents of `autoload_configs/smpp.conf.xml` with:

```
 1<configuration name="smpp.conf" description="SMPP gateways">
 2  <gateways>
 3    <gateway name="didww">
 4      <params>
 5        <param name="host" value="SMSC_HOST"/>
 6        <param name="port" value="2775"/>
 7        <param name="system_id" value="SYSTEM_ID"/>
 8        <param name="password" value="PASSWORD"/>
 9        <param name="system_type" value="SYSTEM_TYPE"/>
10        <param name="profile" value="default"/>
11        <param name="debug" value="1"/>
12      </params>
13    </gateway>
14  </gateways>
15</configuration>
```

| Parameter | Value |
| --- | --- |
| `host` | The **Host** from [Part 1, Step 4](#freeswitch-sms-copy-credentials). |
| `system_id`, `password` | The **System ID** and **Password** from the same credentials window. |
| `system_type` | The **System type** from [Part 1, Step 2](#freeswitch-sms-trunk-settings). |
| `profile` | `default`. |
| `debug` | `1` writes every SMPP PDU to the log, including the password in the bind request. Set it to `0` after the first test and restart FreeSWITCH. |

### Step 3: Load the modules

In `autoload_configs/modules.conf.xml`, uncomment or add the entries for
`mod_sms` and `mod_smpp`:

```
1<load module="mod_sms"/>
2<load module="mod_smpp"/>
```

### Step 4: Configure inbound messages

FreeSWITCH passes inbound SMS to the `default` chatplan context. Replace
`chatplan/default.xml` with the following configuration:

```
 1<include>
 2  <context name="default">
 3    <extension name="inbound_from_didww">
 4      <condition field="proto" expression="^smpp$">
 5        <action application="set" data="final_delivery=true"/>
 6        <action application="info"/>
 7      </condition>
 8    </extension>
 9  </context>
10</include>
```

The `info` action writes the message to the log: the sender is in
`from_user` and the receiving DID is in `to_user`. Replace it with your
own message handling after verifying inbound delivery. The log can include
message text and phone numbers.

Important

Keep the `final_delivery` action. Without it, FreeSWITCH can send an
inbound SMS back to the SMSC as a new outbound message.

### Step 5: Start FreeSWITCH and verify the bind

Start FreeSWITCH. The gateway binds when `mod_smpp` loads. Restart
FreeSWITCH after changing the gateway configuration; `reloadxml` alone
cannot reconnect the gateway with new settings.

| Check | Action | Expected result |
| --- | --- | --- |
| Module | `fs_cli -x 'module_exists mod_smpp'` | `true`. |
| Bind | Read the FreeSWITCH log. | `BIND_TRANSCEIVER_RESP` with `command_status [00000000] - [ESME_ROK]`. |
| Inbound SMS | Send an SMS from a handset to the DID assigned to the trunk. | An inbound `DELIVER_SM` and the chatplan `info` output show the sender, receiving DID, and message. |

---

## 3. Send a message

Send an SMS with the `smpp_send` command:

```
1fs_cli -x 'smpp_send didww|RECIPIENT|SENDER|Hello from FreeSWITCH'
```

The fields are the gateway name, the recipient, the sender, and the text.
Replace `RECIPIENT` and `SENDER` with numbers in international format
without `+`. Use a sender authorized for your DIDWW account and a handset
that you can check for the test.

Note

The unmodified `smpp_send` API does not write a response to the CLI.
`fs_cli` can print `-ERR no reply` even when the SMSC accepts the
message. With `debug` set to `1`, look for `SUBMIT_SM_RESP` with
`ESME_ROK` in the log to confirm acceptance. Check the receiving handset
to confirm delivery: SMSC acceptance alone does not confirm delivery.

After testing, set the gateway's `debug` parameter to `0` and restart
FreeSWITCH to disable per-gateway PDU debug logging. The chatplan `info`
action continues to log message content until you replace it with your own
handling.

## Limitations

- `mod_smpp` does not split long messages into parts. Keep test messages
  within one SMS. GSM-7 allows up to 160 septets; extended-table characters
  use two septets each. Longer text can be truncated or rejected, so do not
  rely on the module's message buffer size as an SMS length limit.
- The text cannot contain `|`. The API treats it as a field separator and
  drops the text after it.
- The module sends the message bytes as supplied with `data_coding` set
  to `0`. It does not convert the text to GSM-7 or UCS-2. Use simple text
  for the first test; do not assume arbitrary Unicode text is supported.
- The module does not request delivery receipts.
- The SMPP connection is plain TCP; native TLS is not available in this
  module.

For the module's interfaces and configuration, see the official
[mod\_smpp reference](https://developer.signalwire.com/freeswitch/module-reference/event-handlers/mod_smpp/).
The [module source](https://github.com/signalwire/freeswitch/tree/master/src/mod/event_handlers/mod_smpp)
shows the bind-field handling, message encoding, and CLI response behavior.
