Пример #1
0
 private async Task DoReceiveSubmitResponseAsync(SmgpMessageSubmitResponse response)
 {
     await Task.Run(() =>
     {
         SmsMessageEnvolope envolope = null;
         this.MessageRecords.TryRemove(response.SequenceId.ToString(), out envolope);
         if (envolope != null)
         {
             envolope.Response = response;
             this.RaiseResponseReceived(envolope);
         }
     });
 }
Пример #2
0
        protected override async Task <bool> DoSendSmsAsync(string[] receivers, string content, SmsMessageEnvolope envolope)
        {
            await Task.Run(() =>
            {
                var config        = this.Configurations as SgipConfigurations;
                var serviceNumber = config.ServiceId;
                var corporationId = config.CorporationId;
                var serviceType   = config.ServiceType;
                if (serviceType == null)
                {
                    serviceType = "0000000000";
                }

                var sids = this.SequenceId;
                var m    = new SgipMessageSubmit()
                {
                    SequenceId3     = sids[0],
                    SequenceId2     = sids[1],
                    SequenceId1     = sids[2],
                    ServiceNumber   = serviceNumber,
                    CorporationId   = corporationId,
                    ReceiverCount   = (byte)receivers.Length,
                    ReceiverNumbers = receivers,
                    ServiceType     = serviceType,
                    Format          = (byte)SgipEncodings.GBK,
                    Content         = content,
                };

                envolope.Request    = m;
                envolope.SequenceId = m.SequenceId;
            });

            return(true);
        }
Пример #3
0
        protected override async Task <bool> DoSendSmsAsync(string[] receivers, string content, SmsMessageEnvolope envolope)
        {
            await Task.Run(() =>
            {
                var sequenceId = this.SequenceId;

                var config    = this.GetClientConfiguration();
                var serviceId = config.ServiceId;


                var m = new SmgpMessageSubmit()
                {
                    ReceiverCount = (byte)receivers.Length,
                    ReceiverIds   = receivers,
                    Content       = content,
                    Format        = (byte)SmgpEncodings.UCS2,
                    ServiceId     = serviceId,
                    SequenceId    = sequenceId,
                };

                envolope.Request    = m;
                envolope.SequenceId = sequenceId.ToString();
            });

            return(true);
        }
Пример #4
0
        protected override async Task <bool> DoSendSmsAsync(string[] receivers, string content, SmsMessageEnvolope envolope)
        {
            await Task.Run(() =>
            {
                var sequenceId = this.SequenceId;

                var config    = this.GetClientConfiguration();
                var spCode    = config.SpCode;
                var serviceId = config.ServiceId;

                if (config.RemoveSignature)
                {
                    string signature = string.Empty;
                    content          = this.RemoveSignature(content, ref signature);

                    var spCodes = this.ServiceProviderCodes;
                    if (spCodes.ContainsKey(signature))
                    {
                        spCode = spCodes[signature];
                    }
                }


                var m = new CmppMessageSubmit()
                {
                    SequenceId             = sequenceId,
                    Content                = content,
                    Format                 = (byte)CmppEncodings.UCS2,
                    SourceId               = spCode,
                    ReceiverTerminalIds    = receivers,
                    ServiceId              = serviceId,
                    DeliveryReportRequired = 1,
                    FeeType                = this.SmsFeeType,
                    FeeUserType            = (byte)FeeUserType.SP,
                    FeeTerminalId          = spCode,
                    FeeTerminalType        = 0,
                    FeeCode                = this.SmsFeeCode,
                    Source                 = config.UserName,
                };

                envolope.SequenceId = sequenceId.ToString();
                envolope.Request    = m;
            });

            return(true);
        }