本文整理汇总了C#中Twilio.TwilioRestClient.ListCalls方法的典型用法代码示例。如果您正苦于以下问题:C# TwilioRestClient.ListCalls方法的具体用法?C# TwilioRestClient.ListCalls怎么用?C# TwilioRestClient.ListCalls使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Twilio.TwilioRestClient
的用法示例。
在下文中一共展示了TwilioRestClient.ListCalls方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
public void Main(string[] args)
{
// Setup configuration sources.
// The order in which Configuration is built
// is important
var builder = new ConfigurationBuilder(Options.ApplicationBaseDirectory)
.AddJsonFile("config.json")
.AddEnvironmentVariables()
.AddUserSecrets()
.AddCommandLine(args);
Configuration = builder.Build();
// Instantiate a new Twilio Rest Client
var client = new TwilioRestClient(
Configuration.Get("AccountSid"),
Configuration.Get("AuthToken")
);
// Select all calls from my account
var calls = client.ListCalls(new CallListRequest());
// Check for any exceptions
if (calls.RestException != null)
{
throw new FormatException(calls.RestException.Message);
}
// Loop through them and show information
foreach (var call in calls.Calls)
{
var callDetails = $"From: {call.From}, Day: {call.DateCreated}, Duration: {call.Duration}s";
WriteLine(callDetails);
}
ReadLine();
}
示例2: Index
// GET: Dashboard
public ActionResult Index()
{
//var tickets = _repository.All();
var twilio = new TwilioRestClient(_credentials.AccountSid, _credentials.AuthToken);
// Build the parameters
var options = new CallListRequest();
var calls = twilio.ListCalls(options);
foreach (var call in calls.Calls)
{
Console.WriteLine(call.Direction);
}
return View(calls.Calls);
}
示例3: 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 request = new CallListRequest();
request.From = "client:tommy";
var calls = twilio.ListCalls(request);
foreach (var call in calls.Calls)
{
Console.WriteLine(call.Direction);
}
}
示例4: Index
public IActionResult Index(string phoneNumber)
{
// Instantiate a new Twilio Rest Client
var client = new TwilioRestClient("your-twilio-account-sid", "your-twilio-auth-token");
// Select all calls from my account based on a phoneNumber
var calls = client.ListCalls(new CallListRequest(){To = phoneNumber});
// Check for any exceptions
if (calls.RestException != null)
{
throw new FormatException(calls.RestException.Message);
}
return View(calls.Calls);
}
示例5: 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 request = new CallListRequest();
request.Status = "busy";
request.To = "+15558675309";
var calls = twilio.ListCalls(request);
foreach (var call in calls.Calls)
{
Console.WriteLine(call.StartTime);
}
}
示例6: 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 request = new CallListRequest();
request.Status = "completed";
request.StartTimeComparison = ComparisonType.GreaterThanOrEqualTo;
request.StartTime = new DateTime(2009, 07, 06);
var calls = twilio.ListCalls(request);
foreach (var call in calls.Calls)
{
Console.WriteLine(call.To);
}
}
示例7: Main
public void Main(string[] args)
{
// Instantiate a new Twilio Rest Client
var client = new TwilioRestClient("your-twilio-account-sid", "your-twilio-auth-token");
// Select all calls from my account
var calls = client.ListCalls(new CallListRequest());
// Check for any exceptions
if (calls.RestException != null)
{
throw new FormatException(calls.RestException.Message);
}
// Loop through them and show information
foreach(var call in calls.Calls){
var detail = String.Format("From: {0}, Day: {1}, Duration: {2}s", call.From, call.DateCreated, call.Duration);
Console.WriteLine(detail);
}
}
示例8: GetCalls
public static CallResult GetCalls(Account Acnt)
{
TwilioRestClient acntInfo = new TwilioRestClient(Acnt.Sid, Acnt.AuthToken);
CallResult calls = acntInfo.ListCalls();
return (calls);
}
示例9: GetCallsAll
public CallResult GetCallsAll(TwilioRestClient TwilioAccount, CallListRequest CallListReq )
{
var calls = TwilioAccount.ListCalls(CallListReq);
return calls;
}