Beispiel #1
0
        private static void test_notify_url()
        {
            var configuration = new Configuration("ENVOTIONS", "Envo6183");

            var smsClient = new SMSClient(configuration);

            {
                var smsRequest = new SMSRequest("ABC", "InfobipDeliveryReport" + DateTime.Now.ToShortDateString(), new string[] { "+886921859698" });
                smsRequest.NotifyURL    = "http://zutech-sms.azurewebsites.net/api/InfobipDeliveryReport";
                smsRequest.CallbackData = "InfobipDeliveryReport";
                SendMessageResult sendMessageResult = smsClient.SmsMessagingClient.SendSMS(smsRequest);

                // requestId = messageId;

                string requestId = sendMessageResult.ClientCorrelator; // you can use this to get deliveryReportList later.

                Console.WriteLine(requestId);
            }

            {
                var smsRequest = new SMSRequest("ABC", "InfobipDeliveryReportRawBody" + DateTime.Now.ToShortDateString(), new string[] { "+886921859698" });
                smsRequest.NotifyURL    = "http://zutech-sms.azurewebsites.net/api/InfobipDeliveryReportRawBody";
                smsRequest.CallbackData = "InfobipDeliveryReportRawBody";
                SendMessageResult sendMessageResult = smsClient.SmsMessagingClient.SendSMS(smsRequest);

                // requestId = messageId;

                string requestId = sendMessageResult.ClientCorrelator; // you can use this to get deliveryReportList later.

                Console.WriteLine(requestId);
            }
        }
Beispiel #2
0
        public static void Execute()
        {
            // Configure in the 'app.config' which Logger levels are enabled(all levels are enabled in the example)
            // Check http://logging.apache.org/log4net/release/manual/configuration.html for more informations about the log4net configuration
            XmlConfigurator.Configure(new FileInfo("OneApiExamples.exe.config"));


            // Initialize Configuration object
            Configuration configuration = new Configuration(System.Configuration.ConfigurationManager.AppSettings.Get("Username"),
                                                            System.Configuration.ConfigurationManager.AppSettings.Get("Password"));

            // Initialize SMSClient using the Configuration object
            SMSClient smsClient = new SMSClient(configuration);

            smsClient.HlrClient.QueryHLRAsync(address, (roaming, e) =>
            {
                if (e == null)
                {
                    Console.WriteLine(roaming);
                }
                else
                {
                    Console.WriteLine(e.Message);
                }
            });
        }
Beispiel #3
0
        public static void Main(string[] args)
        {
            // Step #1 is create an API client object using credential obtained from https://easysms.4simple.org/user/panel/
            SMSClient api_obj = new SMSClient(22421, "39fec6acw3sh3b28a981cf5551a");


            //##########################################################################
            //                HOW SEND AN SMS TEXT MESSAGE
            //##########################################################################
            int pid = api_obj.send_sms("1535453343", "Hello testing");

            Console.WriteLine("PID: " + pid.ToString());


            //##########################################################################
            //	                HOW CHECK ACCOUNT BALANCE
            //##########################################################################
            Console.WriteLine("Balance: " + api_obj.get_balance);


            //##########################################################################
            //                 HOW CHECK SMS PROCESSING STATUS
            //##########################################################################
            Console.WriteLine("Status for pid 2343454: " + api_obj.get_sms_status(2343454));


            Console.ReadLine();
        }
