public HttpResponseMessage Post(VoiceRequest request) { var response = new TwilioResponse(); response.Say("Welcome to this Twilio demo app. Please enter your 3 digit pin code."); response.Gather(new { numDigits = 3, action = string.Format("/api/Authenticate") }); return this.TwiMLResponse(response); }
public HttpResponseMessage Post(VoiceRequest request) { var response = new TwilioResponse(); response.Say("Welcome to this Twilio demo app. Please enter your 5 digit ID."); response.Gather(new { numDigits = 5, action = string.Format("/api/Authenticate") }); return this.Request.CreateResponse(HttpStatusCode.OK, response.Element, new XmlMediaTypeFormatter()); }
private void AddRecordOrGatherCommands(TwilioResponse response) { var questionType = _question.Type; switch (questionType) { case QuestionType.Voice: response.Record(new { action = GenerateUrl(_question) }); break; case QuestionType.Numeric: case QuestionType.YesNo: response.Gather(new { action = GenerateUrl(_question) }); break; } }
// // 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.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.Gather(new { action = Url.Action("ServiceRequest"), timeout = 120, method = "POST", numDigits = 1 }); return SendTwilioResult(response); }
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.Say("Please enter your 8 digit account number"); response.Gather( new { action = Url.Action("ManageAccount"), timeout = 120, method = "POST", numDigits = 8 }); } 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); }