How to Send SMS Using the SMPP API at the Protocol Level
The Short Message Peer-to-Peer (SMPP) API is a widely adopted protocol for exchanging SMS messages between SMS entities like ESMEs (External Short Message Entities) and SMSCs (Short Message Service Centers). For users of the Ozeki SMS Gateway platform, understanding SMPP protocol-level interactions is critical for optimizing performance, debugging, and custom integrations. This guide explains the SMPP PDUs (Protocol Data Units) required to establish, maintain, and use an SMPP API connection to send SMS messages.
Establishing an SMPP API Connection
To send SMS via SMPP API, you must first bind your client to the Ozeki SMS Gateway server. Three binding types exist: bind_transmitter
, bind_receiver
, and bind_transceiver
. Each defines the direction of message flow.
Key PDUs for Connection Setup
PDU | Direction | Purpose | Key Parameters |
---|---|---|---|
bind_transmitter |
ESME → SMSC | Initiates a connection for sending SMS |
|
bind_receiver |
ESME → SMSC | Sets up a connection for receiving SMS | Same as bind_transmitter |
bind_transceiver |
ESME → SMSC | Enables bidirectional messaging | Same as bind_transmitter |
Upon successful binding, the Ozeki gateway responds with a bind_resp
PDU containing a system_id
acknowledgment. If authentication fails, it returns an error code like ESME_RINVPASWD
.
Maintaining the SMPP API Connection
SMPP connections require periodic keep-alive signals to prevent timeout. Use the enquire_link
PDU:
PDU | Direction | Purpose |
---|---|---|
enquire_link |
ESME ↔ SMSC | Checks if the connection is active |
enquire_link_resp |
ESME ↔ SMSC | Confirms liveliness |
Best Practice: Send enquire_link
every 30-60 seconds. Ozeki SMS Gateway terminates idle connections after 5 minutes by default.
Sending an SMS via SMPP API
The submit_sm
PDU is used to send a single SMS. Its structure includes source/destination addresses and message content:
Parameter | Description | Example |
---|---|---|
service_type |
Type of service (optional) | “” (empty) |
source_addr |
SMS sender address | “12345” |
destination_addr |
Recipient phone number | “+1234567890” |
short_message |
Message payload (UTF-8 or GSM-7) | “Hello World” |
Example submit_sm
Workflow
- ESME sends
submit_sm
to Ozeki SMS Gateway. - Gateway responds with
submit_sm_resp
containing amessage_id
. - Gateway sends
deliver_sm
for delivery reports (if enabled). - ESME replies with
deliver_sm_resp
.
Handling SMPP API Responses and Errors
Ozeki SMS Gateway uses these response PDUs:
PDU | Purpose | Critical Fields |
---|---|---|
submit_sm_resp |
Acknowledges submit_sm |
message_id , command_status |
generic_nack |
Indicates malformed/invalid PDU | command_status (e.g., ESME_RINVMSGLEN ) |
Conclusion
Mastering SMPP API PDUs like bind_transmitter
, enquire_link
, and submit_sm
ensures reliable SMS messaging through Ozeki SMS Gateway. By implementing robust error handling and keep-alive routines, developers can build scalable SMS solutions with minimal downtime.
More information
- Kako nastaviti povezavo odjemalca SMPP API z vašim SMSC
- Kako nastaviti strežnik SMPP API za pošiljanje in prejemanje SMS iz več aplikacij
- Kako izbrati pravega ponudnika SMPP API za vaše podjetje
- Kako poslati SMS z uporabo SMPP API na ravni protokola
- Kako poslati SMS prek SMPP API z uporabo Python
- Kako poslati SMS prek SMPP API z uporabo Javascript
- Kako poslati SMS prek SMPP API z uporabo Java
- Kako poslati SMS prek SMPP API z uporabo PHP
- Kako poslati SMS prek SMPP API z uporabo C#
- Kako poslati SMS prek SMPP API z uporabo C/Cpp
- Kako prejeti SMS z uporabo SMPP API
- Kako prejeti poročilo o dostavi SMS z uporabo SMPP API
- Pogosta vprašanja SMPP API