Beispiel #4
0
        public static string SendSMS(string recipientPhone, string message)
        {
            string senderAddress = "KW-IRS";
            string username      = "******";
            string password      = "******";

            Configuration configuration = new Configuration(username, password);
            SMSClient     smsClient     = new SMSClient(configuration);

            try
            {
                LoginResponse loginResponse = smsClient.CustomerProfileClient.Login();
                if (loginResponse.Verified == false)
                {
                    throw new Exception("SMS gateway user credentials is not verified!");
                }
            }
            catch (RequestException ex)
            {
                throw new Exception(ex.Message);
            }

            SMSRequest smsRequest = new SMSRequest(senderAddress, message, recipientPhone);

            // Store request id because we can later query for the delivery status with it:
            string requestId = smsClient.SmsMessagingClient.SendSMS(smsRequest).ToString();

            return(requestId);
        }
        public async System.Threading.Tasks.Task MakeSMSRequestWithFilter()
        {
            var request = new SMSClient(new AndroidSMSAdapter());

            //fill in a real date here
            var date = 1454703049063;
            //var date = DateTime.Now.ToUnixTimeSeconds();

            //IF USING EMULATOR
            //open a console
            //connect via telnet to the running emulator: telnet localhost 5554(you can find the portnumber in the title of the emulator)
            //type this: sms send senderPhoneNumber textmessage

            //IF USING PHYSICAL DEVICE
            //send yourself a text message now
            var resultsTask = request.GetDataPoints(date.ToString());

            var results = await resultsTask;

            Assert.True(results.Count() == 1);

            var result = results.Single();

            Assert.NotNull(result.Item2["address"]);
            Assert.NotNull(result.Item2["body"]);
            Assert.NotNull(result.Item2["date"]);
        }
Beispiel #6
0
        private bool SendSMS(string[] toPhoneNumbers, string content)
        {
            var setting = this.Context.WebSite.SiteDb().CoreSetting.GetSetting <ChinaMobileSMSSetting>();

            if (setting == null ||
                string.IsNullOrWhiteSpace(setting.ecName) ||
                string.IsNullOrWhiteSpace(setting.apId) ||
                string.IsNullOrWhiteSpace(setting.secretKey) ||
                string.IsNullOrWhiteSpace(setting.sign))
            {
                throw new Exception("China Mobile SMS service not configured");
            }

            var smsConfig = new SMSConfig
            {
                EcName    = setting.ecName,
                ApId      = setting.apId,
                SecretKey = setting.secretKey,
                Sign      = setting.sign
            };

            var smsClient = new SMSClient(smsConfig);
            var smsResult = smsClient.SendAsync(toPhoneNumbers, content).Result;

            if (smsResult.IsFailure)
            {
                throw new Exception(smsResult.Message);
            }

            return(true);
        }
        public static void Execute()
        {
            // Configure in the 'app.config' which Logger levels are enabled(all levels are enabled in the example)
            // Check http://logging.apache.org/log4net/release/manual/configuration.html for more informations about the log4net configuration
            XmlConfigurator.Configure(new FileInfo("OneApiExamples.exe.config"));


            // Initialize Configuration object
            Configuration configuration = new Configuration(System.Configuration.ConfigurationManager.AppSettings.Get("Username"),
                                                            System.Configuration.ConfigurationManager.AppSettings.Get("Password"));

            // Initialize SMSClient using the Configuration object
            SMSClient smsClient = new SMSClient(configuration);

            // Send SMS
            smsClient.SmsMessagingClient.SendSMS(new SMSRequest(senderAddress, message, recipientAddress));

            // Wait for 30 seconds to give enought time for the message to be delivered
            System.Threading.Thread.Sleep(30000);

            // Get 'Delivery Reports'
            DeliveryReportList deliveryReportList = smsClient.SmsMessagingClient.GetDeliveryReports();

            Console.WriteLine(deliveryReportList);
        }
Beispiel #8
0
        public void Case3()
        {
            string senderAddress    = SendMessageRule.DefaultSenderAddress;
            string message          = "message4";
            var    recipientAddress = new string[] { "+886921859698" };
            string requestId        = "";

            var configuration = new Configuration("ENVOTIONS", "Envo6183");

            // Initialize SMSClient using the Configuration object
            var SMSClient = new SMSClient(configuration);

            // Send SMS
            var result = SMSClient.SmsMessagingClient.SendSMS(new SMSRequest(senderAddress, message, recipientAddress));

            requestId = result.ClientCorrelator;
            //requestId = "1430206446300481957";
            // Wait for 30 seconds to give enought time for the message to be delivered
            System.Threading.Thread.Sleep(30000);

            // Get 'Delivery Reports'
            DeliveryReportList deliveryReportList = SMSClient.SmsMessagingClient.GetDeliveryReportsByRequestId(requestId);

            Console.WriteLine(deliveryReportList);
        }
