SMS Delivery Report using GSMComm ReadMessage Error

224 Views Asked by At

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."
            }
        }
0

There are 0 best solutions below