Пример #1
1
        public TwilioResponse InitialOptions(VoiceRequest request)
        {
            TwilioResponse response = new TwilioResponse();

              var id = request.Digits;

              if (!directory.ExtensionExists(id))
              {
            response.Say("We couldn't find your I D.");
            response.Hangup();
              }

              response.BeginGather(new { finishOnKey = "#", action = string.Format("/Router/PingInital?callingPartyId={0}", id) });
              response.Say("To contact an individual, enter their 4 digit I D and then press the hash button");
              response.Say("To contact a team, enter star followed by the 4 digit I D and then press the hash button");
              response.EndGather();

              return response;
        }
Пример #2
0
        //
        // GET: /Phone/
        public ActionResult IncomingCall(string CallSid, string FromCity, string FromState, string FromZip, string FromCountry)
        {
            LocationalCall call = (LocationalCall)GetCall(CallSid);
            StateManager.AddNewCall(call);
            StateManager.AddToLog(CallSid, "Incoming call...");
            call.City = FromCity;
            call.Country = FromCountry;
            call.ZipCode = FromZip;
            call.State = FromState;

            TwilioResponse response = new TwilioResponse();
            response.BeginGather(new
            {
                action = Url.Action("ServiceRequest"),
                timeout = 120,
                method = "POST",
                numDigits = 1
            });
            response.Say("Welcome to the Bank of Griff.");
            response.Pause();
            response.Say("Press 1 to manage your account.");
            response.Say("Press 2 to take out a loan.");
            response.Say("Press 3 to talk to a representative.");
            response.Pause();
            response.EndGather();

            return SendTwilioResult(response);
        }
        public TwiMLResult Welcome()
        {
            var response = new TwilioResponse();
            response.BeginGather(new {action = Url.Action("Show", "Menu"), numDigits = "1"})
                .Play("http://howtodocs.s3.amazonaws.com/et-phone.mp3", new {loop = 3})
                .EndGather();

            return TwiML(response);
        }
Пример #4
0
  // helper function to set up a <Gather>
  private static void RenderMainMenu(TwilioResponse response)
  {
    response.BeginGather(new { numDigits = 1 });
    response.Say("For sales, press 1. For support, press 2.");
    response.EndGather();

    // If the user doesn't enter input, loop
    response.Redirect("/voice");
  }
Пример #5
0
        public TwilioResponse GetGreeting(VoiceRequest request)
        {
            string culture = LanguageHelper.GetDefaultCulture();
              var response = new TwilioResponse();

              try
              {
            var lookupPhoneNumber = request.GetOriginatingNumber();

            var knownNumber = profileManager.CheckNumber(lookupPhoneNumber);

            if (knownNumber)
            {
              culture = profileManager.GetCulture(lookupPhoneNumber);
              if (string.IsNullOrEmpty(culture))
              {
            culture = LanguageHelper.GetDefaultCulture();
              }
              else
              {
            culture = LanguageHelper.GetValidCulture(culture);
              }

              IVREntryLang.Culture = new System.Globalization.CultureInfo(culture);
              twiMLHelper = new TwiMLHelper(culture, LanguageHelper.IsImplementedAsMP3(culture));
            }
            else
            {
              twiMLHelper = new TwiMLHelper(LanguageHelper.GetDefaultCulture(), false);
            }

            twiMLHelper.SayOrPlay(response, IVREntryLang.Welcome);

            twiMLHelper.SayOrPlay(response, string.Format(IVREntryLang.PhoneLookup, string.Join(" ", lookupPhoneNumber.ToArray())));

            if (!knownNumber)
            {
              twiMLHelper.SayOrPlay(response, IVREntryLang.PhoneNumberNotFound);
              response.Hangup();
              return response;
            }

            response.BeginGather(new { finishOnKey = "#", action = string.Format("/api/IVRAuthenticate?language={0}", culture) });
            twiMLHelper.SayOrPlay(response, IVREntryLang.EnterPin);
            response.EndGather();

              }
              catch (Exception ex)
              {
            twiMLHelper.SayOrPlay(response, string.Format(IVREntryLang.Error, ex.Message));
            twiMLHelper.SayOrPlay(response, string.Format(IVREntryLang.Error, ex.Message));
            twiMLHelper.SayOrPlay(response, string.Format(IVREntryLang.Error, ex.Message));
            response.Hangup();
              }
              return response;
        }
        public ActionResult Join()
        {
            var response = new TwilioResponse();
            response.Say("You are about to join the Rapid Response conference");
            response.BeginGather(new {action = @Url.Action("Connect")})
                .Say("Press 1 to join as a listener")
                .Say("Press 2 to join as a speaker")
                .Say("Press 3 to join as the moderator")
                .EndGather();

            return TwiML(response);
        }
Пример #7
0
 // /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);
 }
Пример #8
0
        public TwilioResponse Greet(VoiceRequest request)
        {
            TwilioResponse response = new TwilioResponse();

              response.Say("Welcome to Saint Georges Hospital Directory.");

              response.BeginGather(new { finishOnKey = "#", action = "/Router/InitialOptions" });
              response.Say("Please enter your four digit I D then press the hash button");
              response.EndGather();

              return response;
        }
        public ActionResult Gather()
        {
            var response = new TwilioResponse();
            response.BeginGather(new { action=Url.Action("Gather"), method="POST" })
                .Say("Please enter your four digit package ID, followed by the pound sign.");
            response.EndGather();

            response.Say("I'm sorry, I didn't get that.");
            response.Redirect( Url.Action("Gather"), "GET" );

            return TwiML(response);
        }
        public ActionResult Error()
        {
            var response = new TwilioResponse();
            response.Say(string.Format("I'm sorry, there seems to have been a problem locating your package."));

            response.BeginGather(new { action = Url.Action("Complete"), method = "POST" })
                .Say("To speak with an agent, press one.");
            response.EndGather();

            response.Redirect(Url.Action("Goodbye"), "GET");
            return TwiML(response);
        }
        public ActionResult Complete(string s)
        {
            var response = new TwilioResponse();
            response.Say(string.Format("The status of your package is {0}.", s));

            response.BeginGather(new { action = Url.Action("Complete"), method="POST" })
                .Say("To locate another package, press one.");
            response.EndGather();

            response.Redirect( Url.Action("Goodbye"), "GET" );
            return TwiML(response);
        }
        private TwiMLResult Planets()
        {
            var response = new TwilioResponse();
            response.BeginGather(new {action = "/Extension/Connect", numDigits = "1"})
                .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 ",
                     new {voice = "alice", language = "en-GB", loop = "3"})
                .EndGather();

            return TwiML(response);
        }
Пример #13
0
        public HttpResponseMessage IncomingPhone(VoiceRequest call)
        {
            var response = new TwilioResponse();
            response
                .BeginGather(new { action = "http://{{ YOUR URL HERE }}/twilio/response", voice = "woman", numDigits = 1})
                    .Say("Hello there.")
                    .Pause()
                    .Say("Press 1 for customer service.")
                    .Say("Press 2 to hangup")
                .EndGather();

            return Request.CreateResponse(HttpStatusCode.OK, response.Element, new XmlMediaTypeFormatter());
        }
Пример #14
0
  public TwiMLResult Index(VoiceRequest request)
  {
    var response = new TwilioResponse();

    // Use the <Gather> verb to collect user input
    response.BeginGather(new {numDigits = 1});
    response.Say("For sales, press 1. For support, press 2.");
    response.EndGather();

    // If the user doesn't enter input, loop
    response.Redirect("/voice");

    return TwiML(response);
  }
Пример #15
0
        public TwilioResponse GetMainMenu()
        {
            var response = new TwilioResponse();

              response.Say("Main menu.");
              response.BeginGather(new { numDigits = 1, action = "/IVRMain/MainMenuSelection" });
              response.Say("Press one to check messages.");
              response.Say("Press two to listen to old messages.");
              response.Say("Press three to send a voice message to a favourite.");
              response.Say("Press four to listen to voice messages.");
              response.Say("Press five to send a public broadcast.");
              response.Say("Press six to listen public broadcasts.");

              response.EndGather();

              return response;
        }
        private IEnumerable<Twilio.TwiML.TwilioResponse> seq(State s)
        {


            int sum = 0;
            int count = 0;

            var x = new Twilio.TwiML.TwilioResponse();
            x.Say("Hello test 123");
            yield return x;

            do
            {

                var x2 = new Twilio.TwiML.TwilioResponse();
                x2.BeginGather(new { action = "/Voice/Continue/" + s.ID.ToString() })
                    .Say("Enter digits")
                    .EndGather();
                yield return x2;



                var dig = s.Digits;
                int value;
                if (int.TryParse(dig, out value))
                {
                    
                    var xr = new Twilio.TwiML.TwilioResponse();
                    xr.Say("You entered " + dig);
                    yield return xr;

                    sum += value;
                    count++;
                }
                else break;

            } while (true);

            var x3 = new Twilio.TwiML.TwilioResponse();
            x3.Say("You entered "+ count.ToString() + " entries, sum is " + sum.ToString());
            yield return x3;



        }
Пример #17
0
        public HttpResponseMessage AnswerIncomingCall()
        {
            var twilioResponse = new TwilioResponse();
            twilioResponse.BeginGather(
                new
                    {
                        action = Url.Link("ExtendedApi", new {controller = "Phone", action = "HandleConferenceCall"}),
                        numDigits = 1
                    });
            twilioResponse.Say(
                "Welcome to VoxVoi. If you have a conference number, please press 2. Otherwise, please stay on your line.",
                _voicesettings);

            twilioResponse.EndGather();

            twilioResponse.Redirect(
                Url.Link("ExtendedApi", new {controller = "Phone", action = "HandleMenuCall"}),
                "POST");

            return Request.CreateResponse(HttpStatusCode.OK, twilioResponse.Element);
        }
        public ActionResult voice3(string From)
        {
            Demo.LogNumber(From);

            var response = new TwilioResponse();
            response.Say("Hello, and prepare to be frustrated.");
            response.BeginGather(new { finishOnKey = "#", action = "http://onetugdemo.apphb.com/reftwilio/voice4" });
            response.Say("Type in your account number and press pound.");
            response.EndGather();

            return TwiML(response);
        }
Пример #19
0
        public TwilioResponse PreConnect(VoiceRequest request, string callingPartyId)
        {
            var response = new TwilioResponse();

              var callingParty = directory.GetContact(callingPartyId);

              response.BeginGather(new { numDigits = 1, action = "/Router/RespondToPreConnect" });
              response.Say(string.Format("You have an incoming call from {0}", callingParty.Name));
              response.Say("Press 1 to be connected");
              response.Say("Press 2 to hangup");
              response.EndGather();
              response.Hangup();

              return response;
        }
        public ActionResult NotFound()
        {
            var response = new TwilioResponse();
            response.Say(string.Format("I'm sorry, I could not locate your package."));

            response.BeginGather(new { action = Url.Action("Complete"), method = "POST" })
                .Say("To try to locate the package again or to locate another package, press one.")
                .Say("To speak with an agent, press two.");
            response.EndGather();

            response.Redirect(Url.Action("Goodbye"), "GET");
            return TwiML(response);
        }
        public TwiMLResult FirstClientStart(CallContextModel model)
        {
            var response = new TwilioResponse();

            try
            {
                var call = Services.Call.GetByCallSid(Request["CallSid"]);

                // Get info for call context
                model.CallId = call.Id;
                model.ReceiverSid = Request["CallSid"];
                model.ReceiverStatus = Request["CallStatus"];

                // Get first client and second client
                var fromUser = Services.Users.GetUserById(model.CallerId);
                var toUser = Services.Users.GetUserById(model.ReceiverId);

                // Update call status
                Services.Call.UpdateCallStatus(model.CallId, model.ReceiverStatus, false);

                var greeting = string.Empty;

                if (model.IsCustomer) // Customer initiate call >> Consultant called first
                {
                    string template = ConferenceConst.CallMenuForTalkNow;
                    greeting = string.Format(template, fromUser.Name, model.NatureOfEnquiry);
                }
                else // Consultant initiate call >> Customer called first
                {
                    string template = ConferenceConst.CallMenuForSchedule;
                    greeting = string.Format(template, toUser.Name, fromUser.Name, model.NatureOfEnquiry);
                }

                response.BeginGather(new { numDigits = 1, action = Url.Action("FirstClientResponse", model) });
                response.Pause(2);
                response.Say(greeting, new { voice = VoiceInConference, language = LanguageInConference });
                response.EndGather();
                response.Redirect(Url.Action("FirstClientStart", model));
            }
            catch (Exception e)
            {
                // Save Log
                Log.Error("First client start. Error:", e);

                // Error
                response.Say(ConferenceConst.ErrorMessage, new { voice = VoiceInConference, language = LanguageInConference });
                response.Hangup();
            }

            return new TwiMLResult(response);
        }
        public TwiMLResult ConsultantAfterCall(CallContextModel model)
        {
            var response = new TwilioResponse();
            try
            {
                response.BeginGather(new { numDigits = 1, action = Url.Action("ConsultantAfterCallResponse", model) });

                // Check call duration
                var call = Services.Call.GetByCallSid(Request["CallSid"]);
                int startingTime = Convert.ToInt32(Services.SystemConfig.GetByKey(ParamatricBusinessRules.STARTING_TIME.ToString()).Value);

                if (call.Duration <= startingTime)
                {
                    response.Say(ConferenceConst.ConsultantAfterCallNoInvoice, new { voice = VoiceInConference, language = LanguageInConference });
                }
                else
                {
                    response.Say(ConferenceConst.ConsultantAfterCall, new { voice = VoiceInConference, language = LanguageInConference });
                }

                response.EndGather();
                response.Redirect(Url.Action("ConsultantAfterCall", model));
            }
            catch (Exception e)
            {
                // Log
                Log.Error("Consultant after call. Error: ", e);

                // Error
                response.Say(ConferenceConst.ErrorMessage, new { voice = VoiceInConference, language = LanguageInConference });
                response.Hangup();
            }

            return new TwiMLResult(response);
        }
        public TwiMLResult WaiveFeeAction(CallContextModel model)
        {
            var response = new TwilioResponse();
            try
            {
                response.BeginGather(new { numDigits = 1, action = Url.Action("WaiveFeeActionResponse", model) });
                response.Say(ConferenceConst.WaiveFeeAction, new { voice = VoiceInConference, language = LanguageInConference });
                response.EndGather();
                response.Redirect(Url.Action("ConsultantAfterCall", model));
            }
            catch (Exception e)
            {
                // Log
                Log.Error("Waive fee action. Error: ", e);

                // Error
                response.Say(ConferenceConst.ErrorMessage, new { voice = VoiceInConference, language = LanguageInConference });
                response.Hangup();
            }

            return new TwiMLResult(response);
        }
        public ActionResult SecondClientStart(CallContextModel model)
        {
            var response = new TwilioResponse();

            try
            {
                // Get info for call context
                model.CallerSid = Request["CallSid"];
                model.CallerStatus = Request["CallStatus"];

                Services.Call.UpdateCallStatus(model.CallId, model.CallerStatus, true);
                Services.Call.ReceiverHasPickedUp(model.CallId);

                // Get fromUser and toUser
                var fromUser = Services.Users.GetUserById(model.CallerId);
                var toUser = Services.Users.GetUserById(model.ReceiverId);

                var message = string.Empty;
                if (model.IsCustomer)  // Customer initiate call >> Second client and FromUser is customer
                {
                    string template = ConferenceConst.SecondClientStartForTalkNow;
                    message = string.Format(template, fromUser.Name, toUser.Name, model.NatureOfEnquiry);
                }
                else // Consultant initiate call >>  Second client and FromUser is consultant
                {
                    string template = ConferenceConst.SecondClientStartForSchedule;
                    message = string.Format(template, fromUser.Name, toUser.Name);
                }

                response.BeginGather(new { numDigits = 1, action = Url.Action("SecondClientResponse", model) });
                response.Pause(2);
                response.Say(message, new { voice = VoiceInConference, language = LanguageInConference });
                response.EndGather();
                response.Redirect(Url.Action("SecondClientStart", model));
                return new TwiMLResult(response);
            }
            catch (Exception e)
            {
                Log.Error("Second client start. Error: ", e);

                // Error
                response.Say(ConferenceConst.ErrorMessage, new { voice = VoiceInConference, language = LanguageInConference });
                response.Hangup();
            }

            return new TwiMLResult(response);
        }
Пример #25
0
        public HttpResponseMessage ProcessVoiceTicketRequest(SmsRequest twilioRequest)
        {
            var invalidRequestMessage = "We could not understand the key you entered.";

            var error = false;
            var message = default(String);
            var responseContext = default(ConversationContext);
            var conversationState = ConvoCookieHelper.Parse<ConversationState>(ConvoCookieHelper.CONVO_COOKIE_NAME_PHONE, Request.Headers);

            if (conversationState == null)
                conversationState = new ConversationState() { ConversationStep = 1, ConversationName = twilioRequest.Body ?? "voice" };

            var conversation = ConversationRegistry.Get(conversationState.ConversationName);

            if(conversation != null)
            {
                try
                {
                    responseContext = conversation.RunStep(conversationState, twilioRequest.Body ?? "voice");
                    message = responseContext.ResponseMessage;
                }
                catch(Exception ex)
                {
                    message = invalidRequestMessage;
                    error = true;
                    //clearCookie = true;
                }
            }
            else
            {
                message = invalidRequestMessage;
                error = true;
            }

            var twilioResponse = new TwilioResponse();

            if (responseContext.Gather)
            {
                twilioResponse.BeginGather(new { finishOnKey = "#", action = "/api/twilio/voicecontinuation" })
                    .Say(message)
                    .EndGather();
            }
            else
            {
                twilioResponse.Say(message);
            }
            
            var response = TwilioHelper.WrapTwilioResponseInHttpResponse(this, twilioResponse);

            if(conversation.ConvoEnded(conversationState.ConversationStep))
            {
                ConvoCookieHelper.EndConvoCookie(ConvoCookieHelper.CONVO_COOKIE_NAME_PHONE, response.Headers);
            }
            else if (!error)
            {
                // update cookie
                var newCookie = ConvoCookieHelper.GetCookieHeaderValue(ConvoCookieHelper.CONVO_COOKIE_NAME_PHONE, new ConversationState()
                {
                    Context = responseContext,
                    ConversationName = conversationState.ConversationName,
                    ConversationStep = conversationState.ConversationStep + 1
                });

                response.Headers.AddCookies(new CookieHeaderValue[] { newCookie });
            }

            return response;
        }
        public TwilioResponse ListenToBroadcastReplies(VoiceRequest request, int profileId, int lastBroadcastIdx, int subBroadcastIdx)
        {
            var response = new TwilioResponse();

              PublicBroadcast broadcast;

              try
              {
            broadcast = broadcastManager.GetAll().Skip(lastBroadcastIdx).Take(1).FirstOrDefault();
              }
              catch (Exception)
              {
            broadcast = null;
              }

              if (broadcast == null)
              {
            response.Say("Broadcast not found, returning to the main menu");
            response.Redirect(ivrRouteProvider.GetUrlMethod(IVRRoutes.PLAY_MAIN_MENU));

            return response;
              }

              if (broadcast.BroadcastReplies == null || broadcast.BroadcastReplies.Count == 0)
              {
            response.Say("Broadcast has no replies, returning to the main menu");
            response.Redirect(ivrRouteProvider.GetUrlMethod(IVRRoutes.PLAY_MAIN_MENU));

            return response;
              }

              var reply = broadcast.BroadcastReplies.Skip(subBroadcastIdx).Take(1).FirstOrDefault();

              if (reply == null)
              {
            response.Say("No more replies, returning to the main menu");
            response.Redirect(ivrRouteProvider.GetUrlMethod(IVRRoutes.PLAY_MAIN_MENU));

            return response;
              }

              var fromProfile = profileManager.GetProfile(reply.FromProfileId);

              response.Say(string.Format("Playing broadcast reply from {0}", fromProfile.FullName));
              response.Play(reply.Url);

              if (broadcast.BroadcastReplies.Count - subBroadcastIdx <= 0)
              {
            response.Say("That was the last reply to this broadcast.");
              }

              response.BeginGather(new { action = ivrRouteProvider.GetUrlMethod(IVRRoutes.BROADCAST_REPLY_RESPONSE_SELECTION, profileId, lastBroadcastIdx, subBroadcastIdx), playBeep = true, numDigits = 1 });
              response.Say("Press one to reply privately to this broadcast.");
              response.Say("Press two to reply publicly to this broadcast.");

              if (broadcast.BroadcastReplies.Count - subBroadcastIdx > 0)
              {
            response.Say("Press three to listen to the next broadcast reply");
              }

              response.Say("Press four to listen to the next public broadcast");

              response.Say("Press five to add person as a favourite");

              response.EndGather();

              return response;
        }
        public TwilioResponse ListenToBroadcastsMenu(VoiceRequest request, int profileId)
        {
            var response = new TwilioResponse();

              if (string.IsNullOrEmpty(request.Digits))
              {
            response.BeginGather(new { numDigits = 1, action = ivrRouteProvider.GetUrlMethod(IVRRoutes.BROADCAST_MENU, profileId.ToString()) });
            response.Say("Press one to listen to all public broadcasts");
            //response.Say("Press two to listen to public broadcasts which match your country of origin");
            response.EndGather();

            return response;
              }

              switch (request.Digits)
              {
            case "1":
              response.Redirect(ivrRouteProvider.GetUrlMethod(IVRRoutes.BROADCASTS_LISTEN_TO_ALL_PUBLIC, profileId, 0));
              return response;
            case "2":
              response.Redirect(ivrRouteProvider.GetUrlMethod(IVRRoutes.BROADCAST_LISTEN_TO_MATCHED, "countryOfBirthId"));
              return response;
            default:
              response.Redirect(ivrRouteProvider.GetUrlMethod(IVRRoutes.MAIN_MENU_SELECTION));
              return response;
              }
        }
        public TwilioResponse ListenToPublicBroadcasts(VoiceRequest request, int profileId, int idx)
        {
            var response = new TwilioResponse();

              PublicBroadcast broadcast;

              try
              {
            broadcast = broadcastManager.GetAll().Skip(idx).Take(1).FirstOrDefault();
              }
              catch (Exception)
              {
            broadcast = null;
              }

              if (broadcast == null)
              {
            response.Say("No more broadcasts found, returning to the main menu");
            response.Redirect(ivrRouteProvider.GetUrlMethod(IVRRoutes.PLAY_MAIN_MENU));

            return response;
              }

              var fromProfile = profileManager.GetProfile(broadcast.FromProfileId);

              response.Say(string.Format("Playing broadcast from {0}", fromProfile.FullName));
              response.Play(broadcast.Url);

              response.BeginGather(new { action = ivrRouteProvider.GetUrlMethod(IVRRoutes.BROADCAST_RESPONSE_SELECTION, profileId, idx), playBeep = true, numDigits = 1 });
              response.Say("Press one to reply privately to this broadcast.");
              response.Say("Press two to reply publicly to this broadcast.");
              response.Say("Press three to listen to the next broadcast.");

              if (broadcast.BroadcastReplies.Count > 0)
              {
            response.Say("Press four to listen to responses to this broadcast");
              }

              response.EndGather();

              return response;
        }
Пример #29
0
        public HttpResponseMessage PhoneResponse(VoiceRequest call)
        {
            var response = new TwilioResponse();

            if (call.Digits == "1")
            {
                response.Say("Customer service is closed.  Sorry.").Pause(3).Hangup();
            } else if (call.Digits == "2")
            {
                response.Say("Later gator.", new {voice = "woman"}).Pause(3).Hangup();
            }
            else
            {
                response
                .BeginGather(new { action = "http://{{ YOUR URL HERE }}/twilio/response", voice = "woman", numDigits = 1 })
                .Say("Can't you listen?")
                .Pause()
                .Say("Press 1 for customer service.")
                .Say("Press 2 to hangup")
                .EndGather();
            }

            return Request.CreateResponse(HttpStatusCode.OK, response.Element, new XmlMediaTypeFormatter());
        }
Пример #30
0
        public ActionResult ServiceRequest(string CallSid, string Digits)
        {
            var call = GetCall(CallSid);
            TwilioResponse response = new TwilioResponse();

            switch (Digits)
            {
                case "0":
                    {
                        StateManager.AddToLog(CallSid, string.Format("User selected option {0} from service selection.", "Return to Menu"));
                        response.Say("Returning to the main menu.");
                        response.Redirect(Url.Action("IncomingCall"));
                    }
                    break;
                case "1":
                    {
                        StateManager.AddToLog(CallSid, string.Format("User selected option {0} from service selection.", "Manage Account"));
                        response.BeginGather(
            new { action = Url.Action("ManageAccount"), timeout = 120, method = "POST", numDigits = 8 });
                        response.Say("Please enter your 8 digit account number");
                        response.EndGather();
                    }
                    break;
                case "2":
                    {
                        StateManager.AddToLog(CallSid, string.Format("User selected option {0} from service selection.", "Take a Loan"));
                        response.Say(
                            "All of our loan officers are currently giving money away to people less deserving than you.");
                    }
                    break;
                case "3":
                    {
                        StateManager.AddToLog(CallSid, string.Format("User selected option {0} from service selection.", "Talk to a Representative"));
                    }
                    break;
                default:
                    {
                        response.Say("Oy vey.");
                        response.Redirect(Url.Action("IncomingCall"));
                    } break;
            }

            return SendTwilioResult(response);
        }