【问题标题】:Sending Multipart PDU SMS by AT Command通过 AT 命令发送 Multipart PDU SMS
【发布时间】:2013-08-24 14:43:56
【问题描述】:

我已成功发送多部分 pdu 短信,

问题是当我尝试将此短信发送到不同网络上的号码时,它给了我以下错误:

+CMGS ERROR:500

谁能告诉我该怎么做。

        atCommandStr = "AT+CMGF=0\r";
        comPort.WriteLine(atCommandStr + (char)13);
        Console.WriteLine(comPort.ReadExisting());

        Thread.Sleep(2000);

        for (int i = 0; i < number_of_parts; i++)
        {
            int oct = (messagesParts[i].ToCharArray().Count() / 2) -1;

            atCommandStr = "AT+CMGS=" + oct + "\r";
            comPort.WriteLine(atCommandStr + (char)13);
            Console.WriteLine(comPort.ReadExisting());

            Thread.Sleep(2000);

            string path;
            path = messagesParts[i] + Char.ConvertFromUtf32(26);
            comPort.WriteLine(path + (char)13);

            for (int a = 0; a < 100; a++)
            {
                Thread.Sleep(2000);

                string t = comPort.ReadExisting();
                Console.WriteLine(t);

                if (t != "" && t.Contains("CMGS") || t.Contains("ERROR"))
                {

                    break;
                }
            }

            //Console.WriteLine(comPort.ReadExisting());
        }

【问题讨论】:

标签: c# sms at-command pdu


【解决方案1】:

调制解调器是否真的返回+CMGS ERROR:500 而不是+CMS ERROR: 500?因为在这种情况下,您的调制解调器不符合指定if sending fails: +CMS ERROR: &lt;err&gt;27.005 标准。

错误代码 500 表示 unknown error,因此没有多大帮助。但我猜你的长度计算是错误的。来自标准:

<length> must indicate the number of octets coded in the TP layer data unit
to be given (i.e. SMSC address octets are excluded).

除以2后减1是否正确?尝试准确解码将在 TP 层发送的内容。尝试稍微增加/减少长度,看看是否有什么不同。


此外,由于 atCommandStr 已包含 \r,因此您不应在其中包含 + (char)13

comPort.WriteLine(atCommandStr + (char)13);

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2022-10-13
    • 2013-04-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多