本文整理汇总了C#中Twilio.TwiML.TwilioResponse.Enqueue方法的典型用法代码示例。如果您正苦于以下问题:C# TwilioResponse.Enqueue方法的具体用法?C# TwilioResponse.Enqueue怎么用?C# TwilioResponse.Enqueue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Twilio.TwiML.TwilioResponse
的用法示例。
在下文中一共展示了TwilioResponse.Enqueue方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Can_Generate_Enqueue_With_Name_And_Options
public void Can_Generate_Enqueue_With_Name_And_Options()
{
var response = new TwilioResponse();
response.Enqueue("example", new { action = "example.xml", method = "GET", waitUrl="wait.xml", waitUrlMethod="GET", workspaceSid="WSXXXXX" });
Assert.IsTrue(IsValidTwiML(response.ToXDocument()));
}
示例2: Can_Generate_Enqueue_With_Options_And_TaskAttributes
public void Can_Generate_Enqueue_With_Options_And_TaskAttributes()
{
var response = new TwilioResponse();
response.Enqueue(new { action = "example.xml", method = "GET", waitUrl = "wait.xml", waitUrlMethod = "GET", workspaceSid = "WSXXXXX" }, "{'task':'attributes'}");
Assert.IsTrue(IsValidTwiML(response.ToXDocument()));
}
示例3: Can_Generate_Enqueue_With_Only_Options
public void Can_Generate_Enqueue_With_Only_Options()
{
var response = new TwilioResponse();
response.Enqueue(new { action = "example.xml", method = "GET", waitUrl = "wait.xml", waitUrlMethod = "GET"});
Assert.IsTrue(IsValidTwiML(response.ToXDocument()));
}
示例4: Can_Generate_Enqueue_With_Name
public void Can_Generate_Enqueue_With_Name()
{
var response = new TwilioResponse();
response.Enqueue("example");
Assert.IsTrue(IsValidTwiML(response.ToXDocument()));
}
示例5: Can_Generate_Enqueue_With_Options_And_TaskAttributes_And_Priority_And_Timeout
public void Can_Generate_Enqueue_With_Options_And_TaskAttributes_And_Priority_And_Timeout()
{
var response = new TwilioResponse();
response.Enqueue(new { action = "example.xml", method = "GET", waitUrl = "wait.xml", waitUrlMethod = "GET", workflowSid = "WFXXXXX" }, "{'task':'attributes'}", new {priority="10", timeout="30"});
Assert.IsTrue(IsValidTwiML(response.ToXDocument()));
}
示例6: QueueCall
public ActionResult QueueCall()
{
var response = new TwilioResponse();
response.Enqueue("Demo Queue", new {
action= Url.Action("LeaveQueue"), //url to call when the call is dequeued
waitUrl = Url.Action("WaitInQueue") //url to call while the call waits
});
return TwiML(response);
}
示例7: SendResponse
public static HttpListenerResponse SendResponse(HttpListenerContext ctx)
{
HttpListenerRequest request = ctx.Request;
HttpListenerResponse response = ctx.Response;
response.StatusCode = (int)HttpStatusCode.OK;
response.ContentType = "application/xml";
var twiml = new Twilio.TwiML.TwilioResponse();
twiml.Enqueue (new { workflowSid = "WW0123456789abcdef0123456789abcdef", waitUrl = "/hold_music.php", action = "/post_bridge_survey.php"}, "{\"account_number\":\"12345abcdef\"}");
response.StatusDescription = twiml.ToString();
return response;
}
示例8: SendResponse
public static HttpListenerResponse SendResponse(HttpListenerContext ctx)
{
HttpListenerRequest request = ctx.Request;
HttpListenerResponse response = ctx.Response;
response.StatusCode = (int)HttpStatusCode.OK;
response.ContentType = "application/xml";
var twiml = new Twilio.TwiML.TwilioResponse();
twiml.Enqueue (new { workflowSid = "WW0123456789abcdef0123456789abcdef" });
response.StatusDescription = twiml.ToString();
return response;
}
示例9: Company
public HttpResponseMessage Company(string id)
{
var callWaitUrl = _accountSettings.GetSetting("CallWaitUrl");
var response = new TwilioResponse();
response.Say("You are joining a queue");
var attributes = new
{
action = "/api/CallStatus/Update?callId=null",
method = "POST",
waitUrl = callWaitUrl
};
response.Enqueue($"Company_{id}", attributes);
return Request.CreateResponse(HttpStatusCode.OK, response.Element, new XmlMediaTypeFormatter());
}
示例10: SendResponse
public static HttpListenerResponse SendResponse(HttpListenerContext ctx)
{
HttpListenerRequest request = ctx.Request;
HttpListenerResponse response = ctx.Response;
response.StatusCode = (int)HttpStatusCode.OK;
response.ContentType = "application/xml";
var twiml = new Twilio.TwiML.TwilioResponse();
var task = new Task("{\"account_number\":\"12345abcdef\"}", new {priority = "5", timeout = "200"});
twiml.EnqueueTask (new { workflowSid = "WW0123456789abcdef0123456789abcdef" }, task);
// alternatively
twiml.Enqueue (new { workflowSid = "WW0123456789abcdef0123456789abcdef" }, "{\"account_number\":\"12345abcdef\"}", new {priority = "5", timeout = "200"});
response.StatusDescription = twiml.ToString();
return response;
}
示例11: Inbound
public TwilioResponse Inbound()
{
var response = new TwilioResponse();
if (settings.WorkingHours != null && settings.WorkingHours.Enabled)
{
if (!(settings.WorkingHours.From <= DateTime.UtcNow.TimeOfDay && settings.WorkingHours.To >= DateTime.UtcNow.TimeOfDay))
{
return AddVoiceMail(response);
}
}
if (settings.AvailableOperators.Any())
{
if (!string.IsNullOrEmpty(settings.GreetingAudio))
{
response.Play(settings.GreetingAudio);
}
response.Enqueue(settings.Queue.Name, new { method = "GET", action = GetEcho("enqueue"), waitUrl = GetEcho("wait"), waitUrlMethod = "GET" });
}
return AddVoiceMail(response);
}
示例12: JoinQueue
public HttpResponseMessage JoinQueue(TwilioQueueRequest twilioRequest)
{
var twilioResponse = new TwilioResponse();
twilioResponse.Say("You're now joining the Priority Queue", _voicesettings);
twilioResponse.Enqueue("PriorityQueue",
new
{
action = Url.Link("ExtendedApi", new {controller = "Phone", action = "LeaveQueue"}),
waitUrl = Url.Link("ExtendedApi", new {controller = "Phone", action = "WaitInQueue"})
});
return Request.CreateResponse(HttpStatusCode.OK, twilioResponse.Element);
}
示例13: Department
public HttpResponseMessage Department(string companyId, string id, string callSid)
{
var callWaitUrl = _accountSettings.GetSetting("CallWaitUrl");
var queueMessageUrl = _accountSettings.GetSetting("JoiningQueueMessageUrl");
var endPoint = _endpointResolverService.Get(int.Parse(id));
var response = new TwilioResponse();
response.Play(queueMessageUrl);
var attributes = new
{
action = "api/CallStatus/Update?callId=null",
method = "POST",
waitUrl = callWaitUrl
};
response.Enqueue($"Department_{endPoint.EndpointId}", attributes);
_callService.UpdateCallBySid(new Call
{
Sid = callSid,
CallStatus = CallStatus.Queued,
DateReceived = DateTime.Now,
QueueId = int.Parse(id)
});
_logger.Debug($"Twiml generated for call {callSid}. {response.Element}");
return Request.CreateResponse(HttpStatusCode.OK, response.Element, new XmlMediaTypeFormatter());
}