Table of Contents

Track message sending and delivery

Track sending

The SMPP-server generates unique MessageId for each SubmitSm PDU received from SMPP-client. In case of a multipart message (long message split into parts) each part is assigned with unique MessageId generated by the server.

The client receives information about MessageId as PDU SubmitSmResp response from SMPP-server. The fact of issuing MessageId for message/part means server accepted it for further processing. You can read more about ways of collecting server responses SubmitSmResp in the article Create and sendmessasge.

Track delivery

During message creation it is necessary to set property "registered delivery" in order to get delivery reports after sending. The field MessageId is present in each delivery report and matches MessageId of the original message/part send before. Matching of delivery reports to original messages is possible by using MessageId and looking for identical values. This way is possible to track delivery progress.

There is a simple handler for evDeliverSm event in the following example. It extracts MessageId and status from received delivery report DeliverSm. The next thing to do is to search this MessageId in messages sent before.

...

_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