Sending SMS using the SMPP protocol
The open protocol SMPP allows technicians and companies to integrate their applications with the SMS messaging platform of LabsMobile using a widely adopted standard in telecommunications. This protocol is used for the exchange of SMS messages between short message service centers (SMSC) and external sending applications.
The functionalities through the SMPP protocol are:
- Sending Standard SMS
- Sending Unicode SMS
- Sending Concatenated SMS
- Receive the status of each SMS (DLR)
This documentation explains in detail the integration and automation process of these functionalities.
To start an integration with sending via the SMPP protocol, the following requirements are essential:
- A LabsMobile account associated with a username (registration email). Create an account here.
- It is necessary to have a user (system_id) and an SMPP password for authentication.
- The account must have available balance to allow message sending.
To take into account
This documentation is intended for software developers and programmers looking to implement SMS message sending using the SMPP protocol. Currently, version 3.4 is used.
Si esta integración no se ajusta a los requerimientos o si prefiere un enfoque más sencillo, es recomendable usar la API http/POST.
Activation of the SMPP Service
To activate this service, it is necessary to send an email to the support area support@labsmobile.com. The email must specify:
- Email associated with the account
- Estimated monthly volume of messages
- IP address of the server that will make the SMPP connections
With the information described above, the user (system_id) and the password that will be used for authentication will be established.
Recommendation We recommend activating Automatic Top-ups so that there are always available credits in the account and the SMS sending service is not interrupted.
PDU SMPP compatible
The SMPP server supports the following PDU, fundamental for establishing and maintaining communication between the client and the server. Below are detailed their main functions and how they intervene in the transmission and reception of SMS messages.
- Expand all
Types of PDU
The SMPP server supports the following PDU
bind_transmitter
It is a request to establish an SMPP session as a transmitter. The client sends this command to the SMSC (server) to authenticate and send outgoing SMS messages.
unbind
It is used to close an SMPP session correctly. Indicating that it no longer needs to keep the connection active.
submit_sm
It is responsible for sending an SMS message through an active session.
deliver_sm
It is the command that the SMSC uses to confirm the delivery status of the message (DLR).
enquire_link
It serves as a
ping
maintenance to check that the connectionTCP
is still active between the client and the server.
Recommendation Make sure that the provided IP is correctly configured to establish outgoing connections to the SMPP server. In addition, we recommend using a static IP and a dedicated server to ensure the stability and security of the connection.
Examples of PDU
Below are the different types of response PDU and delivery (DLR) that the LabsMobile platform can return via SMPP connection.
Response Successful - ESME_ROK
This PDU is returned after the successful sending of an SMS. And returns the status ESME_ROK
{ "params": { "message_id": "68090a534e551" }, "tlvs": {}, "cmdLength": 30, "cmdId": 2147483652, "cmdStatus": "ESME_ROK", "seqNr": 2, "cmdName": "submit_sm_resp" }
Error Unknown - ESME_RUNKNOWNERR
In case of failure, a generic status such as ESME_RUNKNOWNERR
can be returned.
{ "params": { "message_id": "" }, "tlvs": {}, "cmdLength": 16, "cmdId": 2147483652, "cmdStatus": "ESME_RUNKNOWNERR", "seqNr": 2, "cmdName": "submit_sm_resp" }
Response Successful - DELIVERED
Indicates that the message was delivered correctly to the end-user device. The platform can return two types of response: a DLR with the status of the message or a PDU object with the corresponding information.
DLR indicating the status of the message
{ "statusMsg": "DELIVERED", "statusId": 2, "smsId": "68090a534e551" }
PDU object with information on the status of the message
{ "params": { "source_addr": "573137464378", "destination_addr": "SENDER", "esm_class": 4, "short_message": "id:68090a534e551 submit date:2504231542 done date:2504231543 stat:DELIVRD err:000" }, "tlvs": { "message_state": { "tagId": 1063, "tagName": "message_state", "tagValue": 2 }, "receipted_message_id": { "tagId": 30, "tagName": "receipted_message_id", "tagValue": "68090a534e551" } }, "cmdName": "deliver_sm", "cmdStatus": "ESME_ROK" }
Error in delivery - UNDELIVERABLE
Indicates that the message could not be delivered to the end-user device. The platform can return two types of response: a DLR with the status of the message or a PDU object with detailed information about the error.
DLR indicating failure in message delivery
{ "statusMsg": "UNDELIVERABLE", "statusId": 5, "smsId": "6809168bddf6b" }
PDU object with information on the delivery failure
{ "params": { "source_addr": "573137464378", "destination_addr": "SENDER", "esm_class": 4, "short_message": "id:6809168bddf6b submit date:2504231634 done date:2504231635 stat:UNDELIV err:001" }, "tlvs": { "message_state": { "tagId": 1063, "tagName": "message_state", "tagValue": 5 }, "receipted_message_id": { "tagId": 30, "tagName": "receipted_message_id", "tagValue": "6809168bddf6b" } }, "cmdName": "deliver_sm", "cmdStatus": "ESME_ROK" }
Important The code ESME_ROK
indicates that the request was accepted at the protocol level, but does not imply that the message was delivered to the user's device. A DLR or PDU object should be awaited to know the final delivery status.
Recommendation In case of receiving ESME_RUNKNOWNERR
, check that your account has available balance to make shipments. Also, make sure that the destination phone number and the message content are specified correctly.
Parameters of connection
The following data is necessary to establish an SMPP connection and allow the sending of SMS messages. Below are the values and the function of each of the required parameters.
system_id | User identifier assigned for SMPP authentication |
password | Password associated with the system_id |
host | IP or domain of the SMPP server |
port | TCP port to establish the connection (default: 2775) |
bind_type | Defines what operations the client can perform. |
Delivery status
Below is a description of each of the delivery statuses:
DELIVERED | Indicates that the message was successfully delivered to the recipient's device. |
UNDELIVERABLE | Not possible to deliver the message, usually because the number is incorrect. |
REJECTED | Message rejected by some operator policy or by the mobile device. |
ESME_ROK | Indicates that the operation was accepted correctly. |
ESME_RUNKNOWNERR | Generic error code indicating an unknown error on the SMPP server |
Support resources
We recommend that you consult and take into account the following support resources in your integration: