public async Task <ActionResult> AuthenticateUser(string digits, string from)
        {
            var values = new Dictionary <string, string>
            {
                { "mobileNumber", from },
                { "secretKey", digits }
            };
            HttpResponseMessage httpResponse = await _webAPIRequest.PostAsAJson("http://localhost:3000/v1/customers/authorize", values);

            var isAuthenticated = JToken.Parse(httpResponse.Content.ReadAsStringAsync().Result);
            var response        = new VoiceResponse();

            if (string.Equals("true", Convert.ToString(isAuthenticated["status"]), StringComparison.OrdinalIgnoreCase))
            {
                var gather = new Gather(action: Url.ActionUri("WalletOptions", "Menu"), numDigits: 10, maxSpeechTime: 120);
                gather.Say("Your number is" + from + " Press 1 to Check your Balance. Press 2 to transfer your wallet money");
                response.Append(gather);
            }
            else
            {
                var gather = new Gather(action: Url.ActionUri("AuthenticateUser", "Menu"), numDigits: 6, maxSpeechTime: 120);
                gather.Say("Oops, incorrect secret key. Please enter your secret key to begin the transaction");
                response.Append(gather);
            }
            return(TwiML(response));
        }
Exemple #2
0
        public async Task <ActionResult> Create(string phoneNumber)
        {
            var url = $"{_customRequest.Url}{Url.ActionUri("Record", "Recordings")}";

            await _client.Call(phoneNumber, _phoneNumbers.Twilio, url);

            return(new EmptyResult());
        }
        public TwiMLResult GetAccountDetails()
        {
            var response = new VoiceResponse();
            var gather   = new Gather(action: Url.ActionUri("GetEndUserMobileNo", "Menu"), finishOnKey: "#", maxSpeechTime: 120);

            gather.Say("Enter the mobile number of a person whom you want to transfer money followed by #");
            response.Append(gather);

            return(TwiML(response));
        }
        public TwiMLResult Welcome()
        {
            var response = new VoiceResponse();
            var gather   = new Gather(action: Url.ActionUri("AuthenticateUser", "Menu"), numDigits: 6, maxSpeechTime: 120);

            gather.Say("Please enter your secret key to begin the transaction");
            response.Append(gather);

            return(TwiML(response));
        }
Exemple #5
0
        public ActionResult Record()
        {
            var response = new VoiceResponse();

            response
            .Say("Please record your message after the beep. Press star to end your recording.")
            .Record(finishOnKey: "*", action: Url.ActionUri("Hangup", "Recordings"));

            return(TwiML(response));
        }
Exemple #6
0
        public TwiMLResult Welcome()
        {
            var response = new VoiceResponse();
            var gather   = new Gather(action: Url.ActionUri("Show", "Menu"), numDigits: 1);

            gather.Say("Thank you for calling the Office of Personnel Management," +
                       "Press 1 to create a support ticket, press 2 to connect to your support agent.");
            response.Append(gather);

            return(TwiML(response));
        }
Exemple #7
0
        private TwiMLResult Planets1()
        {
            var response = new VoiceResponse();
            var gather   = new Gather(action: Url.ActionUri("Interconnect", "PhoneExchange"), numDigits: 1);

            gather.Say("Connecting your to your agent now ..., please wait ",
                       voice: "alice", language: "en-GB", loop: 1);

            response.Append(gather);
            return(TwiML(response));
        }
Exemple #8
0
        public TwiMLResult Welcome()
        {
            var response = new VoiceResponse();
            var gather   = new Gather(action: Url.ActionUri("Show", "Menu"), numDigits: 1);

            gather.Say("Thank you for calling the E.T. Phone Home Service - the " +
                       "adventurous alien's first choice in intergalactic travel. " +
                       "Press 1 for directions, press 2 to make a call.");
            response.Append(gather);

            return(TwiML(response));
        }
Exemple #9
0
        public TwiMLResult RedirectWelcome()
        {
            var response = new VoiceResponse();

            response.Say("Returning to the main menu",
                         voice: "alice",
                         language: "en-US"
                         );
            response.Redirect(Url.ActionUri("Welcome", "IVR"));

            return(TwiML(response));
        }
Exemple #10
0
        public ActionResult Join()
        {
            var response = new VoiceResponse();

            response.Say("You are about to join the Rapid Response conference");
            response.Append(new Gather(action: Url.ActionUri("Connect", "Conference"))
                            .Say("Press 1 to join as a listener")
                            .Say("Press 2 to join as a speaker")
                            .Say("Press 3 to join as the moderator"));

            return(TwiML(response));
        }
        public TwiMLResult ProcessPayment(string id, string digits)
        {
            var response = new VoiceResponse();
            var gather   = new Gather(action: Url.ActionUri("ConfirmPayment/" + id + "#" + digits, "Menu"), finishOnKey: "#");

            response.Say("You are paying amount of " + digits + " to " + id,
                         voice: "alice", language: "en-GB");
            gather.Say("Press 1 to Confirm, Press 2 to go back");
            response.Append(gather);

            return(TwiML(response));
        }
        private TwiMLResult Planets()
        {
            var response = new VoiceResponse();
            var gather   = new Gather(action: Url.ActionUri("Interconnect", "PhoneExchange"), numDigits: 1);

            gather.Say("To call the planet Broh doe As O G, press 2. To call the planet " +
                       "DuhGo bah, press 3. To call an oober asteroid to your location, press 4. To " +
                       "go back to the main menu, press the star key ",
                       voice: "alice", language: "en-GB", loop: 3);
            response.Append(gather);

            return(TwiML(response));
        }
Exemple #13
0
        private TwiMLResult Planets()
        {
            var response = new VoiceResponse();
            var gather   = new Gather(action: Url.ActionUri("Interconnect", "PhoneExchange"), numDigits: 1);

            gather.Say("Press 4 to reach out to the OPM Helpdesk, " +
                       "Press 5 to reach out to the OPM Retirement Information Center, " +
                       "Press 6 to reach out to the OPM Retirement Services, " +
                       "Press the star key to go back to the main menu. ",
                       voice: "alice", language: "en-GB", loop: 1);
            response.Append(gather);
            return(TwiML(response));
        }
 public async Task <TwiMLResult> WalletOptions(string from, string digits)
 {
     if (digits == "1")
     {
         return(await GetWalletBalance(from));
     }
     else
     {
         var response = new VoiceResponse();
         var gather   = new Gather(action: Url.ActionUri("GetEndUserMobileNo", "Menu"), finishOnKey: "#", maxSpeechTime: 120);
         gather.Say("Enter the mobile number of a person whom you want to transfer money followed by #");
         response.Append(gather);
         return(TwiML(response));
     }
 }
        public TwiMLResult GetEndUserMobileNo(string digits, string from)
        {
            var response = new VoiceResponse();

            if (digits == from)
            {
                response.Say("Oops! You entered your number instead. Try again.");
                return(GetAccountDetails());
            }

            var gather = new Gather(action: Url.ActionUri("ProcessPayment/" + digits, "Menu"), finishOnKey: "#");

            gather.Say("Please enter the amount you want to transfer followed by #");
            response.Append(gather);

            return(TwiML(response));
        }
Exemple #16
0
        public async Task <ActionResult> Index(string to)
        {
            var from      = Request["From"];
            var to1       = Request["To"];
            var callsid   = Request["CallSid"];
            var patientid = Request["PatientID"];
            var liaisonId = Request["LiaisonID"];
            //var fromcode = Request["CallerCountry"];
            //var tocode = Request["ToCountry"];
            //var UserManager = new UserManager<ApplicationUser>(new UserStore<ApplicationUser>(_db));
            //ApplicationUser currentUser = UserManager.FindById(User.Identity.GetUserId());
            var callerid = ConfigurationManager.AppSettings["TwilioCallerId"];

            try
            {
                var callHistory = new CallHistory()
                {
                    To           = to,
                    From         = from,
                    PatientID    = Convert.ToInt32(patientid),
                    TwilioCallId = callsid,
                    Direction    = "Outgoing",
                    LiaisonId    = Convert.ToInt32(liaisonId)
                };
                _db.CallHistories.Add(callHistory);
                _db.SaveChanges();
            }
            catch (Exception ex)
            {
                WriteErrorLog(ex);
            }
            try
            {
                var Calleridnew = Request["From"];
                if (!string.IsNullOrEmpty(Calleridnew))
                {
                    callerid = Calleridnew;
                }
            }
            catch (Exception ex)
            {
                WriteErrorLog(ex);
            }
            if (!string.IsNullOrEmpty(to))
            {
                return(Content(new VoiceResponse()
                               .Dial(new Dial(callerId: callerid,
                                              record: "Record-from-ringing", recordingStatusCallback: Url.ActionUri("SaveRecordings", "Voice"), recordingStatusCallbackMethod: Twilio.Http.HttpMethod.Post).Number(to)).ToString(), "text/xml"));
            }
            else
            {
                var response = new VoiceResponse();
                response.Say("Thanks for calling!");
                return(Content(response.ToString(), "text/xml"));
            }
        }
