Esempio n. 1
0
        public IActionResult Index()
        {
            var voiceResponse = new VoiceResponse();

            voiceResponse.Say("您好這邊是裕融企業", VoiceEnum.Alice, null, Say.LanguageEnum.ZhTw);

            var message = $"請問您是溫家宏先生嗎 請回答是或否謝謝";

            voiceResponse.Say(message, VoiceEnum.Alice, null, Say.LanguageEnum.ZhTw);

            Gather gather = new Gather(
                numDigits: 1,
                input: new List <InputEnum> {
                InputEnum.Speech
            },
                language: Twilio.TwiML.Voice.Gather.LanguageEnum.CmnHantTw,
                hints: "是,否",
                speechTimeout: "1",
                partialResultCallback: new Uri("https://conversationtemplate.azurewebsites.net/STT"),
                partialResultCallbackMethod: HttpMethod.Post,
                action: new Uri("https://conversationtemplate.azurewebsites.net/VoiceTest/Speechmessage"),
                method: HttpMethod.Post);

            voiceResponse.Append(gather);

            voiceResponse
            .Say("這是Gather的句子", VoiceEnum.Alice, null, Say.LanguageEnum.ZhTw);

            return(TwiML(voiceResponse));
        }
Esempio n. 2
0
        public IActionResult Gather(string digits)
        {
            var response = new VoiceResponse();

            // If the user entered digits, process their request
            if (!string.IsNullOrEmpty(digits))
            {
                switch (digits)
                {
                case "1":
                    response.Say("You selected sales. Good for you!");
                    break;

                case "2":
                    response.Say("You need support. We will help!");
                    break;

                default:
                    response.Say("Sorry, I don't understand that choice.").Pause();
                    response.Redirect(new Uri("https://conversationtemplate.azurewebsites.net/VoiceTest"));
                    break;
                }
            }
            else
            {
                // If no input was sent, redirect to the /voice route
                response.Redirect(new Uri("https://conversationtemplate.azurewebsites.net/VoiceTest"));
            }

            return(TwiML(response));
        }
Esempio n. 3
0
        public IActionResult Index1(string digits)
        {
            var response = new VoiceResponse();

            if (!string.IsNullOrEmpty(digits))
            {
                switch (digits)
                {
                case "1":
                    response.Say("Good for you!");
                    break;

                case "2":
                    response.Say("Excellent!");
                    break;

                default:
                    response.Say("Sorry, I don't understand that choice.").Pause();
                    response.Redirect(new Uri($"{_settings.Path}/gather"), HttpMethod.Get);
                    break;
                }
            }
            else
            {
                response.Redirect(new Uri($"{_settings.Path}/gather"), HttpMethod.Get);
            }

            return(TwiML(response));
        }
        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"));
        }
Esempio n. 5
0
    public ActionResult Gather(string digits)
    {
        var response = new VoiceResponse();

        // If the user entered digits, process their request
        if (!string.IsNullOrEmpty(digits))
        {
            switch (digits)
            {
            case "1":
                response.Say("You selected sales. Good for you!");
                break;

            case "2":
                response.Say("You need support. We will help!");
                break;

            default:
                response.Say("Sorry, I don't understand that choice.").Pause();
                response.Redirect("/voice");
                break;
            }
        }
        else
        {
            // If no input was sent, redirect to the /voice route
            response.Redirect("/voice");
        }

        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);
                // bool isExist = memoryCache.TryGetValue(AccountSid, out call);
                if (call != null)
                {
                    var gather = new Gather(action: new Uri(Auth.UrlPath + "/api/connect/"));
                    gather.Say("Spinga un numero per accettare la chiamata da GIupiter.com", voice: "alice", language: "it-IT");
                    response.Append(gather);
                    response.Say("Grazie Arrivederci!", voice: "alice", language: "it-IT");
                    response.Hangup();
                }
                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"));
        }
        public TwiMLResult Post()
        {
            var digits   = Request.Form["Digits"];
            var response = new VoiceResponse();

            if (digits == "1")
            {
                response.Say("Connecting you to sales");
                var dial = new Dial();
                dial.Number("+15554433222");
                response.Append(dial);
            }
            else if (digits == "2")
            {
                response.Say("Connecting you to support");
                var dial = new Dial();
                dial.Number("+15559988777");
                response.Append(dial);
            }
            else
            {
                response.Say("Sorry, that choice is invalid.");
                response.Redirect(method: Twilio.Http.HttpMethod.Get, url: new Uri("/api/voice"));
            }

            return(TwiML(response));
        }
        public TwiMLResult Call(string agentId, string dialCallStatus)
        {
            if (dialCallStatus == "completed")
            {
                var emptyResponse = new XDocument(new XElement("Root", ""));
                return(new TwiMLResult(emptyResponse));
            }

            var response = new VoiceResponse();

            response.Say(
                body: "It appears that no agent is available. " +
                "Please leave a message after the beep",
                language: "en-GB",
                voice: "alice"
                );

            response.Record(
                maxLength: 20,
                playBeep: true,
                action: Url.Action("Hangup"),
                transcribeCallback: Url.Action("Create", "Recording", new { agentId })
                );

            response.Say(
                body: "No record received. Goodbye",
                language: "en-GB",
                voice: "alice"
                );

            response.Hangup();

            return(TwiML(response));
        }
