本文整理汇总了C#中Twilio.TwiML.TwilioResponse.Redirect方法的典型用法代码示例。如果您正苦于以下问题:C# TwilioResponse.Redirect方法的具体用法?C# TwilioResponse.Redirect怎么用?C# TwilioResponse.Redirect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Twilio.TwiML.TwilioResponse
的用法示例。
在下文中一共展示了TwilioResponse.Redirect方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Gather
public TwiMLResult Gather(VoiceRequest request)
{
var response = new TwilioResponse();
// If the user entered digits, process their request
if (!string.IsNullOrEmpty(request.Digits))
{
switch (request.Digits)
{
case "1":
response.Say("You selected sales. Good for you!");
break;
case "2":
response.Say("You need support. We will help!");
break;
default:
response.Say("Sorry, I don't understand that choice.").Pause();
response.Redirect("/voice");
break;
}
}
else
{
// If no input was sent, redirect to the /voice route
response.Redirect("/voice");
}
return TwiML(response);
}
示例2: Complete
public ActionResult Complete(VoiceRequest request)
{
var response = new TwilioResponse();
if (request.Digits=="1")
{
response.Redirect( Url.Action("Gather"), "GET" );
}
else
{
response.Redirect( Url.Action("Goodbye"), "GET" );
}
return TwiML(response);
}
示例3: Error
public ActionResult Error(VoiceRequest request)
{
var response = new TwilioResponse();
switch (request.Digits)
{
case "1":
response.Redirect(Url.Action("Agent"), "GET");
break;
default:
response.Redirect(Url.Action("Goodbye"), "GET");
break;
}
return TwiML(response);
}
示例4: RedirectWelcome
private TwiMLResult RedirectWelcome()
{
var response = new TwilioResponse();
response.Redirect(Url.Action("Welcome", "IVR"));
return TwiML(response);
}
示例5: GetMenuSelection
public TwilioResponse GetMenuSelection(VoiceRequest request)
{
var response = new TwilioResponse();
try
{
string lookupPhoneNumber = request.GetOriginatingNumber();
int profileId = profileManager.GetProfileId(lookupPhoneNumber);
var selection = int.Parse(request.Digits);
switch (selection)
{
case 1:
response.Say("Looking up unread messages.");
var unreadCount = refUnitedAcctManager.GetUnreadMessageCount(profileId);
response.Say(string.Format("You have {0} message{1}", unreadCount, (unreadCount == 1) ? "" : "s"));
break;
case 2:
response.Say("Looking up messages");
response.Redirect(routeProvider.GetUrlMethod(IVRRoutes.READ_PLATFORM_MESSAGES, profileId));
break;
case 3:
response.Redirect(routeProvider.GetUrlMethod(IVRRoutes.SEND_MESSAGE_TO_FAVOURITE, profileId));
break;
case 4:
response.Redirect(routeProvider.GetUrlMethod(IVRRoutes.PLAY_RECORDED_MESSAGES, profileId));
break;
case 5:
response.Redirect(routeProvider.GetUrlMethod(IVRRoutes.BROADCAST_RECORD, profileId));
break;
case 6:
response.Redirect(routeProvider.GetUrlMethod(IVRRoutes.BROADCAST_MENU, profileId));
break;
default:
response.Redirect(routeProvider.GetUrlMethod(IVRRoutes.PLAY_MAIN_MENU));
break;
}
}
catch (Exception ex)
{
response.Say("an error has occured. " + ex.Message);
}
return response;
}
示例6: Closed
public HttpResponseMessage Closed()
{
var voicemailUrl = _accountSettings.GetSetting("VoicemailUrl");
var twilioResponse = new TwilioResponse();
twilioResponse.Redirect(voicemailUrl);
return Request.CreateResponse(HttpStatusCode.OK, twilioResponse.Element, new XmlMediaTypeFormatter());
}
示例7: RedirectWelcome
public TwiMLResult RedirectWelcome()
{
var response = new TwilioResponse();
response.Say("Returning to the main menu",
new {voice = "alice", language = "en-GB"});
response.Redirect(Url.Action("Welcome", "IVR"));
return new TwiMLResult(response);
}
示例8: 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");
}
示例9: ConnectCall
// Webhook for Twilio survey number
// GET: connectcall
public ActionResult ConnectCall()
{
var response = new TwilioResponse();
var survey = _surveysRepository.FirstOrDefault();
var welcomeMessage = string.Format("Thank you for taking the {0} survey", survey.Title);
response.Say(welcomeMessage);
response.Redirect(Url.Action("find", "questions", new { id = 1 }));
return TwiML(response);
}
示例10: BroadcastReplyMenuSelection
public TwilioResponse BroadcastReplyMenuSelection(VoiceRequest request, int profileId, int lastBroadcastIdx, int subBroadcastIdx)
{
var response = new TwilioResponse();
var selection = request.Digits;
switch (selection)
{
case "1":
response.Redirect(ivrRouteProvider.GetUrlMethod(IVRRoutes.BROADCASTS_REPLY_PRIVATELY, profileId, lastBroadcastIdx, subBroadcastIdx));
return response;
case "2":
response.Redirect(ivrRouteProvider.GetUrlMethod(IVRRoutes.BROADCASTS_REPLY_PUBLICLY, profileId, lastBroadcastIdx, subBroadcastIdx));
return response;
case "3":
response.Redirect(ivrRouteProvider.GetUrlMethod(IVRRoutes.BROADCASTS_PLAY_PUBLIC_REPLY, profileId, lastBroadcastIdx, ++subBroadcastIdx));
return response;
case "4":
response.Redirect(ivrRouteProvider.GetUrlMethod(IVRRoutes.BROADCASTS_LISTEN_TO_ALL_PUBLIC, profileId, ++lastBroadcastIdx));
return response;
case "5":
response.Redirect(ivrRouteProvider.GetUrlMethod(IVRRoutes.BROADCASTS_ADD_REPLIER_AS_FAVOURITE, profileId, lastBroadcastIdx, subBroadcastIdx));
return response;
default:
response.Redirect(ivrRouteProvider.GetUrlMethod(IVRRoutes.PLAY_MAIN_MENU));
return response;
}
}
示例11: 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);
}
示例12: AddResponderAsFavourite
public TwilioResponse AddResponderAsFavourite(VoiceRequest request, int profileId, int lastBroadcastIdx, int subBroadcastIdx)
{
var broadcast = broadcastManager.GetAll().Skip(lastBroadcastIdx).Take(1).FirstOrDefault();
var reply = broadcast.BroadcastReplies.Skip(subBroadcastIdx).Take(1).FirstOrDefault();
int profileIdToFavourite = reply.FromProfileId;
profileManager.AddAsFavourite(profileId, profileIdToFavourite);
var profile = profileManager.GetProfile(profileIdToFavourite);
var response = new TwilioResponse();
response.Say(string.Format("{0} has been added as a favourite", profile.FullName));
response.Redirect(ivrRouteProvider.GetUrlMethod(IVRRoutes.PLAY_MAIN_MENU));
return response;
}
示例13: Post
public HttpResponseMessage Post(VoiceRequest request)
{
var pin = request.Digits;
var authenticated = AuthenticationService.Authenticate(pin);
if (!authenticated)
{
throw new InvalidPinException(pin);
}
var response = new TwilioResponse();
response.Say("Pin code is valid.");
response.Redirect(string.Format("/api/User?pin={0}", pin));
return this.TwiMLResponse(response);
}
示例14: ServiceRequest
public ActionResult ServiceRequest(string CallSid, string Digits)
{
var call = GetCall(CallSid);
TwilioResponse response = new TwilioResponse();
switch (Digits)
{
case "0":
{
StateManager.AddToLog(CallSid, string.Format("User selected option {0} from service selection.", "Return to Menu"));
response.Say("Returning to the main menu.");
response.Redirect(Url.Action("IncomingCall"));
}
break;
case "1":
{
StateManager.AddToLog(CallSid, string.Format("User selected option {0} from service selection.", "Manage Account"));
response.BeginGather(
new { action = Url.Action("ManageAccount"), timeout = 120, method = "POST", numDigits = 8 });
response.Say("Please enter your 8 digit account number");
response.EndGather();
}
break;
case "2":
{
StateManager.AddToLog(CallSid, string.Format("User selected option {0} from service selection.", "Take a Loan"));
response.Say(
"All of our loan officers are currently giving money away to people less deserving than you.");
}
break;
case "3":
{
StateManager.AddToLog(CallSid, string.Format("User selected option {0} from service selection.", "Talk to a Representative"));
}
break;
default:
{
response.Say("Oy vey.");
response.Redirect(Url.Action("IncomingCall"));
} break;
}
return SendTwilioResult(response);
}
示例15: HandleGather
// /Voice/HandleGather
public TwiMLResult HandleGather(VoiceRequest request)
{
var response = new TwilioResponse();
switch (request.Digits)
{
case "1":
response.Dial("+13105551212");
response.Say("The call failed or the remote party hung up. Goodbye.");
break;
case "2":
response.Say("Record your message after the tone.");
response.Record(new {maxLength = "30", action = "/Voice/HandleRecord"});
break;
default:
response.Redirect("/Voice");
break;
}
return TwiML(response);
}