Exemple #17
0
        public ActionResult Receive(string CallerName)
        {
            //CallerName = CallerName.Replace("+1", "");
            //CallerName = "Phonenum" + CallerName;
            var from       = Request["From"];
            var to         = Request["To"];
            var callsid    = Request["CallSid"];
            var callaction = Request["action"];
            var digits     = Request["Digits"];
            var steps      = Request["step"];
            var fromcode   = Request["CallerCountry"];
            var tocode     = Request["ToCountry"];
            var callerId   = ConfigurationManager.AppSettings["TwilioCallerId"];

            try
            {
                var liasionid   = _db.Liaisons.AsNoTracking().Where(x => x.TwilioCallerId == to).FirstOrDefault()?.Id;
                var callHistory = new CallHistory()
                {
                    To           = to.Replace(HelperExtensions.TelCodes.Where(x => x.Iso == tocode).FirstOrDefault().Pfx, ""),
                    From         = from.Replace(HelperExtensions.TelCodes.Where(x => x.Iso == fromcode).FirstOrDefault().Pfx, ""),
                    Status       = "Incoming/Not Answer",
                    StartTime    = DateTime.Now,
                    TwilioCallId = callsid,
                    Direction    = "Incoming",
                    LiaisonId    = liasionid ?? 0
                };
                _db.CallHistories.Add(callHistory);
                _db.SaveChanges();
            }
            catch (Exception ex)
            {
                WriteErrorLog(ex);
            }
            //test

            var response = new VoiceResponse();

            if (Request["Digits"] == "0")
            {
                var dial = new Dial(callerId: to, record: "Record-from-answer", action: Url.ActionUri("VoiceMail", "Voice"), recordingStatusCallback: Url.ActionUri("SaveRecordings", "Voice"), recordingStatusCallbackMethod: Twilio.Http.HttpMethod.Post);
                dial.Client(CallerName);

                response.Dial(dial);

                return(TwiML(response));
            }
            else
            {
                //  var dial = new Dial(callerId: to, record: "Record-from-answer");
                var dial = new Dial(record: "Record-from-ringing", recordingStatusCallback: Url.ActionUri("SaveRecordings", "Voice"), recordingStatusCallbackMethod: Twilio.Http.HttpMethod.Post);
                dial.Client(CallerName);
                //dial.Action = new Uri("/Voice/SaveRecordings");
                //dial.Method = Twilio.Http.HttpMethod.Post;
                //var gather = new Gather(action: Url.ActionUri("Receive", "Voice",""), numDigits: 1, method: Twilio.Http.HttpMethod.Post, timeout: 5);
                //gather.Say("Thank you for calling " +
                //           "Press 0 to make a call.", voice: Say.VoiceEnum.Woman, loop: 2);
                response.Append(new Say("Thank you for calling " +
                                        "Please wait we are connecting your call.", voice: Say.VoiceEnum.Woman, loop: 1)).Append(dial).Append(new Say("Please record voice mail after beep if not answer", voice: Say.VoiceEnum.Woman)).Append(new Record(action: Url.ActionUri("VoiceMail", "Voice"), method: Twilio.Http.HttpMethod.Post, timeout: 3, playBeep: true));
                return(TwiML(response));
            }



            //var response = new VoiceResponse();
            //response.Say("Thanks for calling!");

            //return Content(response.ToString(), "text/xml");
        }