Esempio n. 9
0
        public TwiMLResult ReviewSize1(string digits)
        {
            var response          = new VoiceResponse();
            ReviewRepository repo = new ReviewRepository();
            Size             size = repo.FindSizeBySizeCodeForProduct(digits, (int)Session["OrderDetailID"]);

            if (!repo.DoesSizeExist(digits))
            {
                response.Say("invalid size code, please try again", voice: "alice", language: "en-US");
                response.Redirect("/Review/EditSize1");
            }
            else if (size == null)
            {
                response.Say("Product not available in this size, please try again", voice: "alice", language: "en-US");
                response.Redirect("/Review/EditSize1");
            }
            else if (repo.DoesItemExistInOrder(digits, (int)Session["OrderDetailID"]))
            {
                response.Say("you already have this item in size " + size.Size1 + " in your order, to make changes to that item find it from the review menu "
                             + " and edit it.", voice: "alice", language: "en-US");
                response.Redirect("/Review/ReviewOptions");
            }
            else if (repo.OutOfStock((int)Session["OrderDetailID"], 0, size.SizeID))
            {
                response.Say("I'm sorry but you can't change the size of this item, since there is not enough stock in the size you chose", voice: "alice", language: "en-US");
                response.Redirect("/Review/ReviewOptions");
            }
            else
            {
                response.Gather(new Gather(action: "/Review/ConfirmSize1?sizeId=" + size.SizeID + "&sizeCode=" + size.SizeCode, numDigits: 1)
                                .Say("you have chosen to update the size to, " + size.Size1 + " , to enter the size again, press 1. to confirm press 2.", voice: "alice", language: "en-US"));
                response.Redirect("/Review/ReviewSize1?digits=" + digits);
            }
            return(TwiML(response));
        }
        public TwiMLResult ProccessPayment(string ccInfo, string expDate, string code)
        {
            var response = new VoiceResponse();
            var total    = new ReviewRepository().GettotalAmountOwed((int)Session["orderId"]);
            var repo     = new CheckoutRepository(ccInfo, expDate, total, code, (int)Session["orderId"]);
            var record   = repo.SubmitPayment();

            if (record.Result == 0)
            {
                repo.RecordPayment((int)Session["orderId"], record.Amount.Value);
                response.Say("Thank you, your payment was successful. Thank you for placing your order. Goodbye", voice: "alice", language: "en-US");
                response.Hangup();
            }
            else if (record.Result == 1)
            {
                response.Say("The charge dit not go through. the response was, " + record.ResultMessage + ". Please try again.", voice: "alice", language: "en-US");
                response.Redirect("/checkout/EnterCCInfo");
            }
            else if (record.ErrorMessage != null)
            {
                response.Say(record.ErrorMessage + ". Please try again.", voice: "alice", language: "en-US");
                response.Redirect("/checkout/EnterCCInfo");
            }
            return(TwiML(response));
        }
Esempio n. 11
0
        public TwiMLResult ConfirmQuantity1(string digits, int qty)
        {
            var response = new VoiceResponse();

            if (digits == "1")
            {
                response.Redirect("/Review/EditQuantity1");
            }
            else if (digits == "2")
            {
                ReviewRepository repo = new ReviewRepository();
                repo.UpdateQuantity(qty, (int)Session["OrderDetailID"]);
                response.Say("Quantity successfully updated.", voice: "alice", language: "en-US");
                response.Redirect("/Review/ReviewOptions");
            }
            else if (digits == "3")
            {
                ReviewRepository repo = new ReviewRepository();
                repo.UpdateQuantity(qty, (int)Session["OrderDetailID"]);
                response.Say("Quantity successfully updated.", voice: "alice", language: "en-US");
                response.Redirect("/Review/EditSize1");
            }
            else
            {
                response.Say("Invalid choice", voice: "alice", language: "en-US");
                response.Redirect("/Review/ReviewQuantity1?digits=" + qty.ToString());
            }
            return(TwiML(response));
        }
