开发者

Send SMS with Delivery Report

开发者 https://www.devze.com 2023-01-31 21:50 出处:网络
I Use GSM Communication Library (GSMComm) for se开发者_运维知识库nd and receive SMS with GSM modem. How Can I Send Sms With Delivery Report? How Can I get Status of Send Messages?you first read all me

I Use GSM Communication Library (GSMComm) for se开发者_运维知识库nd and receive SMS with GSM modem. How Can I Send Sms With Delivery Report? How Can I get Status of Send Messages?


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()


      }
    }
0

精彩评论

暂无评论...
验证码 换一张
取 消