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


C# TwiML.TwilioResponse类代码示例

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


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

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

示例2: Can_Generate_Enqueue_With_Name

        public void Can_Generate_Enqueue_With_Name()
        {
            var response = new TwilioResponse();
            response.Enqueue("example");

            Assert.IsTrue(IsValidTwiML(response.ToXDocument()));
        }
开发者ID:HafsaNaveed,项目名称:twilio-csharp,代码行数:7,代码来源:EnqueueTests.cs

示例3: Can_Generate_Enqueue_With_Options_And_TaskAttributes

        public void Can_Generate_Enqueue_With_Options_And_TaskAttributes()
        {
            var response = new TwilioResponse();
            response.Enqueue(new { action = "example.xml", method = "GET", waitUrl = "wait.xml", waitUrlMethod = "GET", workspaceSid = "WSXXXXX" }, "{'task':'attributes'}");

            Assert.IsTrue(IsValidTwiML(response.ToXDocument()));
        }
开发者ID:HafsaNaveed,项目名称:twilio-csharp,代码行数:7,代码来源:EnqueueTests.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: 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

示例6: ResponseToSms

        public TwilioResponse ResponseToSms(SmsRequest request)
        {
            var response = new TwilioResponse();

              try
              {
            string outboundPhoneNumber = request.From;

            var client = new TwilioRestClient(accountSid, authToken);

            var call = client.InitiateOutboundCall(
              twilioPhoneNumber,
              outboundPhoneNumber,
              "http://refuniteivr.azurewebsites.net/api/IVREntry");

            if (call.RestException == null)
            {
              response.Sms("starting call to " + outboundPhoneNumber);
            }
            else
            {
              response.Sms("failed call to " + outboundPhoneNumber + " " + call.RestException.Message);
            }

            return response;
              }
              catch (Exception ex)
              {
            response.Sms("exception: " + ex.Message);
            return response;
              }
        }
开发者ID:kzhen,项目名称:RefUnited-IVR-Platform,代码行数:32,代码来源:SMSReceiverLogic.cs

示例7: Dial

        private static TwiMLResult Dial(string phoneNumber)
        {
            var response = new TwilioResponse();
            response.Dial(phoneNumber);

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

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

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

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

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

示例12: TwilioResponseResult

 public TwilioResponseResult(Action<TwilioResponse> buildResponse)
 {
     var response = new TwilioResponse();
     buildResponse(response);
     Content = response.Element.ToString();
     ContentType = new MediaTypeHeaderValue("text/xml");
 }
开发者ID:OlsonAndrewD,项目名称:the-phone-bible,代码行数:7,代码来源:TwilioResponseResult.cs

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

示例14: Can_Generate_Enqueue_With_Options_And_TaskAttributes_And_Priority_And_Timeout

        public void Can_Generate_Enqueue_With_Options_And_TaskAttributes_And_Priority_And_Timeout()
        {
            var response = new TwilioResponse();
            response.Enqueue(new { action = "example.xml", method = "GET", waitUrl = "wait.xml", waitUrlMethod = "GET", workflowSid = "WFXXXXX" }, "{'task':'attributes'}", new {priority="10", timeout="30"});

            Assert.IsTrue(IsValidTwiML(response.ToXDocument()));
        }
开发者ID:nkerkin,项目名称:twilio-csharp,代码行数:7,代码来源:EnqueueTests.cs

示例15: Dial

        /// <summary>
        /// Action Method that returns the TwiML needed to connect an 'Agent' to the first call in the Queue
        /// </summary>
        /// <remarks>This method also includes the 'url' parameter in the generated TwiML.  This allows you to provide a URL that can return TwiML that will be executed to the dequeued caller as a Whisper</remarks>
        /// <returns></returns>
        public ActionResult Dial()
        {
            var response = new TwilioResponse();
            response.DialQueue("Demo Queue", new { url = Url.Action("Connect") }, new { });

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


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