Esempio n. 12
0
        public TwiMLResult ConfirmDelete(string digits)
        {
            var response = new VoiceResponse();

            if (digits == "1")
            {
                ReviewRepository repo = new ReviewRepository();
                repo.DeleteOrderDetail((int)Session["OrderDetailID"]);
                response.Say("Item successfully Deleted.", voice: "alice", language: "en-US");
                response.Redirect("/Review/ReviewEntireOrder");
            }
            else if (digits == "2")
            {
                response.Say("Delete canceled.", voice: "alice", language: "en-US");
                int x = (int)Session["Index"];
                x++;
                Session["Index"] = x;
                response.Redirect("/Review/ReviewEntireOrder");
            }
            else
            {
                response.Say("Invalid choice", voice: "alice", language: "en-US");
                response.Redirect("/Review/ChooseDelete");
            }
            return(TwiML(response));
        }
Esempio n. 13
0
        public TwiMLResult ReviewEntireOrder()
        {
            var response                    = new VoiceResponse();
            ReviewRepository   repo         = new ReviewRepository();
            List <OrderDetail> orderDetails = repo.GetOrderDetailsByOrderId((int)Session["orderId"]);

            if (orderDetails.Count == 0)
            {
                response.Say("We could not find any items in this order", voice: "alice", language: "en-US");
                response.Redirect("/Review/ReviewOptions");
            }
            else if ((int)Session["Index"] == orderDetails.Count)
            {
                response.Say("there are no more items to review", voice: "alice", language: "en-US");
                response.Redirect("/Review/ReviewOptions");
            }
            else
            {
                Session["OrderDetailID"] = orderDetails[(int)Session["Index"]].OrderDetailID;
                response.Gather(new Gather(action: "/Review/ChooseEdit", numDigits: 1)
                                .Say("you chose " + orderDetails[(int)Session["Index"]].Quantity + ", " + orderDetails[(int)Session["Index"]].Product.Description + ", size " + orderDetails[(int)Session["Index"]].Size.Size1
                                     + ". to change the quantity press 1, to change the size press 2, to delete this item from your cart "
                                     + "press 3, to hear the next item in your cart press 4, to checkout press 5, to return to the previous menu press 6, to return to "
                                     + "the main menu press 7.", voice: "alice", language: "en-US"));
                response.Redirect("/Review/ReviewEntireOrder");
            }
            return(TwiML(response));
        }
Esempio n. 14
0
        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));
        }
Esempio n. 15
0
    public ActionResult Index(string digits)
    {
        var response = new VoiceResponse();

        if (!string.IsNullOrEmpty(digits))
        {
            switch (digits)
            {
            case "1":
                response.Say("You selected sales. Good for you!");
                break;

            case "2":
                response.Say("You need support. We will help!");
                break;

            default:
                response.Say("Sorry, I don't understand that choice.").Pause();
                RenderMainMenu(response);
                break;
            }
        }
        else
        {
            // If no input was sent, use the <Gather> verb to collect user input
            RenderMainMenu(response);
        }

        return(Content(response.ToString(), "text/xml"));
    }
        public ActionResult Gather(string digits)
        {
            var response = new VoiceResponse();

            // If the user entered digits, process their request
            if (!string.IsNullOrEmpty(digits))
            {
                switch (digits)
                {
                case "1":
                    response.Say("<Hangup/>");
                    break;

                default:
                    response.Say("Sorry, I don't understand that choice.").Pause();
                    //response.Redirect("/voice");
                    break;
                }
            }
            else
            {
                // If no input was sent, redirect to the /voice route
                //  response.Redirect("/voice");
            }

            return(View(new AddressBookModel()));
        }