Beispiel #9
0
        public static void Execute()
        {
            // Configure in the 'app.config' which Logger levels are enabled(all levels are enabled in the example)
            // Check http://logging.apache.org/log4net/release/manual/configuration.html for more informations about the log4net configuration
            XmlConfigurator.Configure(new FileInfo("OneApiExamples.exe.config"));


            // Initialize Configuration object
            Configuration configuration = new Configuration(System.Configuration.ConfigurationManager.AppSettings.Get("Username"),
                                                            System.Configuration.ConfigurationManager.AppSettings.Get("Password"));

            // Initialize SMSClient using the Configuration object
            SMSClient smsClient = new SMSClient(configuration);

            Console.WriteLine("");
            Console.Write("Currency Code: ");
            string currencyCode = Console.ReadLine();

            Console.Write("Account Key: ");
            string accountKey = Console.ReadLine();

            Console.Write("Description: ");
            string description = Console.ReadLine();

            Console.Write("Ammount: ");
            decimal ammount = Convert.ToDecimal(Console.ReadLine());

            var result = smsClient.CustomerProfileClient.AddClientFunds(currencyCode, accountKey, description, ammount);

            Console.WriteLine(result.ToString());
            Console.WriteLine();
        }
        public static void Execute()
        {
            // Configure in the 'app.config' which Logger levels are enabled(all levels are enabled in the example)
            // Check http://logging.apache.org/log4net/release/manual/configuration.html for more informations about the log4net configuration
            XmlConfigurator.Configure(new FileInfo("OneApiExamples.exe.config"));


            // example:initialize-sms-client
            Configuration configuration = new Configuration(System.Configuration.ConfigurationManager.AppSettings.Get("Username"),
                                                            System.Configuration.ConfigurationManager.AppSettings.Get("Password"));
            SMSClient smsClient = new SMSClient(configuration);
            // ----------------------------------------------------------------------------------------------------

            // example:prepare-message-without-notify-url
            SMSRequest smsRequest = new SMSRequest(senderAddress, message, recipientAddress);
            // ----------------------------------------------------------------------------------------------------

            // example:send-message
            // Store request id because we can later query for the delivery status with it:
            SendMessageResult sendMessageResult = smsClient.SmsMessagingClient.SendSMS(smsRequest);

            // ----------------------------------------------------------------------------------------------------

            // Few seconds later we can check for the sending status
            System.Threading.Thread.Sleep(10000);

            // example:query-for-delivery-status
            DeliveryInfoList deliveryInfoList = smsClient.SmsMessagingClient.QueryDeliveryStatus(senderAddress, sendMessageResult.ClientCorrelator);
            string           deliveryStatus   = deliveryInfoList.DeliveryInfos[0].DeliveryStatus;

            // ----------------------------------------------------------------------------------------------------
            Console.WriteLine(deliveryStatus);
        }
        public static void Execute()
        {
            // Configure in the 'app.config' which Logger levels are enabled(all levels are enabled in the example)
            // Check http://logging.apache.org/log4net/release/manual/configuration.html for more informations about the log4net configuration
            XmlConfigurator.Configure(new FileInfo("OneApiExamples.exe.config"));


            // Initialize Configuration object
            Configuration configuration = new Configuration(System.Configuration.ConfigurationManager.AppSettings.Get("Username"),
                                                            System.Configuration.ConfigurationManager.AppSettings.Get("Password"));

            // Initialize SMSClient using the Configuration object
            SMSClient smsClient = new SMSClient(configuration);

            // Add listener(start push server and wait for the 'Inbound Message Notifications')
            smsClient.SmsMessagingClient.AddPushInboundMessageNotificationsListener(new InboundMessageNotificationsListener((smsMessageList) =>
            {
                // Handle pushed 'Inbound Message Notification'
                Console.WriteLine(smsMessageList);
            }));

            // Store 'Inbound Message Notifications' subscription id because we can later remove subscription with it:
            string subscriptionId = smsClient.SmsMessagingClient.SubscribeToInboundMessagesNotifications(new SubscribeToInboundMessagesRequest(destinationAddress, notifyUrl, criteria, notificationFormat, "", ""));

            // Wait 30 seconds for 'Inbound Message Notification' push-es before removing subscription and closing the server connection
            System.Threading.Thread.Sleep(30000);

            // Remove 'Inbound Message Notifications' subscription
            smsClient.SmsMessagingClient.RemoveInboundMessagesNotificationsSubscription(subscriptionId);

            // Remove 'Inbound Message Notifications' push listeners and stop the server
            smsClient.SmsMessagingClient.RemovePushInboundMessageNotificationsListeners();
        }
