Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Send SMS with Delivery Report

Tags:

c#

windows

sms

I Use GSM Communication Library (GSMComm) for send and receive SMS with GSM modem. How Can I Send Sms With Delivery Report? How Can I get Status of Send Messages?

like image 880
Hossein Moradinia Avatar asked Oct 14 '22 19:10

Hossein Moradinia


1 Answers

you first read all messages from the SIM (since status report msg is sent as sms back to your SIM from the provider you use).
Iterate through these msgs and filter out the status msgs.
You must have saved the id of the sent sms from your mobile data.Status.ToString() :

GsmCommMain comm = new GsmCommMain(port, baundRate, timeout);
//.... Other code may goes here
// Read all SMS messages from the storage
    DecodedShortMessage[] messages = comm.ReadMessages(PhoneMessageStatus.All, 
    PhoneStorageType.Sim );// Or PhoneStorageType.Phone
    foreach (DecodedShortMessage message in messages)
        {
          if (((SmsPdu)message.Data) is SmsStatusReportPdu)
          {
                //HERE WE'LL GET THE STATUS REPORT
                SmsStatusReportPdu data = (SmsStatusReportPdu)message.Data;
                //Recipient: data.RecipientAddress
                //Status: data.Status.ToString()
                //Timestamp: data.DischargeTime.ToString()
                //Message ref (ID of the sent sms from the mobile): data.MessageReference.ToString()


      }
    }
like image 50
Rami Alshareef Avatar answered Oct 17 '22 02:10

Rami Alshareef