public void Can_Generate_Consecutive_Mixed_Plays() { var response = new TwilioResponse(); response.Play("Hello world"); response.Play("Hello world2", new { loop = 3 }); Assert.IsTrue(IsValidTwiML(response.ToXDocument())); }
public TwilioResponse Inbound(Tuple <Agent, bool> agentTuple) { var agent = agentTuple != null ? agentTuple.Item1 : null; var anyOnline = agentTuple != null ? agentTuple.Item2 : false; var response = new TwilioResponse(); if (settings.WorkingHours != null && settings.WorkingHours.Enabled) { var now = TenantUtil.DateTimeFromUtc(DateTime.UtcNow); if (!(settings.WorkingHours.From <= now.TimeOfDay && settings.WorkingHours.To >= now.TimeOfDay)) { return(AddVoiceMail(response)); } } if (anyOnline) { if (!string.IsNullOrEmpty(settings.GreetingAudio)) { response.Play(EncodePlay(settings.GreetingAudio)); } response.Enqueue(settings.Queue.Name, new { method = "POST", action = GetEcho("Enqueue", agent != null), waitUrl = GetEcho("Wait", agent != null), waitUrlMethod = "POST" }); } return(AddVoiceMail(response)); }
public HttpResponseMessage Record_Callback(VoiceRequest request, CallType type) { var smtpCient = new SmtpClient(); var message = new MailMessage("*****@*****.**", "*****@*****.**", "New " + type + " Voice-mail from: " + request.From, "You have a new " + type + " voice-mail for the Ellsworth house. \r\nClick here to listen: " + request.RecordingUrl); var webClient = new WebClient(); using (var stream = webClient.OpenRead(request.RecordingUrl)) { message.Attachments.Add(new Attachment(stream, "recording.mp3")); smtpCient.Send(message); } var response = new TwilioResponse(); response.Sms("Ellsworth " + type + " voice-mail notification: From " + request.From, new { to = MyCell, from = ThisNumber }); // "Thank you for calling. I will contact you as soon as possible. " response.Play("/audio/closing.mp3"); response.Hangup(); return(TWiML(response)); }
public void Example_1() { var response = new TwilioResponse(); response.Play("http://foo.com/cowbell.mp3"); Assert.IsTrue(IsValidTwiML(response.ToXDocument())); }
public void Can_Generate_Single_Play() { var response = new TwilioResponse(); response.Play("Hello world"); Assert.IsTrue(IsValidTwiML(response.ToXDocument())); }
public void Can_Generate_Single_Play_And_Attributes() { var response = new TwilioResponse(); response.Play("Hello world", new { loop = 3 }); Assert.IsTrue(IsValidTwiML(response.ToXDocument())); }
// /Voice/HandleRecord public TwiMLResult HandleRecord(VoiceRequest request) { var response = new TwilioResponse(); response.Say("Listen to your recorded message."); response.Play(request.RecordingUrl); response.Say("Goodbye."); return TwiML(response); }
// /Voice public TwiMLResult Index(VoiceRequest request) { var response = new TwilioResponse(); response.Say("Hello. It's me."); response.Play("http://howtodocs.s3.amazonaws.com/ahoyhoy.mp3"); return(TwiML(response)); }
public void Example_1() { var response = new TwilioResponse(); response.Play("http://foo.com/cowbell.mp3"); Assert.True(IsValidTwiML(response.ToXDocument())); }
public ActionResult Play(string recordingUrl) { var response = new TwilioResponse(); response.Play(recordingUrl); return(TwiML(response)); }
public ActionResult BasicWaitExperience() { var response = new TwilioResponse(); response.Play(Url.ContentAbsolute("~/Content/Audio/Basic/Music.mp3")); return(TwiML(response)); }
public ActionResult Here(string CallSid) { var response = new TwilioResponse(); response.Say("You've arrived here. And now some music."); response.Play(Url.ContentAbsolute(false, "/Content/Audio/02-overworld.mp3"), new { loop = "0" }); return(TwiML(response)); }
public void _1_2() { var name = "Monkey"; var response = new TwilioResponse(); response.Say("Hello " + name); response.Play("http://demo.twilio.com/hellomonkey/monkey.mp3"); Assert.IsTrue(IsValidTwiML(response.ToXDocument())); }
public void _1_2() { var name = "Monkey"; var response = new TwilioResponse(); response.Say("Hello " + name); response.Play("http://demo.twilio.com/hellomonkey/monkey.mp3"); Assert.True(IsValidTwiML(response.ToXDocument())); }
// /Voice public TwiMLResult Index(VoiceRequest request) { var response = new TwilioResponse(); response.Say("Hello. It's me.", new {voice = "alice", language = "en-GB"}); response.Play("http://howtodocs.s3.amazonaws.com/ahoyhoy.mp3"); response.BeginGather(new {numDigits = "1", action = "/Voice/HandleGather"}); response.Say("To speak to a real person, press 1.\n" + "Press 2 to record a message for a Twilio educator.\n" + "Press any other key to start over."); response.EndGather(); return TwiML(response); }
public TwiMLResult Index(VoiceRequest request) { // Get information about the incoming call, like the city associated // with the phone number (if Twilio can discover it) var city = request.FromCity; var response = new TwilioResponse(); response.Say($"Never gonna give you up {city}", new { voice = "alice" }); response.Play("https://demo.twilio.com/docs/classic.mp3"); return(TwiML(response)); }
public void _1_4c() { var recordingUrl = "http://example.com/example.mp3"; var response = new TwilioResponse(); response.Say("Thanks for howling... take a listen to what you howled."); response.Play(recordingUrl); response.Say("Goodbye"); Assert.True(IsValidTwiML(response.ToXDocument())); }
public ActionResult WaitInQueue(string CurrentQueueSize, string QueuePosition) { var response = new TwilioResponse(); var context = GlobalHost.ConnectionManager.GetHubContext <Hubs.QueueHub>(); context.Clients.All.reportQueueSize(CurrentQueueSize); response.Say(string.Format("You are number {0} in the queue. Please hold.", QueuePosition)); response.Play("http://demo.brooklynhacker.com/music/ramones.mp3"); return(TwiML(response)); }
public void _1_4a() { var name = "Monkey"; var response = new TwilioResponse(); response.Say("Hello " + name); response.Play("http://demo.twilio.com/hellomonkey/monkey.mp3"); response.BeginGather(new { numDigits = 1, action = "hello-monkey-handle-key.php", method = "POST" }); response.Say("To speak to a real monkey, press 1. Press 2 to record your own monkey howl. Press any other key to start over."); response.EndGather(); Assert.IsTrue(IsValidTwiML(response.ToXDocument())); }
public void _1_4a() { var name = "Monkey"; var response = new TwilioResponse(); response.Say("Hello " + name); response.Play("http://demo.twilio.com/hellomonkey/monkey.mp3"); response.BeginGather(new { numDigits = 1, action = "hello-monkey-handle-key.php", method = "POST" }); response.Say("To speak to a real monkey, press 1. Press 2 to record your own monkey howl. Press any other key to start over."); response.EndGather(); Assert.True(IsValidTwiML(response.ToXDocument())); }
public HttpResponseMessage Start(VoiceRequest request) { var response = new TwilioResponse(); // "Thank you for calling about the home at 1 3 4 West Ellsworth Avenue." response.Play("/audio/thank_you.mp3"); response.Sms("Curtis call notification: From " + request.From, new { to = MyCell, from = ThisNumber }); response.Redirect("menu"); return(TWiML(response)); }
public HttpResponseMessage Menu(VoiceRequest request) { var response = new TwilioResponse(); response.BeginGather(new { action = "menu_selection" }); // "For general information about this property, press 1. " + // "If you are an agent or a broker, and you would like to schedule a viewing, press 2. "+ // "If you are not an agent and would like to schedule a viewing, press 3. " + // "To request more information about the home or to make an offer, press 4." // "For a quicker response, text your question to this number directly." response.Play("/audio/menu.mp3"); response.EndGather(); response.Pause(); response.Redirect("menu"); return(TWiML(response)); }
public HttpResponseMessage Record(VoiceRequest request, CallType type) { var response = new TwilioResponse(); if (request.Digits == "2") { response.Dial(MyCell); return(TWiML(response)); } // "Please leave your message after the beep. Press pound when you are done recording. " response.Play("/audio/record.mp3"); response.Record(new { playBeep = "true", action = "/ivr/record_callback/" + type }); return(TWiML(response)); }
public ActionResult LeaveQueue(string CallSid, string QueueResult) { if (QueueResult == "bridged") { var state = QueueState.Load(CallSid); var response = new TwilioResponse(); if (state.PlayQuizShow == true) { response.Play(""); //end of game tone response.Say("Thanks for playing our game"); } response.Say("a representative is now available. Hold on while we connect you."); return(TwiML(response)); } return(new EmptyResult()); }
protected async Task <List <SarEvent> > StartMultiEventMenu(TwilioResponse response, string pressOnePrompt, bool isContinuation = false) { var activeEvents = await this.eventService.ListActive(); if (activeEvents.Count > 1) { response.SayVoice(Speeches.ActiveEventsTemplate, activeEvents.Count); } if (this.session.EventId != null) { var theEvent = activeEvents.Where(f => f.Id == this.session.EventId).SingleOrDefault(); response.SayVoice(Speeches.CurrentEventTemplate, theEvent == null ? Speeches.UnknownEvent : theEvent.Name); if (this.EventWasChanged && theEvent != null) { if (!string.IsNullOrWhiteSpace(theEvent.OutgoingUrl)) { response.Play(theEvent.OutgoingUrl); } else if (!string.IsNullOrWhiteSpace(theEvent.OutgoingText)) { response.SayVoice(theEvent.OutgoingText); } } } if (isContinuation) { response.SayVoice(Speeches.HangUpOr); } response.SayVoice(Speeches.PressOneTemplate, pressOnePrompt); if (activeEvents.Count > 1) { response.SayVoice(Speeches.PromptSwitchEventTemplate, 2); } return(activeEvents); }
public TwilioResponse Inbound() { var response = new TwilioResponse(); if (settings.WorkingHours != null && settings.WorkingHours.Enabled) { if (!(settings.WorkingHours.From <= DateTime.UtcNow.TimeOfDay && settings.WorkingHours.To >= DateTime.UtcNow.TimeOfDay)) { return(AddVoiceMail(response)); } } if (settings.AvailableOperators.Any()) { if (!string.IsNullOrEmpty(settings.GreetingAudio)) { response.Play(settings.GreetingAudio); } response.Enqueue(settings.Queue.Name, new { method = "GET", action = GetEcho("enqueue"), waitUrl = GetEcho("wait"), waitUrlMethod = "GET" }); } return(AddVoiceMail(response)); }
public HttpResponseMessage Menu_Selection(VoiceRequest request) { var response = new TwilioResponse(); if (request.Digits == "4") { response.Redirect("/ivr/record/" + CallType.Unknown); return(TWiML(response)); } var record = true; var type = CallType.Unknown; response.BeginGather(new { action = "record/" + type }); // "To skip these recordings and leave a message, press 1 at any time. " response.Play("/audio/skip.mp3"); switch (request.Digits) { case ("1"): { // "The house sits on the corner of West Ellsworth and Bannock located in the heart of the historic Baker neighborhood. " + // "There is over 1700 finished square feet in this classic contemporary town-home, built in the 1890s. " + // "The house has been updated with modern finishes, like the walnut cabinets, granite counter-tops and stainless steel appliances. " + // "There are two bedrooms upstairs and a non-conforming master bedroom in the basement that could also serve as a theater room, den or man-cave. " + // "The kitchen has granite counter-tops and new stainless steel appliances. " + // "This location is perfect for urban commuters. It's only a few blocks from the light-rail station, and the zero bus (which runs downtown every 15 minutes). " + // "Located two blocks off Broadway, the house is a stone's throw from many great restaurants, boutiques, coffee shops and an ice-cream parlor. " + // "Not to mention the thriving nightlife. " + // "There is beautiful hardwood floors, brand-new high-quality carpet, sky lights and two great travertine tiled bathrooms, " + // "one with a full tub the other with a two-person shower. " + // "The asking price is 375 thousand. " response.Play("/audio/description.mp3"); record = false; break; } case ("2"): { // "This house is for sale by owner. The owner will work with buyers agents. " + // "To gain access to the home, please leave a message with your full name, company name, mobile number, buyers name and the date and time you would like to view the home. " + // "When approved, you will receive a text with the lock-box access code. " response.Play("/audio/agents.mp3"); type = CallType.Agent; break; } case ("3"): { // "To schedule a viewing please leave a message with your full name, drivers license number, cell-phone number and the date and time you would like to view the home. " + // "When approved, you will receive a text with the lock-box access code. "+ // "To speak directly to the owner, press 2. " response.Play("/audio/non-agent.mp3"); type = CallType.NonAgent; break; } case ("4"): { type = CallType.Request; break; } } response.EndGather(); response.Redirect(record ? "/ivr/record/" + type : "menu"); return(TWiML(response)); }
public void _1_4c() { var recordingUrl = "http://example.com/example.mp3"; var response = new TwilioResponse(); response.Say("Thanks for howling... take a listen to what you howled."); response.Play(recordingUrl); response.Say("Goodbye"); Assert.IsTrue(IsValidTwiML(response.ToXDocument())); }
private TwilioResponse AddVoiceMail(TwilioResponse response) { return(settings.VoiceMail == null || !settings.VoiceMail.Enabled ? response : response.Play(settings.VoiceMail.Url).Record(new { method = "GET", action = GetEcho("voiceMail"), maxLength = settings.VoiceMail.TimeOut })); }
private TwilioResponse AddVoiceMail(TwilioResponse response) { return(string.IsNullOrEmpty(settings.VoiceMail) ? response.Say("") : response.Play(EncodePlay(settings.VoiceMail)).Record(new { method = "POST", action = GetEcho("voiceMail"), maxLength = 30 })); }