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; } }
public TwiMLResult Index(VoiceRequest request) { var response = new TwilioResponse(); // Use <Say> to give the caller some instructions response.Say("Hello. Please leave a message after the beep."); // Use <Record> to record the caller's message response.Record(); // End the call with <Hangup> response.Hangup(); return TwiML(response); }
public TwiMLResult Index(VoiceRequest request) { var response = new TwilioResponse(); // Use <Say> to give the caller some instructions response.Say("Hello. Please leave a message and I will transcribe it."); // Use <Record> to record and transcribe the caller's message response.Record(new { transcribe = true, maxLength = 30 }); // End the call with <Hangup> response.Hangup(); return TwiML(response); }
// /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); }
public ActionResult Record() { var response = new TwilioResponse(); response.Say( "Please record your message after the beep. Press star to end your recording"); response.Record(new { finishOnKey = "*", action = Url.Action("Hangup") }); return TwiML(response); }
public TwiMLResult VoiceMail(CallContextModel model) { var response = new TwilioResponse(); try { response.Say(ConferenceConst.DictateFollowUpAction, new { voice = VoiceInConference, language = LanguageInConference }); var callBackUrl = Utilities.FormatLink(Url.Action("VoiceMailStatusCallBack", "Conference", model)); response.Record(new { action = callBackUrl, trim = "trim-silence", finishOnKey = "#", playBeep = true }); } catch (Exception e) { // Log Log.Error("Voice email. Error: ", e); // Error response.Say(ConferenceConst.ErrorMessage, new { voice = VoiceInConference, language = LanguageInConference }); response.Hangup(); } return new TwiMLResult(response); }
public TwilioResponse RecordPublicReply(VoiceRequest request, int profileId, int lastBroadcastIdx, int? subBroadcastIdx) { var response = new TwilioResponse(); response.Say("At the tone please record your reply."); response.Record(new { action = ivrRouteProvider.GetUrlMethod(IVRRoutes.BROADCAST_SAVE_PUBLIC_REPLY, profileId, lastBroadcastIdx, subBroadcastIdx), playBeep = true }); return response; }
public TwilioResponse RecordBroadcast(VoiceRequest request, int profileId) { var response = new TwilioResponse(); response.Say("At the tone record your message, to finish press any key. Please note that this will be public to all people on the Refugees United platform."); response.Record(new { action = ivrRouteProvider.GetUrlMethod(IVRRoutes.BROADCAST_SAVE_PUBLIC_BROADCAST, profileId), playBeep = true }); return response; }
public HttpResponseMessage RecordMessage(TwilioRecordRequest twilioRequest) { var twilioResponse = new TwilioResponse(); twilioResponse.Say("Please leave your message after the beep and finish with the pound key.", _voicesettings); twilioResponse.Say("You have 6 seconds.", _voicesettings); twilioResponse.Record( new { action = Url.Link("ExtendedApi", new {controller = "Phone", action = "HandleRecordedMessage"}), finishOnkey = "#", maxLength = "6", method = "POST", transcribe = "true" }); twilioResponse.Say("We did not receive a recording. You're returning to the previous menu.", _voicesettings); twilioResponse.Redirect(Url.Link("ExtendedApi", new { controller = "Phone", action = "HandleMenuCall" })); return Request.CreateResponse(HttpStatusCode.OK, twilioResponse.Element); }
public TwilioResponse RecordMessageForFavourite(VoiceRequest request, int profileId, string favs, int pageIdx) { var response = new TwilioResponse(); var favsArray = favs.Split(','); if (request.Digits.Equals("#")) { response.Redirect(string.Format("/IVRMain/SendFavMessage_ListFavs?profileId={0}&pageIdx={1}", profileId, ++pageIdx)); return response; } else if (request.Digits.Equals("*")) { response.Redirect(routeProvider.GetUrlMethod(IVRRoutes.PLAY_MAIN_MENU)); return response; } var selection = int.Parse(request.Digits); string targetProfileId = favsArray[selection - 1]; response.Say("Record your message after the tone, press any key when you are done."); response.Record(new { action = string.Format("/IVRMain/SendFavMessage_SaveRecording?profileId={0}&targetProfileId={1}", profileId, targetProfileId) }); return response; }
public TwilioResponse PlayRecordedMessage_Response(VoiceRequest request, int profileId, int recordingIdx, int fromProfileId) { var response = new TwilioResponse(); var digits = int.Parse(request.Digits); switch (digits) { case 1: response.Redirect(string.Format("/IVRMain/PlayRecordedMessage?profileId={0}&recordingIdx={1}", profileId, recordingIdx)); break; case 2: profileManager.DeleteRecording(profileId, recordingIdx); response.Redirect(string.Format("/IVRMain/PlayRecordedMessage?profileId={0}&recordingIdx={1}", profileId, recordingIdx)); break; case 3: response.Say("At the tone please record your response. Press any key when you are done."); response.Record(new { action = string.Format("/IVRMain/PlayRecordedMessage_SaveResponse?profileId={0}&recordingIdx={1}&fromProfileId={2}", profileId, recordingIdx, fromProfileId) }); break; case 4: response.Redirect(string.Format("/IVRMain/PlayRecordedMessage?profileId={0}&recordingIdx={1}", profileId, ++recordingIdx)); break; } return response; }