Beispiel #12
0
        public static void Execute()
        {
            // Configure in the 'app.config' which Logger levels are enabled(all levels are enabled in the example)
            // Check http://logging.apache.org/log4net/release/manual/configuration.html for more informations about the log4net configuration
            XmlConfigurator.Configure(new FileInfo("OneApiExamples.exe.config"));


            // Initialize Configuration object
            Configuration configuration = new Configuration(System.Configuration.ConfigurationManager.AppSettings.Get("Username"),
                                                            System.Configuration.ConfigurationManager.AppSettings.Get("Password"));

            // Initialize SMSClient using the Configuration object
            SMSClient smsClient = new SMSClient(configuration);

            SMSRequest smsRequest = new SMSRequest(senderAddress, message, recipientAddress);

            smsRequest.Language = new Language(LanguageCode.Default);

            // smsRequest.Language = new Language(LanguageCode.Turkish, true, false);

            smsClient.SmsMessagingClient.SendSMSAsync(smsRequest, (sendMessageResult, e) =>
            {
                if (e == null)
                {
                    Console.WriteLine(sendMessageResult);
                }
                else
                {
                    Console.WriteLine(e.Message);
                }
            });
        }
Beispiel #13
0
        public static void Execute()
        {
            // Configure in the 'app.config' which Logger levels are enabled(all levels are enabled in the example)
            // Check http://logging.apache.org/log4net/release/manual/configuration.html for more informations about the log4net configuration
            XmlConfigurator.Configure(new FileInfo("OneApiExamples.exe.config"));


            // Initialize Configuration object
            Configuration configuration = new Configuration(System.Configuration.ConfigurationManager.AppSettings.Get("Username"),
                                                            System.Configuration.ConfigurationManager.AppSettings.Get("Password"));

            // Initialize SMSClient using the Configuration object
            SMSClient smsClient = new SMSClient(configuration);

            String response = null;

            while (response == null || !"1".Equals(response))
            {
                // Send USSD and wait for the answer
                InboundSMSMessage inboundMessage = smsClient.UssdClient.SendMessage(destination, message);
                response = inboundMessage.Message;
            }

            // Send message and stop USSD session
            smsClient.UssdClient.StopSession(destination, "Cool");
        }
Beispiel #14
0
        private void sendButton_Click(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(this.toTextBox.Text) &&
                !string.IsNullOrEmpty(this.msgTextBox.Text))
            {
                var sms = new SMSClient();
                try
                {
                    this.Enabled = false;
                    this.Cursor  = Cursors.WaitCursor;

                    if (!sms.Send(this.toTextBox.Text, this.msgTextBox.Text))
                    {
                        FormManager.Alert("Wystapił bład w trakcie wysyłania SMSa");
                    }
                }
                catch (Exception ex)
                {
                    throw ex;
                }
                finally
                {
                    this.Cursor  = Cursors.Default;
                    this.Enabled = true;
                }
            }
        }
        public static void Execute()
        {
            // Configure in the 'app.config' which Logger levels are enabled(all levels are enabled in the example)
            // Check http://logging.apache.org/log4net/release/manual/configuration.html for more informations about the log4net configuration
            XmlConfigurator.Configure(new FileInfo("OneApiExamples.exe.config"));


            // Initialize Configuration object
            Configuration configuration = new Configuration(System.Configuration.ConfigurationManager.AppSettings.Get("Username"),
                                                            System.Configuration.ConfigurationManager.AppSettings.Get("Password"));

            // Initialize SMSClient using the Configuration object
            SMSClient smsClient = new SMSClient(configuration);

            // Add listener(start retriever and pull 'Inbound Messages')
            smsClient.SmsMessagingClient.AddPullInboundMessageListener(new InboundMessageListener((smsMessageList, e) =>
            {
                // Handle pulled 'Inbound Messages'
                if (e == null)
                {
                    Console.WriteLine(smsMessageList);
                }
                else
                {
                    Console.WriteLine(e.Message);
                }
            }));

            // Wait 30 seconds for the 'Inbound Messages' before stop the retriever
            System.Threading.Thread.Sleep(30000);

            // Remove 'Inbound Messages' pull listeners and stop the retriever
            smsClient.SmsMessagingClient.RemovePullInboundMessageListeners();
        }
