예제 #1
0
        private CmppWindow _SendAsync(
            string extendedCode,
            string[] destinations,
            string text,
            bool isLongMessage, bool needStatusReport)
        {
            var submit = new CmppSubmit
            {
                // 信息内容。
                MsgContent = text,
                // 信息编码。
                MsgFmt = (byte)(_config.AttemptRemoveSignature ? CmppEncoding.Special : CmppEncoding.UCS2),
                // SP的服务代码,将显示在最终用户手机上的短信主叫号码。
                SrcId = _config.SpCode + extendedCode,
                // 接收短信的电话号码列表。
                DestTerminalId = destinations,
                // 业务标识(如:woodpack)。
                ServiceId = _config.ServiceId,
                // 是否要求返回状态报告。
                RegisteredDelivery = (byte)(needStatusReport ? 1 : 0),
                // 资费类别。
                FeeType = string.Format("{0:D2}", (int)FeeType.Free),
                // 计费用户。
                FeeUserType = (byte)FeeUserType.SP,
                // 被计费的号码(feeUserType 值为 FeeUser 时有效)。
                FeeTerminalId = _config.SpCode,
                // 被计费号码的真实身份(“真实号码”或“伪码”)。
                FeeTerminalType = 0,
                // 信息费(以“分”为单位,如:10 分代表 1角)。
                FeeCode = "05",
                // 点播业务的 linkId。
                LinkId   = "",
                MsgLevel = 0,
                TPPId    = 0,
                TPUdhi   = (byte)(isLongMessage ? 1 : 0),
                MsgSrc   = string.IsNullOrWhiteSpace(_config.SpId) ?
                           _config.GatewayUsername : _config.SpId,
                ValidTime = "",
                AtTime    = ""
            };
            var window = new CmppWindow
            {
                Message    = submit,
                WaitHandle = new ManualResetEvent(false)
            };

            lock (_pendingMessages)
                _pendingMessages.Enqueue(window);
            return(window);
        }
예제 #2
0
 private CmppWindow _SendAsync(
     string extendedCode,
     string[] destinations,
     string text,
     bool isLongMessage, bool needStatusReport)
 {
     var submit = new CmppSubmit
     {
         // 信息内容。
         MsgContent = text,
         // 信息编码。
         MsgFmt = (byte)(_config.AttemptRemoveSignature ? CmppEncoding.Special : CmppEncoding.UCS2),
         // SP的服务代码,将显示在最终用户手机上的短信主叫号码。
         SrcId = _config.SpCode + extendedCode,
         // 接收短信的电话号码列表。
         DestTerminalId = destinations,
         // 业务标识(如:woodpack)。
         ServiceId = _config.ServiceId,
         // 是否要求返回状态报告。
         RegisteredDelivery = (byte)(needStatusReport ? 1 : 0),
         // 资费类别。
         FeeType = string.Format("{0:D2}", (int)FeeType.Free),
         // 计费用户。
         FeeUserType = (byte)FeeUserType.SP,
         // 被计费的号码(feeUserType 值为 FeeUser 时有效)。
         FeeTerminalId = _config.SpCode,
         // 被计费号码的真实身份(“真实号码”或“伪码”)。
         FeeTerminalType = 0,
         // 信息费(以“分”为单位,如:10 分代表 1角)。
         FeeCode = "05",
         // 点播业务的 linkId。
         LinkId = "",
         MsgLevel = 0,
         TPPId = 0,
         TPUdhi = (byte)(isLongMessage ? 1 : 0),
         MsgSrc = _config.GatewayUsername,
         ValidTime = "",
         AtTime = ""
     };
     var window = new CmppWindow
     {
         Message = submit,
         WaitHandle = new ManualResetEvent(false)
     };
     lock (_pendingMessages)
         _pendingMessages.Enqueue(window);
     return window;
 }