SMPP 客户端连接但不发送短信

时间:2021-04-07 14:06:51

标签: sms smpp opensmpp

我在 .NET C# 中使用 Jamaa SMPP 库。我可以看到客户端正在连接并且 SendMessage 中没有错误/异常。但是没有短信。

static void Main(string[] args)
        {
            SmppClient client = new SmppClient();
            SmppConnectionProperties properties = new SmppConnectionProperties();
            TextMessage msg = new TextMessage();

            client = new SmppClient();

            properties = client.Properties;
            properties.SystemID = "####";
            properties.Password = "#####";
            properties.Port = 9001;
            properties.Host = "####";
            properties.SystemType = "Transceiver";
            properties.DefaultServiceType = "SMPP";
            properties.InterfaceVersion = InterfaceVersion.v34;
            properties.AddressNpi = NumberingPlanIndicator.ISDN;
            properties.AddressTon = TypeOfNumber.International;
            properties.DefaultEncoding = DataCoding.SMSCDefault;

            client.AutoReconnectDelay = 3000;
            client.KeepAliveInterval = 30000;

            client.Start();

            if (client.ConnectionState != SmppConnectionState.Connected) client.ForceConnect(5000);

            msg = new TextMessage();

            msg.DestinationAddress = "265999999999";
            msg.SourceAddress = "Victoria";
            msg.Text = "Hello, this is my test message!";
            msg.RegisterDeliveryNotification = true;
            
            try
            {
                client.SendMessage(msg, 1000);
                string tes = msg.SourceAddress + "-" + msg.NetworkErrorCode + "-" + msg.MessageState;
            }
            catch (Exception exc)
            {
                throw new Exception("Unable to Send SMS " + exc.Message);
            }

            client.Shutdown();
        } 

有人可以提出任何建议吗?我需要为此任务使用开放库

0 个答案:

没有答案
相关问题