public ActionResult Index(VoiceRequest request) { var response = new VoiceResponse(); if (!string.IsNullOrEmpty(request.To)) { var callerId = "+15017250604"; // wrap the phone number or client name in the appropriate TwiML verb // by checking if the number given has only digits and format symbols if (Regex.IsMatch(request.To, "^[\\d\\+\\-\\(\\) ]+$")) { var number = new Dial(callerId: callerId); number.Number(Request.To); response.Dial(number); } else { var number = new Dial(callerId: callerId); number.Client(Request.To); response.Dial(number); } } else { response.Say("Thanks for calling!"); } return(Content(response.ToString(), "text/xml")); }
public ActionResult Index(string to) { var callerId = ConfigurationManager.AppSettings["TwilioCallerId"]; var response = new VoiceResponse(); if (!string.IsNullOrEmpty(to)) { var dial = new Dial(callerId: callerId); // wrap the phone number or client name in the appropriate TwiML verb // by checking if the number given has only digits and format symbols if (Regex.IsMatch(to, "^[\\d\\+\\-\\(\\) ]+$")) { dial.Number(to); } else { dial.Client(to); } response.Dial(dial); } else { response.Say("Thanks for calling!"); } return(Content(response.ToString(), "text/xml")); }
public IActionResult Index() { var parameters = ToDictionary(this.Request.Form); var response = new VoiceResponse(); string CallSid = ""; parameters.TryGetValue("CallSid", out CallSid); if (!String.IsNullOrWhiteSpace(CallSid)) { Call call = null; memoryCache.TryGetValue(CallSid, out call); if (call != null) { response.Say("Giupiter.com la sta mettendo in contatto.", voice: "alice", language: "it-IT"); response.Dial(call.UserNumber, timeLimit: call.TimeLimit); response.Hangup(); HttpTools.UpdateCall(call, "dtm"); } else { response.Say("Mi spiace c'è stato un errore!", voice: "alice", language: "it-IT"); response.Hangup(); } } else { response.Say("Mi spiace c'è stato un errore cache!", voice: "alice", language: "it-IT"); response.Hangup(); } return(Content(response.ToString(), "application/xml")); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env) { DayOfWeek[] days = Configuration.GetValue <string>("Days", "1, 2, 3, 4, 5, 6").Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries).Select(x => (DayOfWeek)int.Parse(x)).ToArray(); //new DayOfWeek[] { DayOfWeek.Monday, DayOfWeek.Tuesday, DayOfWeek.Wednesday, DayOfWeek.Thursday, DayOfWeek.Friday }; double startHour = Configuration.GetValue <double>("StartHour", 9); double endHour = Configuration.GetValue <double>("EndHour", 18); string[] phoneNumbers = Configuration.GetValue <string>("PhoneNumbers", "").Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); app.Run(async(context) => { VoiceResponse response = new VoiceResponse(); TimeZoneInfo centralZone = TimeZoneInfo.FindSystemTimeZoneById("Central Standard Time"); DateTime currentCentralTime = TimeZoneInfo.ConvertTimeFromUtc(DateTime.UtcNow, centralZone); if ((days.Contains(currentCentralTime.DayOfWeek)) && (currentCentralTime > currentCentralTime.Date.AddHours(startHour)) && (currentCentralTime < currentCentralTime.Date.AddHours(endHour))) { response.Play(null, null, "ww9ww9ww9"); response.Hangup(); } else if (phoneNumbers.Any()) { phoneNumbers.ToList().ForEach(x => { response.Dial(x); }); } else { response.Say("Access Denied"); } context.Response.ContentType = "text/xml"; await context.Response.WriteAsync(response.ToString()); }); }
private TwiMLResult Dial(string phoneNumber) { var response = new VoiceResponse(); response.Dial(phoneNumber); return(TwiML(response)); }
static void Main() { var response = new VoiceResponse(); response.Dial("415-123-4567"); response.Redirect(url: new Uri("http://www.foo.com/nextInstructions")); Console.WriteLine(response.ToString()); }
private TwiMLResult Dial(string phoneNumber) { var response = new VoiceResponse(); response.Say("Connecting your to your agent now ..., please wait ", voice: "alice", language: "en-GB", loop: 1); response.Dial(phoneNumber); return(TwiML(response)); }
static void Main() { var response = new VoiceResponse(); response.Dial("415-123-4567"); response.Say("Goodbye"); Console.WriteLine(response.ToString()); }
static void Main() { var response = new VoiceResponse(); var dial = new Dial(); dial.Conference("Room 1234"); response.Dial(dial); System.Console.WriteLine(response.ToString()); }
static void Main() { var response = new VoiceResponse(); response.Dial("415-123-4567", action: new Uri("/handleDialCallStatus"), method: HttpMethod.Get); response.Say("I am unreachable"); Console.WriteLine(response.ToString());; }
static void Main() { var response = new VoiceResponse(); var dial = new Dial(); dial.Number("415-123-4567"); response.Dial(dial); System.Console.WriteLine(response.ToString()); }
static void Main() { var response = new VoiceResponse(); var dial = new Dial(); dial.Sip("sip:[email protected];transport=tcp"); response.Dial(dial); System.Console.WriteLine(response.ToString()); }
static void Main() { var response = new VoiceResponse(); var dial = new Dial(); dial.Client("jenny"); response.Dial(dial); System.Console.WriteLine(response.ToString()); }
static void Main() { var response = new VoiceResponse(); response.Dial("415-123-4567", action: "/handleDialCallStatus.php", method: "GET"); response.Say("I am unreachable"); System.Console.WriteLine(response.ToString()); }
static void Main() { var response = new VoiceResponse(); var dial = new Dial(); dial.Sip("*****@*****.**"); response.Dial(dial); System.Console.WriteLine(response.ToString()); }
static void Main() { var response = new VoiceResponse(); var dial = new Dial(); dial.Conference("Customer Waiting Room", beep: "false"); response.Dial(dial); System.Console.WriteLine(response.ToString()); }
static void Main() { var response = new VoiceResponse(); var dial = new Dial(record: "record-from-ringing"); dial.Sim("DE8caa2afb9d5279926619c458dc7098a8"); response.Dial(dial); System.Console.WriteLine(response.ToString()); }
static void Main() { var response = new VoiceResponse(); var dial = new Dial(callerId: "+15551112222"); dial.Number("+15558675309"); response.Dial(dial); System.Console.WriteLine(response.ToString()); }
static void Main() { var response = new VoiceResponse(); var dial = new Dial(); dial.Conference("SimpleRoom", muted: "true"); response.Dial(dial); System.Console.WriteLine(response.ToString()); }
public static void Main() { var response = new VoiceResponse(); var dial = new Dial(); dial.Sip("sip:[email protected]?mycustomheader=foo&myotherheader=bar"); response.Dial(dial); System.Console.WriteLine(response.ToString()); }
static void Main() { var response = new VoiceResponse(); var dial = new Dial(); dial.Queue("support", url: "about_to_connect.xml"); response.Dial(dial); System.Console.WriteLine(response.ToString()); }
static void Main() { var response = new VoiceResponse(); var dial = new Dial(); dial.Sip("*****@*****.**", username: "******", password: "******"); response.Dial(dial); System.Console.WriteLine(response.ToString()); }
static void Main() { var response = new VoiceResponse(); var dial = new Dial(record: "record-from-ringing-dual", recordingStatusCallback: "www.myexample.com"); dial.Number("+15558675309"); response.Dial(dial); System.Console.WriteLine(response.ToString()); }
static void Main() { var response = new VoiceResponse(); var dial = new Dial(); dial.Conference("NoMusicNoBeepRoom", beep: "false", waitUrl: "", startConferenceOnEnter: "true", endConferenceOnExit: "true"); response.Dial(dial); System.Console.WriteLine(response.ToString()); }
static void Main() { var response = new VoiceResponse(); var dial = new Dial(action: "handleLeaveConference.php", method: "POST", hangupOnStar: "true", timeLimit: 30); dial.Conference("LoveTwilio"); response.Dial(dial); System.Console.WriteLine(response.ToString()); }
static void Main() { var response = new VoiceResponse(); var dial = new Dial(); dial.Conference("NoMusicNoBeepRoom", beep: "false", waitUrl: "http://your-webhook-host.com", startConferenceOnEnter: true, endConferenceOnExit: true); response.Dial(dial); System.Console.WriteLine(response.ToString()); }
static void Main() { var response = new VoiceResponse(); var dial = new Dial(); dial.Conference("moderated-conference-room", startConferenceOnEnter: false); response.Dial(dial); System.Console.WriteLine(response.ToString()); }
static void Main() { var response = new VoiceResponse(); var dial = new Dial(record: "record-from-ringing-dual", recordingStatusCallback: "www.myexample.com"); dial.Conference("myteamroom"); response.Dial(dial); System.Console.WriteLine(response.ToString()); }
public ActionResult CallSecondSenator(int id) { var senator = _senatorsRepository.Find(id); var voiceResponse = new VoiceResponse(); voiceResponse.Say($"Connecting you to {senator.Name}."); voiceResponse.Dial(number: senator.Phone, action: "/callcongress/goodbye"); return(TwiML(voiceResponse)); }
private VoiceResponse AddToResponse(VoiceResponse response, Agent agent) { var dial = new Dial(method: "POST", action: GetEcho("dial"), timeout: agent.TimeOut, record: agent.Record ? "record-from-answer" : "do-not-record"); switch (agent.Answer) { case AnswerType.Number: response.Dial(dial.Number(agent.PhoneNumber, method: "POST", url: GetEcho("client"))); break; case AnswerType.Client: response.Dial(dial.Client(agent.ClientID, "POST", GetEcho("client"))); break; case AnswerType.Sip: response.Dial(dial.Sip(agent.ClientID, method: "POST", url: GetEcho("client"))); break; } return(response); }