本文整理汇总了C#中Twilio.TwilioRestClient.ListQueues方法的典型用法代码示例。如果您正苦于以下问题:C# TwilioRestClient.ListQueues方法的具体用法?C# TwilioRestClient.ListQueues怎么用?C# TwilioRestClient.ListQueues使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Twilio.TwilioRestClient
的用法示例。
在下文中一共展示了TwilioRestClient.ListQueues方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ReportAverageWait
public int ReportAverageWait()
{
var client = new TwilioRestClient(Queue_Demo.Settings.AccountSid, Queue_Demo.Settings.AuthToken);
var queuesResult = client.ListQueues();
if (queuesResult.RestException==null && queuesResult.Queues != null)
{
var demoqueue = queuesResult.Queues.Where(q => q.FriendlyName == "Demo Queue").FirstOrDefault();
if (demoqueue != null)
{
var queueSid = demoqueue.Sid;
var queue = client.GetQueue(queueSid);
var waitTime = queue.AverageWaitTime;
Debug.WriteLine(waitTime);
return waitTime.Value;
}
}
throw new Exception();
}
示例2: Main
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 queues = twilio.ListQueues();
foreach (var queue in queues.Queues)
{
Console.WriteLine(queue.AverageWaitTime);
}
}
示例3: Form1_Load
private void Form1_Load(object sender, EventArgs e)
{
string accountSid = "AC910947335f85f6b222394231ac5f064d";
string authToken = "44e9b67a8f82209656db45e7575759c5";
Dictionary<string, string> dqueues = new Dictionary<string, string>();
client = new TwilioRestClient(accountSid, authToken);
QueueResult queues = client.ListQueues();
foreach (Queue queue in queues.Queues)
{
cmbQueue.Items.Add(new KeyValuePair<string,string>(queue.FriendlyName,queue.Sid));
}
//
}
示例4: btn_Click
protected void btn_Click(object sender, EventArgs e)
{
string accountSid = "AC49ecef1b877e244ea13ada1b5fe92b85";
//string applicationsid = "AP5556f6cd1af5cfa5317acae7a49eeb5c";
string sid = "CA748c6019014ca0ac151908a81299f927";
string authToken = "4eeeaf7ed6459dcd02ec7888149d5ea1";
string recordingSid = "RE5dabfb2da314b39cd87dc151bf669e78";
DateTime datecreated=DateTime.Now;
TwilioRestClient client;
client = new TwilioRestClient(accountSid, authToken);
string APIversuion = client.ApiVersion;
string TwilioBaseURL = client.BaseUrl;
Account account = client.GetAccount(accountSid);
client.GetRecording(recordingSid);
client.GetRecordingText(recordingSid);
client.ListRecordings(sid, datecreated, 1, 2);
client.ListQueues();
client.ListIncomingPhoneNumbers();
this.varDisplay.Items.Clear();
if (this.txtcall.Text == "" || this.message.Text == "")
{ this.varDisplay.Items.Add( "You must enter a phone number and a message."); } else { // Retrieve the values entered by the user.
string to = this.txtcall.Text;
string myMessage = this.message.Text;
//string Url = "http://demo.twilio.com/Welcome/Call/";
String Url = "http://twimlets.com/message?Message%5B0%5D=" + myMessage.Replace(" ", "%20");
// Diplay the enpoint, API version, and the URL for the message.
this.varDisplay.Items.Add("Using Tilio endpoint " + TwilioBaseURL);
this.varDisplay.Items.Add("Twilioclient API Version is " + APIversuion);
this.varDisplay.Items.Add("The URL is " + Url); // Instantiate the call options that are passed // to the outbound call.
CallOptions options = new CallOptions(); // Set the call From, To, and URL values into a hash map. // This sample uses the sandbox number provided by Twilio // to make the call.
options.From = "+14242165015";
options.To = to;
options.Url = Url; // Place the call.
options.Record = true;
var call = client.InitiateOutboundCall(options);
this.varDisplay.Items.Add("Call status: " + call.Status); }
}
示例5: ContactBarber_Click
protected void ContactBarber_Click(object sender, EventArgs e)
{
BindDataList();
string sql = "SELECT idMembership FROM member WHERE idMember = " + Request.QueryString["id"];
DataTable dt = Worker.SqlTransaction(sql, connect_string);
if (dt.Rows.Count > 0)
{
if ((dt.Rows[0]["idMembership"].ToString() == "2") || (dt.Rows[0]["idMembership"].ToString() == "1"))
{
Page.ClientScript.RegisterStartupScript(this.GetType(), "Alert", "AddResource('440','415');", true);
}
else
{
phoneno = (string)Session["phoneno"];
string accountSid = "AC49ecef1b877e244ea13ada1b5fe92b85";
//string applicationsid = "AP5556f6cd1af5cfa5317acae7a49eeb5c";
string sid = "CA748c6019014ca0ac151908a81299f927";
string authToken = "4eeeaf7ed6459dcd02ec7888149d5ea1";
string recordingSid = "RE5dabfb2da314b39cd87dc151bf669e78";
DateTime datecreated = DateTime.Now;
TwilioRestClient client;
client = new TwilioRestClient(accountSid, authToken);
string APIversuion = client.ApiVersion;
string TwilioBaseURL = client.BaseUrl;
Account account = client.GetAccount(accountSid);
client.GetRecording(recordingSid);
client.GetRecordingText(recordingSid);
client.ListRecordings(sid, datecreated, 1, 2);
client.ListQueues();
client.ListIncomingPhoneNumbers();
//string Url = "http://demo.twilio.com/Welcome/Call/";
String Url = "http://twimlets.com/message";
CallOptions options = new CallOptions(); // Set the call From, To, and URL values into a hash map. // This sample uses the sandbox number provided by Twilio // to make the call.
options.From = "+14242165015";
options.To = phoneno;
options.Url = Url; // Place the call.
options.Record = true;
var call = client.InitiateOutboundCall(options);
Session.Remove("phoneno");
}
}
}
示例6: GetQueues
public List<Queue> GetQueues()
{
var settings = _accountSettings.GetVoiceSettings();
var twilioClient = new TwilioRestClient(settings.AccountSid, settings.AuthToken);
var twilioQueues = twilioClient.ListQueues();
return twilioQueues.Queues.Select(queue => new Queue
{
Sid = queue.Sid,
Name = queue.FriendlyName,
Size = queue.CurrentSize,
MaxSize = queue.MaxSize,
AverageWaitTime = queue.AverageWaitTime
}).ToList();
}
示例7: Run
public override void Run()
{
var client = new TwilioRestClient(Queue_Demo.Settings.accountSid, Queue_Demo.Settings.authToken);
var queue = client.ListQueues().Queues.Where(q => q.FriendlyName == "Demo Queue").FirstOrDefault();
if (queue!=null)
{
var queueSid = queue.Sid;
var conn = new HubConnection(Queue_Demo.Settings.hubUrl);
var hub = conn.CreateProxy("Queue");
conn.Start();
while (true)
{
Thread.Sleep(10000);
var waitTime = client.GetQueue(queueSid).AverageWaitTime;
Debug.WriteLine(waitTime);
hub.Invoke("ReportAverageWait", new object[] { waitTime });
}
}
}