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


C# TwilioResponse.Say方法代码示例

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


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

        public TwilioResponse PingTeamMember(string teamId, string callingPartyId, int idx)
        {
            var response = new TwilioResponse();

              Contact contact = directory.GetTeamMember(teamId, idx);
              Team team = directory.GetTeam(teamId);

              if (contact != null)
              {
            if (idx == 0)
            {
              response.Say(string.Format("Now attempting to connect you to {0}", team.Name));
            }
            else
            {
              response.Say("Trying next team member...");
            }

            response.Say("We are now contacting " + contact.Name + ", please hold the line");
            response.Dial(new Number(contact.MobileNumber, new { url = string.Format("/Router/PreConnect?callingPartyId={0}", callingPartyId) }),
              new { callerId = "+442033229301", timeLimit = 5, action = string.Format("/Router/NextTeamMember?callingPartyId={0}&TeamId={1}&Idx={2}", callingPartyId, teamId, idx) });
              }
              else
              {
            response.Say("Couldn't find a team member...");
            response.Hangup();
              }

              return response;
        }
开发者ID:kzhen,项目名称:NHS-HackDay,代码行数:30,代码来源:ConnecterRouter.cs

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

示例4: Index

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

    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();
          RenderMainMenu(response);
          break;
      }
    }
    else
    {
      // If no input was sent, use the <Gather> verb to collect user input
      RenderMainMenu(response);
    }

    return TwiML(response);
  }
开发者ID:TwilioDevEd,项目名称:api-snippets,代码行数:28,代码来源:example.4.x.cs

示例5: Hello

 public ActionResult Hello()
 {
     var response = new TwilioResponse();
     response.Say("Hello there! Your Twilio environment has been configured.");
     response.Say("Good luck during the workshop!", new { Voice = "woman" });
     return TwiML(response);
 }
开发者ID:kwhinnery,项目名称:jumpstart,代码行数:7,代码来源:HomeController.cs

示例6: Post

        //public HttpResponseMessage Get(VoiceRequest request)
        //{
        //  try
        //  {
        //    if (request != null)
        //    {
        //      repo.AddMessage(string.Format("unknown,\"{0}\",\"{1}\",starting", request.From, request.To));
        //    }
        //    else
        //    {
        //      repo.AddMessage("unknown,unknown,unknown,starting");
        //    }
        //    var response = new TwilioResponse();
        //    response.Say("G'day and welcome to the twilio monitoring thing...you should see your call appear on the web now...");
        //    //return response;
        //    return this.Request.CreateResponse(HttpStatusCode.OK, response.Element, new XmlMediaTypeFormatter());
        //  }
        //  catch (Exception ex)
        //  {
        //    var response = new TwilioResponse();
        //    response.Say(ex.Message);
        //    response.Say(ex.StackTrace);
        //    return this.Request.CreateResponse(HttpStatusCode.OK, response.Element, new XmlMediaTypeFormatter());
        //  }
        //}
        public HttpResponseMessage Post(VoiceRequest request)
        {
            try
              {
            if (request != null)
            {
              repo.AddMessage(string.Format("unknown,{0},{1},starting", request.From, request.To));
            }
            else
            {
              repo.AddMessage("unknown,unknown,unknown,starting");
            }

            var response = new TwilioResponse();

            response.Say("G'day and welcome to the twilio monitoring thing...you should see your call appear on the web now...");
            response.Pause(5);
            response.Say("Good bye...");
            //return response;
            return this.Request.CreateResponse(HttpStatusCode.OK, response.Element, new XmlMediaTypeFormatter());
              }
              catch (Exception ex)
              {
            var response = new TwilioResponse();
            response.Say(ex.Message);
            response.Say(ex.StackTrace);
            return this.Request.CreateResponse(HttpStatusCode.OK, response.Element, new XmlMediaTypeFormatter());
              }
        }
开发者ID:kzhen,项目名称:TwilioMonitoring,代码行数:54,代码来源:VoiceAppController.cs

示例7: HandleRecord

 // /Voice/HandleRecord
 public TwiMLResult HandleRecord(VoiceRequest request)
 {
     var response = new TwilioResponse();
     response.Say("Listen to your recorded message.");
     response.Play(request.RecordingUrl);
     response.Say("Goodbye.");
     return TwiML(response);
 }
开发者ID:TwilioDevEd,项目名称:api-snippets,代码行数:9,代码来源:recording-action.4.x.cs

示例8: Build

        /// <summary>
        /// Builds an instance.
        /// </summary>
        /// <returns>A new instance of the TwilioResponse</returns>
        public TwilioResponse Build()
        {
            var response = new TwilioResponse();
            response.Say(_question.Body);
            response.Say(QuestionTypeToMessage[_question.Type]);
            AddRecordOrGatherCommands(response);

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

示例9: ProcessRequest

        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "application/xml";

            var response = new TwilioResponse();
            response.Say("Hello there! Your Twilio environment has been configured.");
            response.Say("Good luck during the workshop!", new { Voice = "woman" });

            context.Response.Write(response.ToString());
        }
开发者ID:kwhinnery,项目名称:jumpstart,代码行数:10,代码来源:Hello.ashx.cs

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

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

示例12: Index

 public ActionResult Index(VoiceRequest request)
 {
     var response = new TwilioResponse();
     response.Say("Hello! You will get an SMS message soon.");
     response.Sms("This is the ship that made the Kessel Run in fourteen parsecs?");
     return TwiML(response);
 }
开发者ID:TwilioDevEd,项目名称:api-snippets,代码行数:7,代码来源:example-1.4.x.cs

示例13: Index

 // /Voice
 public TwiMLResult Index(VoiceRequest request)
 {
     var response = new TwilioResponse();
     response.Say("Hello. It's me.");
     response.Play("http://howtodocs.s3.amazonaws.com/ahoyhoy.mp3");
     return TwiML(response);
 }
开发者ID:TwilioDevEd,项目名称:api-snippets,代码行数:8,代码来源:example-1.4.x.cs

示例14: ReturnInstructions

        private TwiMLResult ReturnInstructions()
        {
            var response = new TwilioResponse();
            response.Say("To get to your extraction point, get on your bike and go down " +
                         "the street. Then Left down an alley. Avoid the police cars. Turn left " +
                         "into an unfinished housing development. Fly over the roadblock. Go " +
                         "passed the moon. Soon after you will see your mother ship.",
                         new {voice = "alice", language = "en-GB"});

            response.Say("Thank you for calling the ET Phone Home Service - the " +
                         "adventurous alien's first choice in intergalactic travel");

            response.Hangup();

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

示例15: Connect

        public ActionResult Connect()
        {
            var response = new TwilioResponse();
            response.Say("Connecting you to an agent");

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


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