public IActionResult GatherExtensionFR(string digits) { var response = new VoiceResponse(); // If the user entered digits, process their request if (!string.IsNullOrEmpty(digits)) { var agent = _context.Agents .Where(a => a.Extension.ToString() == digits) .FirstOrDefault(); if (agent != null) { response.Say($"You will be connected to {agent.Name} shortly.").Pause(); var dial = new Dial(action: new Uri($"/answer/connect/{agent.ID}", UriKind.Relative)); dial.Number(agent.PhoneNumber, url: new Uri("/answer/screenCall", UriKind.Relative)); response.Append(dial); //response.Play(new Uri("/AudioFiles/Goodbye.mp3", UriKind.Relative)); //response.Hangup(); } else { response.Say("Sorry, I don't understand that choice.").Pause(); } } else { // If no input was sent, redirect to the /voice route response.Redirect(new Uri("/answer", UriKind.Relative)); } return(TwiML(response)); }
public IActionResult Index(CallParams call) { var response = new VoiceResponse(); response.Append( new Gather(numDigits: 3, action: new Uri("/answer/gather/extension/en", UriKind.Relative), timeout: 1)); LogCall(call).Wait(); response.Append( new Gather(numDigits: 1, action: new Uri("/answer/gather/language", UriKind.Relative)) .Play(new Uri("/AudioFiles/intromerci.wav", UriKind.Relative)) .Play(new Uri("/AudioFiles/engfr.wav", UriKind.Relative))); //.Say("Thanks for calling Silico, if you know your parties extension, enter it now. If you'd like to leave a voice message, press 0 and your call will be returned shortly.")); //// If the user doesn't enter input, loop response.Redirect(new Uri("/answer", UriKind.Relative)); return(Content(response.ToString(), "text/xml")); }
static void Main() { var response = new VoiceResponse(); response.Redirect(new Uri("http://pigeons.com/twiml.xml"), method: HttpMethod.Post); Console.WriteLine(response.ToString());; }