当前位置: 首页>>代码示例>>C#>>正文


C# TwilioResponse.EndGather方法代码示例

本文整理汇总了C#中Twilio.TwiML.TwilioResponse.EndGather方法的典型用法代码示例。如果您正苦于以下问题:C# TwilioResponse.EndGather方法的具体用法?C# TwilioResponse.EndGather怎么用?C# TwilioResponse.EndGather使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Twilio.TwiML.TwilioResponse的用法示例。


在下文中一共展示了TwilioResponse.EndGather方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: IncomingCall

        //
        // 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);
        }
开发者ID:1kevgriff,项目名称:CallCenter,代码行数:30,代码来源:PhoneController.cs

示例2: RenderMainMenu

  // 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");
  }
开发者ID:TwilioDevEd,项目名称:api-snippets,代码行数:10,代码来源:example.4.x.cs

示例3: GetGreeting

        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;
        }
开发者ID:kzhen,项目名称:RefUnited-IVR-Platform,代码行数:56,代码来源:IVREntryLogic.cs

示例4: Greet

        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;
        }
开发者ID:kzhen,项目名称:NHS-HackDay,代码行数:12,代码来源:WelcomeRouter.cs

示例5: Error

        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);
        }
开发者ID:devinrader,项目名称:PackageStatusSample,代码行数:12,代码来源:CallController.cs

示例6: Gather

        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);
        }
开发者ID:devinrader,项目名称:PackageStatusSample,代码行数:12,代码来源:CallController.cs

示例7: Complete

        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);
        }
开发者ID:devinrader,项目名称:PackageStatusSample,代码行数:12,代码来源:CallController.cs

示例8: Index

 // /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);
 }
开发者ID:TwilioDevEd,项目名称:api-snippets,代码行数:13,代码来源:twiml-gather.4.x.cs

示例9: Index

  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);
  }
开发者ID:TwilioDevEd,项目名称:api-snippets,代码行数:14,代码来源:example.4.x.cs

示例10: GetMainMenu

        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;
        }
开发者ID:kzhen,项目名称:RefUnited-IVR-Platform,代码行数:17,代码来源:IVRMainLogic.cs

示例11: InitialOptions

        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;
        }
开发者ID:kzhen,项目名称:NHS-HackDay,代码行数:19,代码来源:WelcomeRouter.cs

示例12: AnswerIncomingCall

        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);
        }
开发者ID:pkefal,项目名称:VoxVoiPlayground,代码行数:21,代码来源:PhoneController.cs

示例13: ServiceRequest

        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);
        }
开发者ID:1kevgriff,项目名称:CallCenter,代码行数:44,代码来源:PhoneController.cs

示例14: ListenToPublicBroadcasts

        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;
        }
开发者ID:kzhen,项目名称:RefUnited-IVR-Platform,代码行数:42,代码来源:IVRBroadcastLogic.cs

示例15: ListenToBroadcastsMenu

        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;
              }
        }
开发者ID:kzhen,项目名称:RefUnited-IVR-Platform,代码行数:27,代码来源:IVRBroadcastLogic.cs


注:本文中的Twilio.TwiML.TwilioResponse.EndGather方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。