0

I've been trying to use GSMComm library in a C# app, in order to sent SMS messages(receive delivery report) , using a GSM modem (wavecom). I've read all similar threads in SO, but didn't help. Error: "Message type SmsDeliverReport recognized, but not supported by the SMS decoder."

  public bool SendSMS()
        {
            try
            {
                string strMsg = "Hello";
                string strSendPhoneNum = "phone num"; 
                string strSimPhoneNum = "phone num";
                if (comm.IsConnected() == false) comm.Open();

                var dcs = (byte)DataCodingScheme.GeneralCoding.Alpha16Bit;
                GsmComm.PduConverter.SmsSubmitPdu pdu = new GsmComm.PduConverter.SmsSubmitPdu(strMsg, strSendPhoneNum, strSimPhoneNum, dcs);
                pdu.RequestStatusReport = true;

                comm.SendMessage(pdu);

                SmsDeliverMessageFlags sdmf = new SmsDeliverMessageFlags();
                string DeliverRpt = sdmf.MessageType.ToString();
                return true;
            }
            catch (Exception ex)
            {
                return false;
            }
        }
 private void comm_MessageReceived(object sender, GsmComm.GsmCommunication.MessageReceivedEventArgs e)
        {
            try
            {
                IMessageIndicationObject obj = e.IndicationObject;
                //Get status report for this condition
                if (obj is MemoryLocation)
                {
                    MemoryLocation loc = (MemoryLocation)obj;
                    string stTemp = string.Format("New message received in storage \"{0}\", index {1}.", loc.Storage, loc.Index);

                    var msg = comm.ReadMessage(loc.Index, loc.Storage);

                    if (((SmsPdu)msg.Data) is SmsStatusReportPdu)
                    {
                        SmsStatusReportPdu data = (SmsStatusReportPdu)msg.Data;
                        string strTemp2 = "rec msg ref #: " + data.MessageReference;
                    }
                    string strTemp3 = msg.Status.ToString();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message); //Error:"Message type SmsDeliverReport recognized, but not supported by the SMS decoder."
            }
        }
miss_rose
  • 11
  • 2
  • A SMS modem cannot receive SMS messages. There is no account. The SMS modem sends message through a bridge that is one way toward cell tower. But you do not have an account you cannot receive. – jdweng Jun 06 '21 at 12:56
  • Hi, delivery report event (comm_MessageReceived) successfully fired but there is an error in source code – miss_rose Jun 06 '21 at 13:04
  • Not sure. It sound like the MODEM successfully sent message, then in the event you tried to read a response that was null since you cannot get a response from a GSM. – jdweng Jun 06 '21 at 15:42
  • First I turned off my mobile phone (destination sim) and then sent an sms with a gsm modem , the event (comm_MessageReceived) did not fire. After turning on my mobile phone, I received an sms, but the event(comm_MessageReceived) did not fire again. – miss_rose Jun 07 '21 at 04:31
  • The issue is not the event, but the code inside the event. You will get an event indicating the modem connected to the base station. You cannot read the status of the message. – jdweng Jun 07 '21 at 07:03

0 Answers0