Send SMS with delivery message

I use the GSM Communication Library (GSMComm) to send and receive SMS messages with a GSM modem. How to send an SMS with a delivery message? How can I get the status of sending messages?

+4
source share
1 answer

You first read all the messages from the SIM card (since the message on the status of messages is sent as SMS back to your SIM card from the provider you are using).
Go through these messages and filter the status messages.
You should have saved the identifier of sent sms from your mobile phone 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() } } 
+3
source

Source: https://habr.com/ru/post/1333288/


All Articles