• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# TwiML.TwilioResponse类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: Index

        public async Task<TwiMLResult> Index(string ServiceKey, string From, string To, string Body, string SmsSid)
        {
            var msg = "From: " + From + "\r\n" + Body;
            var pdEvent = new PagerDutyEvent() {
                service_key = ServiceKey,
                event_type = "trigger",
                description = msg.Substring(0,Math.Min(1024, msg.Length))
            };

            var tResp = new TwilioResponse();
            try
            {
                using (var response = await _httpclient.PostAsJsonAsync<PagerDutyEvent>("https://events.pagerduty.com/generic/2010-04-15/create_event.json", pdEvent))
                {
                    
                    if (response.IsSuccessStatusCode)
                    {
                        tResp.Sms("PagerDuty incident created.");
                    }
                    else
                    {
                        tResp.Sms("failed to create PagerDuty incident - statusCode " + response.StatusCode.ToString());
                    }
                }
            }
            catch
            {
                tResp.Sms("failed to create PagerDuty incident");
            }
            return new TwiMLResult(tResp);
        }
开发者ID:Glympse,项目名称:Twilio2PagerDuty,代码行数:31,代码来源:PagerDutyController.cs


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


示例18: CallBackAfterConference

        public TwiMLResult CallBackAfterConference(CallContextModel model)
        {
            var callSid = Request["CallSid"];
            var response = new TwilioResponse();
            try
            {
                if (model.IsCustomer)
                {
                    model.ReceiverSid = callSid;
                }
                else
                {
                    model.CallerSid = callSid;
                }

                response.Say(ConferenceConst.ThankForConsultantAndFollowupAction,
                            new { voice = VoiceInConference, language = LanguageInConference });
                response.Redirect(Url.Action("ConsultantAfterCall", model));

                return new TwiMLResult(response);
            }
            catch (Exception e)
            {
                Log.Error("Call back after conference. Error: ", e);

                // Error
                response.Say(ConferenceConst.ErrorMessage, new { voice = VoiceInConference, language = LanguageInConference });
                response.Hangup();
            }

            return new TwiMLResult(response);
        }
开发者ID:nguyenminhthu,项目名称:TeleConsult,代码行数:32,代码来源:ConferenceController.cs


示例19: HandleSms

 public TwiMLResult HandleSms(string Sid, string From, string To, string Body, string Status)
 {
     _db.Log.Insert(Text: String.Format("From: {0}, To: {1}, Body: {2}", From, To, Body));
     var response = new TwilioResponse();
     response.Say("Received");
     return TwiML(response);
 }
开发者ID:lanceharper,项目名称:TwilioBox-,代码行数:7,代码来源:SmsController.cs


示例20: Index

        public async Task<ActionResult> Index(string from, string body)
        {
            var request = new LightsRequest
            {
                Source = "twilio",
                From = from,
                Text = body
            };

            var lightsResponse = await _lightsService.HandleRequestAsync(request);

            var response = new TwilioResponse();

            if (_smsSettings.AllowResponses && lightsResponse.IsSuccess)
            {
                if (lightsResponse.IsScheduled && lightsResponse.ScheduledForUtc.HasValue)
                {
                    response.Sms(string.Format("Ooops, you're in a queue! Don't worry, your lights have been scheduled for {0}. Merry Christmas from #157!",
                        lightsResponse.ScheduledForUtc.Value.ToString("HH:mm")));
                }
                else
                {
                    response.Sms("Thanks! Your lights will be shown shortly. Merry Christmas from #157!");                    
                }
            }

            return new TwiMLResult(response);
        }
开发者ID:photomoose,项目名称:xmas-leds,代码行数:28,代码来源:SmsController.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Presentation.RoutedEventData类代码示例发布时间:2022-05-26
下一篇:
C# Twilio.TwilioRestClient类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap