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


C# TwilioResponse.BeginGather方法代码示例

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


在下文中一共展示了TwilioResponse.BeginGather方法的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: Welcome

        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);
        }
开发者ID:TwilioDevEd,项目名称:ivr-phone-tree-csharp,代码行数:9,代码来源:IVRController.cs

示例3: 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

示例4: 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

示例5: Join

        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);
        }
开发者ID:TwilioDevEd,项目名称:conference-broadcast-csharp,代码行数:12,代码来源:ConferenceController.cs

示例6: 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

示例7: 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

示例8: 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

示例9: 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

示例10: 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

示例11: Planets

        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);
        }
开发者ID:TwilioDevEd,项目名称:ivr-recording-csharp,代码行数:12,代码来源:MenuController.cs

示例12: IncomingPhone

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

示例13: 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

示例14: 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

示例15: seq

        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;



        }
开发者ID:steven777400,项目名称:FlyingClubReservation,代码行数:45,代码来源:VoiceController.cs


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