Beispiel #16
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Power("supplier_smsconfig", "手机短信设置"))
            {
                PageReturnMsg = PageNoPowerMsg();
            }

            B_BaseConfig_Supplier bconfig = new B_BaseConfig_Supplier();

            //model = bconfig.LoadConfig();
            model        = ShopCache.GetBaseConfig_Supplier(CurrentSupplier.id);
            SMS_password = model.SMS_password;
            try
            {
                if (model.SMS_server == "0" && model.SMS_state == "1")
                {
                    smsClient = new SMSClient("sms.todaynic.com", Convert.ToInt32(model.SMS_serverport), model.SMS_user, model.SMS_password);
                    account   = smsClient.getBalance();
                }
            }
            catch
            {
            }
            if (SMS_password != "")
            {
                SMS_password = "******";
            }
        }
 public ContactEditorViewModel(IMapper mapper, IRegionManager regionManager,
                               SMSClient smsClient, IEventAggregator eventAggregator)
 {
     _mapper          = mapper;
     _regionManager   = regionManager;
     _smsClient       = smsClient;
     _eventAggregator = eventAggregator;
 }
Beispiel #18
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="SMSCli">Instance of smsclictr.automation.SMSClient</param>
 /// <example>
 /// C#:
 /// <code>
 /// using System;
 /// using System.Collections.Generic;
 /// using System.Text;
 /// using smsclictr.automation;
 ///
 /// namespace ConsoleApplication1
 /// {
 ///     class Program
 ///         {
 ///            static void Main(string[] args)
 ///               {
 ///                   SMSClient oClient = new SMSClient("smsserver");
 ///                   CCMSetup oCCMSetup = new CCMSetup(oClient);
 ///               }
 ///         }
 /// }
 /// </code>
 /// </example>
 public CCMSetup(SMSClient SMSCli)
 {
     if (SMSCli != null)
     {
         oSMSClient   = SMSCli;
         oWMIProvider = SMSCli.Connection;
         sHostname    = oWMIProvider.mScope.Path.Server;
     }
 }
        public static void Execute()
        {
            // Configure in the 'app.config' which Logger levels are enabled(all levels are enabled in the example)
            // Check http://logging.apache.org/log4net/release/manual/configuration.html for more informations about the log4net configuration
            XmlConfigurator.Configure(new FileInfo("OneApiExamples.exe.config"));


            // Initialize Configuration object
            Configuration configuration = new Configuration(username, password);

            // Initialize SMSClient using the Configuration object
            SMSClient smsClient = new SMSClient(configuration);

            try
            {
                // Login sms client
                LoginResponse loginResponse = smsClient.CustomerProfileClient.Login();
                if (loginResponse.Verified == false)
                {
                    Console.WriteLine("User is not verified!");
                    return;
                }
            }
            catch (RequestException e)
            {
                Console.WriteLine(e.Message);
                return;
            }

            // Send SMS
            smsClient.SmsMessagingClient.SendSMSAsync(new SMSRequest(senderAddress, message, recipientAddress), (requestId, e) =>
            {
                if (e == null)
                {
                    // Get 'Delivery Reports'
                    smsClient.SmsMessagingClient.GetDeliveryReportsAsync((deliveryReportList, e1) =>
                    {
                        if (e1 == null)
                        {
                            Console.WriteLine(deliveryReportList);

                            // Logout sms client
                            smsClient.CustomerProfileClient.Logout();
                        }
                        else
                        {
                            Console.WriteLine(e1.Message);
                        }
                    });
                }
                else
                {
                    Console.WriteLine(e.Message);
                }
            });
        }
        public static void Execute()
        {
            Configuration configuration = new Configuration();
            SMSClient     smsClient     = new SMSClient(configuration);

            // example:on-mo
            InboundSMSMessageList inboundSMSMessageList = smsClient.SmsMessagingClient.ConvertJsonToInboundSMSMessageNotification(JSON);

            // ----------------------------------------------------------------------------------------------------
            Console.WriteLine(inboundSMSMessageList);
        }
        public static void Execute()
        {
            Configuration configuration = new Configuration();
            SMSClient     smsClient     = new SMSClient(configuration);

            // example:on-roaming-status
            RoamingNotification roamingNotification = smsClient.HlrClient.ConvertJsonToHLRNotification(JSON);

            //----------------------------------------------------------------------------------------------------
            Console.WriteLine(roamingNotification);
        }
