本文整理汇总了C#中Twilio.TwiML.TwilioResponse.BeginGather方法的典型用法代码示例。如果您正苦于以下问题:C# TwilioResponse.BeginGather方法的具体用法?C# TwilioResponse.BeginGather怎么用?C# TwilioResponse.BeginGather使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Twilio.TwiML.TwilioResponse
的用法示例。
在下文中一共展示了TwilioResponse.BeginGather方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: IncomingCall
//
// GET: /Phone/
public ActionResult IncomingCall(string CallSid, string FromCity, string FromState, string FromZip, string FromCountry)
{
LocationalCall call = (LocationalCall)GetCall(CallSid);
StateManager.AddNewCall(call);
StateManager.AddToLog(CallSid, "Incoming call...");
call.City = FromCity;
call.Country = FromCountry;
call.ZipCode = FromZip;
call.State = FromState;
TwilioResponse response = new TwilioResponse();
response.BeginGather(new
{
action = Url.Action("ServiceRequest"),
timeout = 120,
method = "POST",
numDigits = 1
});
response.Say("Welcome to the Bank of Griff.");
response.Pause();
response.Say("Press 1 to manage your account.");
response.Say("Press 2 to take out a loan.");
response.Say("Press 3 to talk to a representative.");
response.Pause();
response.EndGather();
return SendTwilioResult(response);
}
示例2: Welcome
public TwiMLResult Welcome()
{
var response = new TwilioResponse();
response.BeginGather(new {action = Url.Action("Show", "Menu"), numDigits = "1"})
.Play("http://howtodocs.s3.amazonaws.com/et-phone.mp3", new {loop = 3})
.EndGather();
return TwiML(response);
}
示例3: RenderMainMenu
// helper function to set up a <Gather>
private static void RenderMainMenu(TwilioResponse response)
{
response.BeginGather(new { numDigits = 1 });
response.Say("For sales, press 1. For support, press 2.");
response.EndGather();
// If the user doesn't enter input, loop
response.Redirect("/voice");
}
示例4: GetGreeting
public TwilioResponse GetGreeting(VoiceRequest request)
{
string culture = LanguageHelper.GetDefaultCulture();
var response = new TwilioResponse();
try
{
var lookupPhoneNumber = request.GetOriginatingNumber();
var knownNumber = profileManager.CheckNumber(lookupPhoneNumber);
if (knownNumber)
{
culture = profileManager.GetCulture(lookupPhoneNumber);
if (string.IsNullOrEmpty(culture))
{
culture = LanguageHelper.GetDefaultCulture();
}
else
{
culture = LanguageHelper.GetValidCulture(culture);
}
IVREntryLang.Culture = new System.Globalization.CultureInfo(culture);
twiMLHelper = new TwiMLHelper(culture, LanguageHelper.IsImplementedAsMP3(culture));
}
else
{
twiMLHelper = new TwiMLHelper(LanguageHelper.GetDefaultCulture(), false);
}
twiMLHelper.SayOrPlay(response, IVREntryLang.Welcome);
twiMLHelper.SayOrPlay(response, string.Format(IVREntryLang.PhoneLookup, string.Join(" ", lookupPhoneNumber.ToArray())));
if (!knownNumber)
{
twiMLHelper.SayOrPlay(response, IVREntryLang.PhoneNumberNotFound);
response.Hangup();
return response;
}
response.BeginGather(new { finishOnKey = "#", action = string.Format("/api/IVRAuthenticate?language={0}", culture) });
twiMLHelper.SayOrPlay(response, IVREntryLang.EnterPin);
response.EndGather();
}
catch (Exception ex)
{
twiMLHelper.SayOrPlay(response, string.Format(IVREntryLang.Error, ex.Message));
twiMLHelper.SayOrPlay(response, string.Format(IVREntryLang.Error, ex.Message));
twiMLHelper.SayOrPlay(response, string.Format(IVREntryLang.Error, ex.Message));
response.Hangup();
}
return response;
}
示例5: Join
public ActionResult Join()
{
var response = new TwilioResponse();
response.Say("You are about to join the Rapid Response conference");
response.BeginGather(new {action = @Url.Action("Connect")})
.Say("Press 1 to join as a listener")
.Say("Press 2 to join as a speaker")
.Say("Press 3 to join as the moderator")
.EndGather();
return TwiML(response);
}
示例6: Index
// /Voice
public TwiMLResult Index(VoiceRequest request)
{
var response = new TwilioResponse();
response.Say("Hello. It's me.", new {voice = "alice", language = "en-GB"});
response.Play("http://howtodocs.s3.amazonaws.com/ahoyhoy.mp3");
response.BeginGather(new {numDigits = "1", action = "/Voice/HandleGather"});
response.Say("To speak to a real person, press 1.\n" +
"Press 2 to record a message for a Twilio educator.\n" +
"Press any other key to start over.");
response.EndGather();
return TwiML(response);
}
示例7: Greet
public TwilioResponse Greet(VoiceRequest request)
{
TwilioResponse response = new TwilioResponse();
response.Say("Welcome to Saint Georges Hospital Directory.");
response.BeginGather(new { finishOnKey = "#", action = "/Router/InitialOptions" });
response.Say("Please enter your four digit I D then press the hash button");
response.EndGather();
return response;
}
示例8: Gather
public ActionResult Gather()
{
var response = new TwilioResponse();
response.BeginGather(new { action=Url.Action("Gather"), method="POST" })
.Say("Please enter your four digit package ID, followed by the pound sign.");
response.EndGather();
response.Say("I'm sorry, I didn't get that.");
response.Redirect( Url.Action("Gather"), "GET" );
return TwiML(response);
}
示例9: Error
public ActionResult Error()
{
var response = new TwilioResponse();
response.Say(string.Format("I'm sorry, there seems to have been a problem locating your package."));
response.BeginGather(new { action = Url.Action("Complete"), method = "POST" })
.Say("To speak with an agent, press one.");
response.EndGather();
response.Redirect(Url.Action("Goodbye"), "GET");
return TwiML(response);
}
示例10: Complete
public ActionResult Complete(string s)
{
var response = new TwilioResponse();
response.Say(string.Format("The status of your package is {0}.", s));
response.BeginGather(new { action = Url.Action("Complete"), method="POST" })
.Say("To locate another package, press one.");
response.EndGather();
response.Redirect( Url.Action("Goodbye"), "GET" );
return TwiML(response);
}
示例11: Planets
private TwiMLResult Planets()
{
var response = new TwilioResponse();
response.BeginGather(new {action = "/Extension/Connect", numDigits = "1"})
.Say("To call the planet Broh doe As O G, press 2. To call the planet " +
"DuhGo bah, press 3. To call an oober asteroid to your location, press 4. To " +
"go back to the main menu, press the star key ",
new {voice = "alice", language = "en-GB", loop = "3"})
.EndGather();
return TwiML(response);
}
示例12: IncomingPhone
public HttpResponseMessage IncomingPhone(VoiceRequest call)
{
var response = new TwilioResponse();
response
.BeginGather(new { action = "http://{{ YOUR URL HERE }}/twilio/response", voice = "woman", numDigits = 1})
.Say("Hello there.")
.Pause()
.Say("Press 1 for customer service.")
.Say("Press 2 to hangup")
.EndGather();
return Request.CreateResponse(HttpStatusCode.OK, response.Element, new XmlMediaTypeFormatter());
}
示例13: Index
public TwiMLResult Index(VoiceRequest request)
{
var response = new TwilioResponse();
// Use the <Gather> verb to collect user input
response.BeginGather(new {numDigits = 1});
response.Say("For sales, press 1. For support, press 2.");
response.EndGather();
// If the user doesn't enter input, loop
response.Redirect("/voice");
return TwiML(response);
}
示例14: GetMainMenu
public TwilioResponse GetMainMenu()
{
var response = new TwilioResponse();
response.Say("Main menu.");
response.BeginGather(new { numDigits = 1, action = "/IVRMain/MainMenuSelection" });
response.Say("Press one to check messages.");
response.Say("Press two to listen to old messages.");
response.Say("Press three to send a voice message to a favourite.");
response.Say("Press four to listen to voice messages.");
response.Say("Press five to send a public broadcast.");
response.Say("Press six to listen public broadcasts.");
response.EndGather();
return response;
}
示例15: seq
private IEnumerable<Twilio.TwiML.TwilioResponse> seq(State s)
{
int sum = 0;
int count = 0;
var x = new Twilio.TwiML.TwilioResponse();
x.Say("Hello test 123");
yield return x;
do
{
var x2 = new Twilio.TwiML.TwilioResponse();
x2.BeginGather(new { action = "/Voice/Continue/" + s.ID.ToString() })
.Say("Enter digits")
.EndGather();
yield return x2;
var dig = s.Digits;
int value;
if (int.TryParse(dig, out value))
{
var xr = new Twilio.TwiML.TwilioResponse();
xr.Say("You entered " + dig);
yield return xr;
sum += value;
count++;
}
else break;
} while (true);
var x3 = new Twilio.TwiML.TwilioResponse();
x3.Say("You entered "+ count.ToString() + " entries, sum is " + sum.ToString());
yield return x3;
}