public ActionResult VoiceMessageDial(string toSay, string toDial) { TwilioDialModel dial = new TwilioDialModel() { MessageBody = toSay, DialTo = new Twilio.Types.PhoneNumber(toDial) }; //This must be a partial view, otherwise MVC will prepend a blank line, which is invalid for XML return(PartialView("VoiceMessageDial", dial)); }
public ActionResult VoiceMessageGathered(string Digits) { string fromNumber = Request.Params["From"]; string callSid = Request.Params["CallSid"]; bool isActionFound = false; object response = null; Event eventObj = EventProcessingService.GetEvent(callSid); MessageTemplateType templateType = EventProcessingService.GetTemplateType(eventObj); List <TwilioGatherOption> optRedirects = TwilioService.GetGatherOptions(templateType); foreach (var opt in optRedirects) { if (opt.Digits.Equals(Digits)) { response = EventProcessingService.HandleResponse(opt.ResponseOption, eventObj); isActionFound = true; } } if (!isActionFound) { response = new TwilioDialModel() { MessageBody = "An application error has occurred. You are being redirected to your pharmacy for assistance.", DialTo = new PhoneNumber(eventObj.Patient.Pharmacy.Phone) }; } if (response is TwilioDialModel) { TwilioDialModel tdm = (TwilioDialModel)response; return(RedirectToAction("VoiceMessageDial", new { toSay = tdm.MessageBody, toDial = tdm.DialTo })); } if (response is ActionResult) { return((ActionResult)response); } return(RedirectToAction("VoiceMessageSay", new { toSay = response.ToString() })); }