Beispiel #22
0
        public void Case1_()
        {
            string userName  = "******";
            string password  = "******";
            string requestId = "1428275602020481488";

            var configuration = new Configuration(userName, password);
            var SMSClient     = new SMSClient(configuration);

            var deliveryReportList = SMSClient.SmsMessagingClient.GetDeliveryReportsByRequestId(requestId);
        }
Beispiel #23
0
        public static void Execute()
        {
            Configuration configuration = new Configuration();
            SMSClient     smsClient     = new SMSClient(configuration);

            // example:on-delivery-notification
            DeliveryInfoNotification deliveryInfoNotification = smsClient.SmsMessagingClient.ConvertJsonToDeliveryInfoNotification(JSON);

            // ----------------------------------------------------------------------------------------------------
            Console.WriteLine(deliveryInfoNotification);
        }
Beispiel #24
0
 private void Send(Message message)
 {
     var smsClient = new SMSClient()
     {
         Username = "",          // your Gateway username
         Password = "",          // your Gateway passord
         PrimaryGateway = "",    // the Gateway URL
         SecondaryGateway = "",  // backup Gatetway URL
     };
     smsClient.Messages.Add(0, message);
     smsClient.SendMessages();
 }
Beispiel #25
0
        public async virtual Task <IHttpActionResult> AuthUserValidateCode(string userName, string token, [FromBody] AuthUserValidateCodeModel authUserValidateCodeModel)
        {
            var tenantId    = authUserValidateCodeModel.TenantId;
            var phone       = authUserValidateCodeModel.Phone;
            var communityId = authUserValidateCodeModel.CommunityId;
            var code        = authUserValidateCodeModel.Code;

            base.AuthUser();
            using (CurrentUnitOfWork.SetTenantId(tenantId))
            {
                var homeOwerUser = await _homeOwerUserManager.GetHomeOwerUserByUserName(userName);

                var homeOwer = await _homeOwerManager.GetHomeOwerByNameAndPhoneAndCommunityId(communityId, phone);

                if (homeOwerUser == null)
                {
                    throw ErrorCodeTypeUtils.ThrowError(ErrorCodeType.HomeOwerUserNotExists);
                }
                if (homeOwer == null)
                {
                    throw ErrorCodeTypeUtils.ThrowError(ErrorCodeType.HomeOwerNotExists);
                }
                else if (homeOwer.Status == EHomeOwerStatusType.Done)
                {
                    throw ErrorCodeTypeUtils.ThrowError(ErrorCodeType.HomeOwerUserIsExists);
                }
                else
                {
                    //验证验证码是否正确
                    SMSClient smsClient = new SMSClient();
                    var       response  = smsClient.Verify(homeOwer.ValidateCode, code);
                    if (response.Status == "0")
                    {
                        homeOwerUser.HomeOwerId  = homeOwer.Id;
                        homeOwerUser.CommunityId = homeOwer.CommunityId;
                        homeOwerUser.TenantId    = tenantId;
                        homeOwer.ValidateCode    = string.Empty;
                        homeOwer.Status          = EHomeOwerStatusType.Waiting;
                        await _homeOwerUserManager.UpdateAsync(homeOwerUser);

                        await _homeOwerManager.UpdateAsync(homeOwer);

                        return(Ok(new { HomeOwer = AutoMapper.Mapper.Map <HomeOwerDto>(homeOwer), Community = AutoMapper.Mapper.Map <CommunityDto>(homeOwer.FlatNumbers.First().Building.Community) }));
                    }
                    else
                    {
                        throw ErrorCodeTypeUtils.ThrowError(ErrorCodeType.ValidateCodeError);
                    }
                }
            }
        }
