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


C# TwilioResponse.Redirect方法代码示例

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


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

示例1: Gather

  public TwiMLResult Gather(VoiceRequest request)
  {
    var response = new TwilioResponse();

    // If the user entered digits, process their request
    if (!string.IsNullOrEmpty(request.Digits))
    {
      switch (request.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 TwiML(response);
  }
开发者ID:TwilioDevEd,项目名称:api-snippets,代码行数:29,代码来源:example.4.x.cs

示例2: Complete

 public ActionResult Complete(VoiceRequest request)
 {
     var response = new TwilioResponse();
     if (request.Digits=="1")
     {
         response.Redirect( Url.Action("Gather"), "GET" );
     }
     else
     {
         response.Redirect( Url.Action("Goodbye"), "GET" );
     }
     return TwiML(response);
 }
开发者ID:devinrader,项目名称:PackageStatusSample,代码行数:13,代码来源:CallController.cs

示例3: Error

        public ActionResult Error(VoiceRequest request)
        {
            var response = new TwilioResponse();
            switch (request.Digits)
            {
                case "1":
                    response.Redirect(Url.Action("Agent"), "GET");
                    break;
                default:
                    response.Redirect(Url.Action("Goodbye"), "GET");
                    break;
            }

            return TwiML(response);
        }
开发者ID:devinrader,项目名称:PackageStatusSample,代码行数:15,代码来源:CallController.cs

示例4: RedirectWelcome

        private TwiMLResult RedirectWelcome()
        {
            var response = new TwilioResponse();
            response.Redirect(Url.Action("Welcome", "IVR"));

            return TwiML(response);
        }
开发者ID:TwilioDevEd,项目名称:ivr-recording-csharp,代码行数:7,代码来源:MenuController.cs

示例5: GetMenuSelection

        public TwilioResponse GetMenuSelection(VoiceRequest request)
        {
            var response = new TwilioResponse();

              try
              {
            string lookupPhoneNumber = request.GetOriginatingNumber();

            int profileId = profileManager.GetProfileId(lookupPhoneNumber);

            var selection = int.Parse(request.Digits);

            switch (selection)
            {
              case 1:
            response.Say("Looking up unread messages.");
            var unreadCount = refUnitedAcctManager.GetUnreadMessageCount(profileId);
            response.Say(string.Format("You have {0} message{1}", unreadCount, (unreadCount == 1) ? "" : "s"));
            break;
              case 2:
            response.Say("Looking up messages");
            response.Redirect(routeProvider.GetUrlMethod(IVRRoutes.READ_PLATFORM_MESSAGES, profileId));
            break;
              case 3:
            response.Redirect(routeProvider.GetUrlMethod(IVRRoutes.SEND_MESSAGE_TO_FAVOURITE, profileId));
            break;
              case 4:
            response.Redirect(routeProvider.GetUrlMethod(IVRRoutes.PLAY_RECORDED_MESSAGES, profileId));
            break;
              case 5:
            response.Redirect(routeProvider.GetUrlMethod(IVRRoutes.BROADCAST_RECORD, profileId));
            break;
              case 6:
            response.Redirect(routeProvider.GetUrlMethod(IVRRoutes.BROADCAST_MENU, profileId));
            break;
              default:
            response.Redirect(routeProvider.GetUrlMethod(IVRRoutes.PLAY_MAIN_MENU));
            break;
            }
              }
              catch (Exception ex)
              {
            response.Say("an error has occured. " + ex.Message);
              }

              return response;
        }
开发者ID:kzhen,项目名称:RefUnited-IVR-Platform,代码行数:47,代码来源:IVRMainLogic.cs

示例6: Closed

        public HttpResponseMessage Closed()
        {
            var voicemailUrl = _accountSettings.GetSetting("VoicemailUrl");
            var twilioResponse = new TwilioResponse();
            twilioResponse.Redirect(voicemailUrl);

            return Request.CreateResponse(HttpStatusCode.OK, twilioResponse.Element, new XmlMediaTypeFormatter());
        }
开发者ID:letmeproperty,项目名称:callcentre,代码行数:8,代码来源:DirectoryController.cs

示例7: RedirectWelcome

        public TwiMLResult RedirectWelcome()
        {
            var response = new TwilioResponse();
            response.Say("Returning to the main menu",
                new {voice = "alice", language = "en-GB"});
            response.Redirect(Url.Action("Welcome", "IVR"));

            return new TwiMLResult(response);
        }
开发者ID:TwilioDevEd,项目名称:ivr-phone-tree-csharp,代码行数:9,代码来源:ControllerBase.cs

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

示例9: ConnectCall

        // Webhook for Twilio survey number
        // GET: connectcall
        public ActionResult ConnectCall()
        {
            var response = new TwilioResponse();
            var survey = _surveysRepository.FirstOrDefault();
            var welcomeMessage = string.Format("Thank you for taking the {0} survey", survey.Title);

            response.Say(welcomeMessage);
            response.Redirect(Url.Action("find", "questions", new { id = 1 }));

            return TwiML(response);
        }
开发者ID:TwilioDevEd,项目名称:automated-survey-csharp,代码行数:13,代码来源:SurveysController.cs

示例10: BroadcastReplyMenuSelection

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

              var selection = request.Digits;

              switch (selection)
              {
            case "1":
              response.Redirect(ivrRouteProvider.GetUrlMethod(IVRRoutes.BROADCASTS_REPLY_PRIVATELY, profileId, lastBroadcastIdx, subBroadcastIdx));
              return response;
            case "2":
              response.Redirect(ivrRouteProvider.GetUrlMethod(IVRRoutes.BROADCASTS_REPLY_PUBLICLY, profileId, lastBroadcastIdx, subBroadcastIdx));
              return response;
            case "3":
              response.Redirect(ivrRouteProvider.GetUrlMethod(IVRRoutes.BROADCASTS_PLAY_PUBLIC_REPLY, profileId, lastBroadcastIdx, ++subBroadcastIdx));
              return response;
            case "4":
              response.Redirect(ivrRouteProvider.GetUrlMethod(IVRRoutes.BROADCASTS_LISTEN_TO_ALL_PUBLIC, profileId, ++lastBroadcastIdx));
              return response;
            case "5":
              response.Redirect(ivrRouteProvider.GetUrlMethod(IVRRoutes.BROADCASTS_ADD_REPLIER_AS_FAVOURITE, profileId, lastBroadcastIdx, subBroadcastIdx));
              return response;
            default:
              response.Redirect(ivrRouteProvider.GetUrlMethod(IVRRoutes.PLAY_MAIN_MENU));
              return response;
              }
        }
开发者ID:kzhen,项目名称:RefUnited-IVR-Platform,代码行数:28,代码来源:IVRBroadcastLogic.cs

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

示例12: AddResponderAsFavourite

        public TwilioResponse AddResponderAsFavourite(VoiceRequest request, int profileId, int lastBroadcastIdx, int subBroadcastIdx)
        {
            var broadcast = broadcastManager.GetAll().Skip(lastBroadcastIdx).Take(1).FirstOrDefault();
              var reply = broadcast.BroadcastReplies.Skip(subBroadcastIdx).Take(1).FirstOrDefault();

              int profileIdToFavourite = reply.FromProfileId;
              profileManager.AddAsFavourite(profileId, profileIdToFavourite);

              var profile = profileManager.GetProfile(profileIdToFavourite);

              var response = new TwilioResponse();

              response.Say(string.Format("{0} has been added as a favourite", profile.FullName));
              response.Redirect(ivrRouteProvider.GetUrlMethod(IVRRoutes.PLAY_MAIN_MENU));

              return response;
        }
开发者ID:kzhen,项目名称:RefUnited-IVR-Platform,代码行数:17,代码来源:IVRBroadcastLogic.cs

示例13: Post

        public HttpResponseMessage Post(VoiceRequest request)
        {
            var pin = request.Digits;

            var authenticated = AuthenticationService.Authenticate(pin);

            if (!authenticated)
            {
                throw new InvalidPinException(pin);
            }

            var response = new TwilioResponse();
            response.Say("Pin code is valid.");
            response.Redirect(string.Format("/api/User?pin={0}", pin));

            return this.TwiMLResponse(response);
        }
开发者ID:jonasrafael,项目名称:Samples,代码行数:17,代码来源:AuthenticateController.cs

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

示例15: HandleGather

 // /Voice/HandleGather
 public TwiMLResult HandleGather(VoiceRequest request)
 {
     var response = new TwilioResponse();
     switch (request.Digits)
     {
       case "1":
     response.Dial("+13105551212");
     response.Say("The call failed or the remote party hung up.  Goodbye.");
     break;
       case "2":
     response.Say("Record your message after the tone.");
     response.Record(new {maxLength = "30", action = "/Voice/HandleRecord"});
     break;
       default:
     response.Redirect("/Voice");
     break;
     }
     return TwiML(response);
 }
开发者ID:TwilioDevEd,项目名称:api-snippets,代码行数:20,代码来源:twiml-gather-input.4.x.cs


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