无法从c#应用程序接收短信

时间:2011-12-15 07:39:11

标签: c# sms windows-applications

我正在开发一个向数字发送短信的应用程序。我正在使用GSMComm库进行应用程序。

该程序从SQL数据库中获取详细信息,并且有一个特定时间将其发送到该数字。

bool check;
            do
            {
                detail = new string[3];

                //Gets the Details from the database
                detail = q.GetQueuePhone();

                // the target time of sending the sms
                int time = Convert.ToInt32(Convert.ToDateTime(detail[2]).TimeOfDay.TotalMilliseconds);

                if (time != 0)
                {
                    //time left
                    int Interval = time - Convert.ToInt32(DateTime.Now.TimeOfDay.TotalMilliseconds);

                    //Start counting
                    Thread.Sleep(Interval);

                    SmsSubmitPdu pdu;
                    //detail[1] have the Phone Number
                    pdu = new SmsSubmitPdu(TextMsg, detail[1]);
                    comm.SendMessage(pdu);

                    //sending on that number is done
                    q.UpdateCustomerStat(detail[0]);
                }
                else
                {
                    //recheck the database again
                    check = true;
                    Thread.Sleep(30000);
                }
            } while (check);

当电话号码未收到程序发送的消息时,我的问题就开始了。

任何人都可以帮助我吗?

编辑: 这是GSMComm的日志

Info       16:07:48.005 Sending message...
Info       16:07:50.091 Message sent successfully.
Info       16:07:48.015 [gsmphone] Activating PDU mode...
Verbose    16:07:48.016 [gsmphone] << AT+CMGF=0
Verbose    16:07:48.016 [gsmphone]    
Verbose    16:07:48.033 [gsmphone] >> 
Verbose    16:07:48.033 [gsmphone]    OK
Verbose    16:07:48.033 [gsmphone]    
Info       16:07:48.033 [gsmphone] Sending message...
Verbose    16:07:48.034 [gsmphone] << AT+CMGS=28
Verbose    16:07:48.034 [gsmphone]    
Verbose    16:07:48.036 [gsmphone] >> 
Verbose    16:07:48.036 [gsmphone]    > 
Verbose    16:07:48.036 [gsmphone] << 0011000C819051258225 30000A70F54747A0E4ACF416110BD3CA78700
Verbose    16:07:50.091 [gsmphone] >> 
Verbose    16:07:50.091 [gsmphone]    
Verbose    16:07:50.091 [gsmphone]    +CMGS: 27
Verbose    16:07:50.091 [gsmphone]    
Verbose    16:07:50.091 [gsmphone]    OK
Verbose    16:07:50.091 [gsmphone]    
Info       16:07:50.091 [gsmphone] 21 characters received after 2059 ms.
Info       16:07:50.091 [gsmphone] Message reference = 27

0 个答案:

没有答案