Esempio n. 17
0
        public async Task <ActionResult> InboundVoice([FromQuery] TwilioGatherRequest request)
        {
            if (request == null || string.IsNullOrWhiteSpace(request.To) || string.IsNullOrWhiteSpace(request.From))
            {
                return(BadRequest());
            }

            var response     = new VoiceResponse();
            var departmentId = await _departmentSettingsService.GetDepartmentIdByTextToCallNumberAsync(request.To.Replace("+", ""));

            if (departmentId.HasValue)
            {
                var authroized = await _limitsService.CanDepartmentProvisionNumberAsync(departmentId.Value);


                request.From.Replace("+", "");
                if (authroized)
                {
                    var department = await _departmentsService.GetDepartmentByIdAsync(departmentId.Value, false);

                    UserProfile profile = null;
                    profile = await _userProfileService.GetProfileByMobileNumberAsync(request.From.Replace("+", ""));

                    if (profile == null)
                    {
                        profile = await _userProfileService.GetProfileByHomeNumberAsync(request.From.Replace("+", ""));
                    }

                    if (department != null && profile != null)
                    {
                        StringBuilder sb = new StringBuilder();
                        sb.Append($@"Hello {profile.FirstName}, this is the Automated Voice System for {department.Name}. Please select from the following options. 
											To list current active calls press 1, 
											To list current user statuses press 2, 
											To list current unit statuses press 3, 
											To list upcoming Calendar events press 4,
											To list upcoming Shifts press 5"                                            );

                        response.Say(sb.ToString());
                    }
                    else
                    {
                        response.Say("Thank you for calling Raesgrid, the only complete software solution for first responders, automated personnel system. The number you called is not tied to an active department or the department doesn't have this feature enabled. Goodbye.").Hangup();
                    }
                }
                else
                {
                    response.Say("Thank you for calling Raesgrid, the only complete software solution for first responders, automated personnel system. The number you called is not tied to an active department or the department doesn't have this feature enabled. Goodbye.").Hangup();
                }
            }
            else
            {
                response.Say("Thank you for calling Raesgrid, the only complete software solution for first responders, automated personnel system. The number you called is not tied to an active department or the department doesn't have this feature enabled. Goodbye.").Hangup();
            }

            //return Request.CreateResponse(HttpStatusCode.OK, response.Element, new XmlMediaTypeFormatter());
            return(Ok(new StringContent(response.ToString(), Encoding.UTF8, "application/xml")));
        }
    // /Voice/HandleRecord
    public ActionResult HandleRecord()
    {
        var response = new VoiceResponse();

        response.Say("Listen to your recorded message.");
        response.Play(Request.Form["RecordingUrl"]);
        response.Say("Goodbye.");
        return(Content(response.ToString(), "text/xml"));
    }
Esempio n. 19
0
    static void Main()
    {
        var response = new VoiceResponse();

        response.Say("I will pause 10 seconds starting now!");
        response.Pause(length: 10);
        response.Say("I just paused 10 seconds");

        System.Console.WriteLine(response.ToString());
    }
        /// <summary>
        /// Builds an instance.
        /// </summary>
        /// <returns>A new instance of the VoiceResponse</returns>
        public VoiceResponse Build()
        {
            var response = new VoiceResponse();

            response.Say(_question.Body);
            response.Say(QuestionTypeToMessage[_question.Type]);
            AddRecordOrGatherCommands(response);

            return(response);
        }
Esempio n. 21
0
        public IActionResult Speechmessage(string SpeechResult)
        {
            var response = new VoiceResponse();
            var language = Say.LanguageEnum.ZhTw;

            //_logger.LogTrace(SpeechResult);
            //_logger.LogDebug(SpeechResult);
            _logger.LogInformation("Information  是否是本人 log SpeechResult ==========================================> " + SpeechResult);
            //_logger.LogWarning(SpeechResult);
            //_logger.LogError(SpeechResult);
            //_logger.LogCritical(SpeechResult);


            //string pattern = ("是");
            //Match match = Regex.Match(SpeechResult, pattern);
            //if (match.Success)

            switch (SpeechResult)
            {
            case "是":
                response.Say("溫家宏先生您好", VoiceEnum.Alice, null, language);

                Gather gather = new Gather(
                    input: new List <InputEnum> {
                    InputEnum.Speech
                },
                    language: Twilio.TwiML.Voice.Gather.LanguageEnum.CmnHantTw,
                    hints: "是,否",
                    speechTimeout: "1",
                    partialResultCallback: new Uri("https://conversationtemplate.azurewebsites.net/STT"),
                    partialResultCallbackMethod: HttpMethod.Post,
                    action: new Uri("https://conversationtemplate.azurewebsites.net/VoiceTest/SpeechSecond"),
                    method: HttpMethod.Post).Say("請問您本期因繳款想以繳清了嗎 請回答是或否謝謝", VoiceEnum.Alice, null, language);

                response.Append(gather);

                break;

            case "否":
                response.Say("很抱歉打擾您了", VoiceEnum.Alice, null, language);
                break;

            default:
                break;
            }


            response.Say("您好,這邊是裕融企業資訊中心,您聽到的是中文音訊測試", VoiceEnum.Alice, null, language);

            //Trace.Listeners.Add(new TextWriterTraceListener("SpeechResultOutput.log", "SpeechListener"));
            //Trace.TraceInformation(SpeechResult);
            //Trace.Flush();

            return(TwiML(response));
        }
Esempio n. 22
0
    static void Main()
    {
        var response = new VoiceResponse();

        response
        .Say("Please leave a message at the beep.\nPress the star key when finished.");
        response.Record(action: new Uri("http://foo.edu/handleRecording.php"),
                        method: HttpMethod.Get, maxLength: 20, finishOnKey: "*");
        response.Say("I did not receive a recording");

        Console.WriteLine(response.ToString());;
    }
Esempio n. 23
0
        public IActionResult Hello()
        {
            var response = new VoiceResponse();

            response.Say("Hello there! You have successfully configured a web hook.");
            response.Say("Good luck on your Twilio quest!", Say.VoiceEnum.Woman);
            return(new ContentResult
            {
                ContentType = "text/xml",
                Content = response.ToString(),
                StatusCode = 200
            });
        }
        public TwiMLResult VerifyCustomer(string phoneNumber, string digits)
        {
            var response = new VoiceResponse();

            if (digits == "2")
            {
                return(TwiML(response.Redirect("/Welcome/GetCustomer", method: "GET")));
            }

            else if (digits == "1")
            {
                SalesRepository repo     = new SalesRepository();
                Customer        customer = repo.FindCustomerByPhoneNumber(phoneNumber);
                if (customer != null)
                {
                    Order order = repo.GetOrderByCustomerId(customer.CustomerID);
                    if (order != null)
                    {
                        response.Say("we found an order associated with this phone number, you will now be redirected to the review option", voice: "alice", language: "en-US");
                        Session["customerId"] = customer.CustomerID;
                        Session["orderId"]    = order.OrderID;
                        response.Redirect("/Review/CheckForBalanceOwed");
                        return(TwiML(response));
                    }
                    else
                    {
                        Order o = new Order
                        {
                            CustomerID      = customer.CustomerID,
                            OrderDate       = DateTime.Now,
                            TotalQuantity   = 0,
                            TotalCost       = 0,
                            TotalAmountPaid = 0
                        };
                        repo.CreateOrder(o);
                        Session["orderId"] = o.OrderID;
                        return(ChooseItem());
                    }
                }
                else
                {
                    response.Say("Please record your name and address after the beep. press the pound key when you are done", voice: "alice", language: "en-US");
                    response.Record(action: "/Welcome/CaptureRecording?phoneNumber=" + phoneNumber, finishOnKey: "#");
                    return(TwiML(response));
                }
            }
            else
            {
                return(TwiML(response.Say("Invalid choice").Redirect("/Welcome/VerifyNumber?digits=" + phoneNumber)));
            }
        }
    public ActionResult Index(BodyData bodyData)
    {
        string recordingUrl = bodyData.RecordingUrl;

        Console.WriteLine(recordingUrl);

        var response = new VoiceResponse();

        response.Say("Thanks for howling... take a listen to what you howled.");
        response.Play(new Uri(recordingUrl));
        response.Say("Goodbye.");

        return(TwiML(response));
    }
Esempio n. 26
0
        public void GenerateTwiml(string meaage)
        {
            var voice = new VoiceResponse();

            voice.Say(meaage);
            Console.WriteLine(voice.ToString());
        }
Esempio n. 27
0
        public TwiMLResult ConfirmItem(int pID, decimal price, int itemCode, string digits)
        {
            var response = new VoiceResponse();

            if (digits == "1")
            {
                SalesRepository repo = new SalesRepository();
                OrderDetail     od   = new OrderDetail
                {
                    OrderID   = (int)Session["orderId"],
                    ProductID = pID,
                    SizeID    = 32,
                    Quantity  = 1,
                    Price     = price
                };
                repo.CreateOrderDetail(od, (int)Session["orderId"]);
                Session["orderDetailId"] = od.OrderDetailID;
                response.Redirect("/Sales/ChooseSize?pID=" + pID);
            }
            else if (digits == "2")
            {
                response.Redirect("/Welcome/ChooseItem");
            }
            else
            {
                response.Say("Invalid choice", voice: "alice", language: "en-US");
                response.Redirect("/Sales/Choose?digits=" + pID);
            }
            return(TwiML(response));
        }
Esempio n. 28
0
    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"));
    }
Esempio n. 29
0
        public LaMLResult Post(VoiceRequest request)
        {
            var response = new VoiceResponse();

            response.Say($"Welcome. Are you from {request.FromCity}?");
            return(LaML(response));
        }
Esempio n. 30
0
        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"));
        }