Table of Contents

Tracking message sending and delivery

In the context of the SMPP protocol, it's crucial to keep a record of messages being delivered to the recipient.

Tracking sending

The SMPP server generates a unique MessageId for each SubmitSm PDU received from the SMPP client and sends it back in the response SubmitSmResp. In the case of a concatenated message, which consists of multiple parts, each part is assigned a unique MessageId generated by the server.

A response with the status ESME_ROK and the defined MessageId means that the server has accepted a SubmitSm PDU for delivery.

For more information, you can refer to articles on how to create and send messasge with an SMPP client or how the SMPP server receives the message.

Tracking delivery

To obtain a delivery receipt, the property RegisteredDelivery must be set to 1 in the SubmitSm PDU. The delivery receipt contains the field MessageId, which matches the MessageId of the response SubmitSmResp for the original message/part sent earlier.

Note

Sometimes, the delivery receipt in the DeliverSm PDU is received earlier than the SubmitSmResp. You must consider this when implementing your tracking mechanisms.

The following code example is a simple handler for the event evDeliverSm. It gets the MessageId and status from received delivery report DeliverSm.

...

_client.evDeliverSm += OnDeliverSmTracking;

...

private void OnDeliverSmTracking(object o, DeliverSm deliverSm)
{
    if (deliverSm.MessageType == MessageTypes.SMSCDeliveryReceipt)
    {
        _log.Info("Delivery Receipt received");

        string messageId = deliverSm.Receipt.MessageId;
        MessageState deliveryStatus = deliverSm.Receipt.State;
    }
}

Read more details about tracking message delivery status