Beispiel #26
0
        protected bool SendSMS(string number, string message)
        {
            SMSServiceConfiguration config       = new SMSServiceDAO().GetSMSConfig();
            SMSClientConfiguration  clientConfig = new SMSClientConfiguration()
            {
                Username   = config.Username
                , Password = config.Password
                , TestOnly = config.IsTest
                , Sender   = config.Sender
            };
            SMSClient client = new SMSClient(clientConfig);

            return(client.Send(number, message, config.IsFlash));
        }
Beispiel #27
0
        public void GetDeliveryReport(string requestId)
        {
            using (var smsClient = new SMSClient(userName, password))
            {
                SMS_LOG SMS_LOG = smsClient.GetDeliveryStatus(requestId, string.Empty);

                this.logService.Debug("Every8dSmsProvider(smsProviderType = {0}),接收簡訊發送結果(簡訊發送識別碼:{1},發送結果:{2})",
                                      smsProviderType.ToString(),
                                      requestId,
                                      SMS_LOG.ToString());

                UpdateDb(requestId, SMS_LOG);
            }
        }
Beispiel #28
0
        public virtual IHttpActionResult ValidateCode(string requestId, string code)
        {
            SMSClient smsClient = new SMSClient();
            var       response  = smsClient.Verify(requestId, code);

            if (response.Status == "0")
            {
                return(Ok());
            }
            else
            {
                throw ErrorCodeTypeUtils.ThrowError(ErrorCodeType.SMSSendCodeError, response.ErrorText);
            }
        }
Beispiel #29
0
        public virtual IHttpActionResult SendValidateCode(string from, string countryCode, string to)
        {
            SMSClient smsClient = new SMSClient();
            var       response  = smsClient.SendVerify(from, countryCode + to);

            if (response.Status == "0")
            {
                return(Ok(new { requestId = response.RequestId }));
            }
            else
            {
                throw ErrorCodeTypeUtils.ThrowError(ErrorCodeType.SMSSendCodeError, response.ErrorText);
            }
        }
Beispiel #30
0
        static void Main(string[] args)
        {
            const string accessKeyId     = "AAAA"; // 用户的Access Key ID
            const string secretAccessKey = "BBBB"; // 用户的Secret Access Key

            var config = new SMSBceClientConfiguration(accessKeyId, secretAccessKey);
            var client = new SMSClient(config);

            var req = new SendSMSRequest();

            req.Mobile      = "13xxxxxxx";
            req.SignatureId = "sms-sign-xxxx";
            req.Template    = "sms-tmpl-xxxxx";
            req.ContentVar.Add("code", "8888"); //模板变量
            client.SendSMS(req);
        }
        public static void Execute()
        {
            // Configure in the 'app.config' which Logger levels are enabled(all levels are enabled in the example)
            // Check http://logging.apache.org/log4net/release/manual/configuration.html for more informations about the log4net configuration
            XmlConfigurator.Configure(new FileInfo("OneApiExamples.exe.config"));

            // Initialize Configuration object
            Configuration configuration = new Configuration(System.Configuration.ConfigurationManager.AppSettings.Get("Username"),
                                                            System.Configuration.ConfigurationManager.AppSettings.Get("Password"));
            // Initialize SMSClient using the Configuration object
            SMSClient smsClient = new SMSClient(configuration);

            CustomerProfile[] customerProfiles = smsClient.CustomerProfileClient.GetClients();
            Console.WriteLine(string.Join("Customer Profile: ", customerProfiles.Select <CustomerProfile, string>(cProfile => cProfile != null ? cProfile.ToString() : "{}").ToArray()));
            Console.WriteLine();
        }