public Queue CreateQueue(Queue queue) { var settings = _accountSettings.GetVoiceSettings(); var twilioClient = new TwilioRestClient(settings.AccountSid, settings.AuthToken); var twilioQueue = twilioClient.CreateQueue(queue.Name, queue.MaxSize ?? 0); if (twilioQueue.RestException != null) { _logger.Error($"Exception thrown trying to create queue in QueueProvider - {twilioQueue.RestException}"); return null; } if (twilioQueue.Sid == null) { return null; } return new Queue { Sid = twilioQueue.Sid, Name = twilioQueue.FriendlyName, Size = twilioQueue.CurrentSize, MaxSize = twilioQueue.MaxSize, AverageWaitTime = twilioQueue.AverageWaitTime }; }
static void Main(string[] args) { // Find your Account Sid and Auth Token at twilio.com/user/account string AccountSid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"; string AuthToken = "your_auth_token"; var twilio = new TwilioRestClient(AccountSid, AuthToken); var queue = twilio.CreateQueue("newqueue"); Console.WriteLine(queue.Sid); }
public Queue CreateQueue(Queue queue) { var twilioClient = new TwilioRestClient(_accountSettings.AccountSid, _accountSettings.AuthToken); var twilioQueue = twilioClient.CreateQueue(queue.Name, queue.MaxSize?? 0); return new Queue { Id = twilioQueue.Sid, Name = twilioQueue.FriendlyName, Size = twilioQueue.CurrentSize, MaxSize = twilioQueue.MaxSize, AverageWaitTime = twilioQueue.AverageWaitTime }; }