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


C# TwilioResponse.Hangup方法代码示例

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


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

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

示例2: Hangup

        public ActionResult Hangup()
        {
            var response = new TwilioResponse();
            response.Say(
                "Your recording has been saved. Good bye");
            response.Hangup();

            return TwiML(response);
        }
开发者ID:TwilioDevEd,项目名称:conference-broadcast-csharp,代码行数:9,代码来源:RecordingsController.cs

示例3: ManageAccount

        public ActionResult ManageAccount(string CallSid, string Digits)
        {
            var call = GetCall(CallSid);
            TwilioResponse response = new TwilioResponse();
            response.Say("Sorry.  Account management is currently down for repairs.  Please try again in 6 to 8 weeks.");
            response.Hangup();

            return SendTwilioResult(response);
        }
开发者ID:1kevgriff,项目名称:CallCenter,代码行数:9,代码来源:PhoneController.cs

示例4: GoodByeMessage

        public HttpResponseMessage GoodByeMessage(TwilioVoiceRequest twilioVoiceRequest)
        {
            var twilioResponse = new TwilioResponse();

            twilioResponse.Say("Thank you for using VoxVoi. Goodbye!", _voicesettings);
            twilioResponse.Hangup();

            return Request.CreateResponse(HttpStatusCode.OK, twilioResponse.Element);
        }
开发者ID:pkefal,项目名称:VoxVoiPlayground,代码行数:9,代码来源:PhoneController.cs

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

示例6: Post

        public HttpResponseMessage Post(VoiceRequest request, string pin)
        {
            var user = AuthenticationService.GetUser(pin);

            var response = new TwilioResponse();
            response.Say(string.Format("Hello {0}", user.Name));
            response.Pause(2);
            response.Hangup();

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

示例7: CallComplete

        public ActionResult CallComplete(string CallSid)
        {
            LocationalCall call = (LocationalCall)GetCall(CallSid);
            StateManager.CompletedCall(call);
            StateManager.AddToLog(CallSid, "Call is completed.");

            TwilioResponse response = new TwilioResponse();
            response.Say("Goodbye baby cakes");
            response.Hangup();

            return SendTwilioResult(response);
        }
开发者ID:1kevgriff,项目名称:CallCenter,代码行数:12,代码来源:PhoneController.cs

示例8: Index

  public TwiMLResult Index(VoiceRequest request)
  {
    var response = new TwilioResponse();
    
    // Use <Say> to give the caller some instructions
    response.Say("Hello. Please leave a message and I will transcribe it.");

    // Use <Record> to record and transcribe the caller's message
    response.Record(new { transcribe = true, maxLength = 30 });

    // End the call with <Hangup>
    response.Hangup();

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

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

示例10: InitialOptions

        public TwilioResponse InitialOptions(VoiceRequest request)
        {
            TwilioResponse response = new TwilioResponse();

              var id = request.Digits;

              if (!directory.ExtensionExists(id))
              {
            response.Say("We couldn't find your I D.");
            response.Hangup();
              }

              response.BeginGather(new { finishOnKey = "#", action = string.Format("/Router/PingInital?callingPartyId={0}", id) });
              response.Say("To contact an individual, enter their 4 digit I D and then press the hash button");
              response.Say("To contact a team, enter star followed by the 4 digit I D and then press the hash button");
              response.EndGather();

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

示例11: Post

        public HttpResponseMessage Post(VoiceRequest request, string userId)
        {
            var response = new TwilioResponse();

            var usernames = new Dictionary<string, string>
                                {
                                    { "12345", "Tom" }, 
                                    { "23456", "Dick" }, 
                                    { "34567", "Harry" }
                                };

            var username = usernames[userId];

            response.Say(string.Format("Hello {0}", username));
            response.Pause(5);
            response.Hangup();

            return this.Request.CreateResponse(HttpStatusCode.OK, response.Element, new XmlMediaTypeFormatter());
        }
开发者ID:jonasrafael,项目名称:Samples,代码行数:19,代码来源:NameController.cs

示例12: Post

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

            var validIds = new List<string> { "12345", "23456", "34567" };
            var userId = request.Digits;
            var authenticated = validIds.Contains(userId);

            if (!authenticated)
            {
                response.Say("You entered an invalid ID. Goodbye.");
                response.Hangup();
            }
            else
            {
                response.Say("ID is valid.");
                response.Redirect(string.Format("/api/Name?userId={0}", userId));
            }

            return this.Request.CreateResponse(HttpStatusCode.OK, response.Element, new XmlMediaTypeFormatter());
        }
开发者ID:jonasrafael,项目名称:Samples,代码行数:21,代码来源:AuthenticateController.cs

示例13: GetAuthentication

        public TwilioResponse GetAuthentication(VoiceRequest request, string language)
        {
            var response = new TwilioResponse();

              if (string.IsNullOrEmpty(language))
              {
            language = LanguageHelper.GetDefaultCulture();
              }
              else
              {
            language = LanguageHelper.GetValidCulture(language);
              }

              IVRAuthLang.Culture = new System.Globalization.CultureInfo(language);
              twiMLHelper = new TwiMLHelper(language, LanguageHelper.IsImplementedAsMP3(language));

              string lookupPhoneNumber = request.GetOriginatingNumber();

              var pin = request.Digits;

              var result = profileManager.CheckPin(lookupPhoneNumber, pin);

              string correctPin = profileManager.GetPin(lookupPhoneNumber);

              if (result)
              {
            response.Redirect(routeProvider.GetUrlMethod(IVRRoutes.PLAY_MAIN_MENU, language), "POST");
              }
              else
              {
            twiMLHelper.SayOrPlay(response, IVRAuthLang.IncorrectPIN);

            response.Hangup();
              }

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

示例14: CallHangUpForDeferOrReSchedule

        public TwiMLResult CallHangUpForDeferOrReSchedule(CallContextModel model)
        {
            var response = new TwilioResponse();
            try
            {
                Services.Call.UpdateCallStatus(Request["CallSid"], CallStatus.Completed);
                Services.Call.UpdateConferenceTime(model.CallId, false);

                response.Hangup();
            }
            catch (Exception e)
            {
                // Log
                Log.Error("Call hang up for defer or reschedule. Error: ", e);

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

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

示例15: WaiveFeeActionResponse

        public TwiMLResult WaiveFeeActionResponse(CallContextModel model, string digits)
        {
            var response = new TwilioResponse();

            try
            {
                switch (digits)
                {
                    case "1":
                        // Check waive fee already
                        var invoice = Services.Invoices.GetByBookingIdAndUserId(model.BookingId, model.CallerId);

                        if (invoice != null)
                        {
                            if (!invoice.IsWaiveFee)
                            {
                                // Send waive fee request
                                SendWaiveFeeRequest(model);

                                response.Say(ConferenceConst.AcctionCompleted, new { voice = VoiceInConference, language = LanguageInConference });
                            }
                            else
                            {
                                // Say waive fee alreadly
                                response.Say(ConferenceConst.WaiveFeeAlready, new { voice = VoiceInConference, language = LanguageInConference });
                            }
                        }

                        break;

                    default:
                        response.Redirect(Url.Action("ConsultantAfterCall", model));

                        break;
                }
            }
            catch (Exception e)
            {
                Log.Error("Waive fee action response. Error: ", e);

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

            response.Redirect(Url.Action("ConsultantAfterCall", model));
            return new TwiMLResult(response);
        }
开发者ID:nguyenminhthu,项目名称:TeleConsult,代码行数:48,代码来源:ConferenceController.cs


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