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


C# TwilioResponse.DialConference方法代码示例

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


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

示例1: Index

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

    object conferenceOptions;

    // If the caller is our MODERATOR, then start the conference when they
    // join and end the conference when they leave
    if (request.From == Moderator)
    {
      conferenceOptions = new
      {
        startConferenceOnEnter = true,
        endConferenceOnExit = true
      };
    }
    else
    {
      // Otherwise have the caller join as a regular participant
      conferenceOptions = new {startConferenceOnEnter = false};
    }

    response.DialConference("My conference", conferenceOptions);

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

示例2: CreateOrJoinConferenceCall

        public HttpResponseMessage CreateOrJoinConferenceCall(TwilioGatherRequest twilioRequest)
        {
            var conference = _client.ListConferences().Conferences.FirstOrDefault(name => name.FriendlyName.Equals(twilioRequest.Digits));

            var twilioResponse = new TwilioResponse();
            var digits = twilioRequest.Digits;

            twilioResponse.Say(string.Format("You're now joining conference {0}. Thank you.", digits), _voicesettings);

            if (conference != null)
            {
                var participant = _client.GetConferenceParticipant(conference.Sid, twilioRequest.CallSid);
                var context = GlobalHost.ConnectionManager.GetHubContext<Hubs.ConferenceHub>();
                context.Clients.addParticipant(participant.ConferenceSid, participant.CallSid, participant.Muted);
            }

            twilioResponse.DialConference(twilioRequest.Digits, new { waitUrl = "http://twimlets.com/holdmusic?Bucket=com.twilio.music.rock", endConferenceOnExit = true });
            twilioResponse.Redirect(Url.Link("ExtendedApi", new { controller = "Phone", action = "GoodByeMessage" }));

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

示例3: voice2

        public ActionResult voice2(string From)
        {
            Demo.LogNumber(From);

            var response = new TwilioResponse();
            response.Say("Welcome to 1 tug, conferencing you in");
            response.DialConference("onetug");

            Demo.Log("{0} joined the conference", From);

            return TwiML(response);
        }
开发者ID:joelmartinez,项目名称:onetug-twilio,代码行数:12,代码来源:RefTwilioController.cs

示例4: SecondClientReady

        public TwiMLResult SecondClientReady(CallContextModel model)
        {
            var response = new TwilioResponse();

            try
            {
                model.CallerStatus = Request["CallStatus"];

                var message = string.Empty;

                // Get fromUser and toUser
                var fromUser = Services.Users.GetUserById(model.CallerId);
                var toUser = Services.Users.GetUserById(model.ReceiverId);

                if (model.IsCustomer) // Customer initiate call >> Second client and FromUser is customer
                {
                    // Check consultant is readly in conference
                    if (Services.Call.CheckCallInStatus(model.CallId, CallStatus.InProgress, true))
                    {
                        string template = ConferenceConst.SecondClientReadyForTalkNow;
                        message = string.Format(template, toUser.Name);

                        response.Say(message, new { voice = VoiceInConference, language = LanguageInConference });

                        // Get name conference room
                        var room = string.Format(ConferenceRoom, fromUser.UserName, toUser.UserName, model.BookingId);

                        // Update receiver call status
                        Services.Call.UpdateCallStatus(model.CallId, model.CallerStatus, true);

                        // Hangup Url
                        var callHangUpUrl = Utilities.FormatLink(Url.Action("CallHangUp", "Conference", model));
                        // Dial coference
                        response.DialConference(room,
                            new
                            {
                                endConferenceOnExit = true
                            },
                            new
                            {
                                record = true,
                                trim = "trim-silence",
                                transcribe = false,
                                action = callHangUpUrl
                            });
                    }
                    else
                    {
                        response.Say(ConferenceConst.ConsultantDenied, new { voice = VoiceInConference, language = LanguageInConference });
                    }
                }
                else
                {
                    string template = ConferenceConst.SecondClientReadyForSchedule;
                    message = string.Format(template, toUser.Name);
                    response.Say(message, new { voice = VoiceInConference, language = LanguageInConference });

                    // Get name conference room
                    var room = string.Format(ConferenceRoom, fromUser.UserName, toUser.UserName, model.BookingId); ;

                    // Dial coference
                    var callBackUrl = Utilities.FormatLink(Url.Action("CallBackAfterConference", "Conference", model));
                    response.DialConference(room,
                        new
                        {
                            endConferenceOnExit = true,
                            waitUrl = "http://twimlets.com/holdmusic?Bucket=com.twilio.music.electronica"
                        },
                        new
                        {
                            record = false,
                            transcribe = false,
                            action = callBackUrl
                        });

                    // Update receiver call status
                    Services.Call.UpdateCallStatus(model.CallId, model.CallerStatus, true);
                }
            }
            catch (Exception e)
            {
                Log.Error("Second client ready. Error: ", e);

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

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

示例5: FirstClientConference

        public TwiMLResult FirstClientConference(CallContextModel model)
        {
            var response = new TwilioResponse();

            try
            {
                // Get fromUser and toUser
                var caller = Services.Users.GetUserById(model.CallerId);
                var receiver = Services.Users.GetUserById(model.ReceiverId);
                var callBackUrl = Utilities.FormatLink(Url.Action("CallBackAfterConference", "Conference", model));

                if (model.IsCustomer) // Customer initiate call >> Consultant called first
                {
                    // Get name conference room
                    var room = string.Format(ConferenceRoom, caller.UserName, receiver.UserName, model.BookingId);

                    // Check customer is readly in conference
                    if (Services.Call.CheckCallInStatus(model.CallId, CallStatus.InProgress, false))
                    {
                        response.Say(ConferenceConst.CustomerReadyTakeCall, new { voice = VoiceInConference, language = LanguageInConference });

                        // Update start time conference
                        Services.Call.UpdateConferenceTime(model.CallId, true);

                        // Begin call duration show popup to user
                        CallHelper.CallDuration(Request["CallSid"], model.IsCustomer, Services, true);

                        // Start conference timer
                        CallHelper.StartConferenceTimer(model.CallerId, model.CallId, model.BookingId, room);

                        // Dial conference
                        response.DialConference(room,
                            new
                            {
                                endConferenceOnExit = true,
                                waitUrl = "http://twimlets.com/holdmusic?Bucket=com.twilio.music.electronica"
                            },
                            new
                            {
                                record = false,
                                transcribe = false,
                                action = callBackUrl
                            });
                    }
                    else
                    {
                        response.Say(ConferenceConst.CustomerDenied, new { voice = VoiceInConference, language = LanguageInConference });
                    }
                }
                else // Consultant initiate call >>  Customer called first
                {
                    response.Say(ConferenceConst.ConsultantReadyTakeCall, new { voice = VoiceInConference, language = LanguageInConference });
                    // Get name conference room
                    var room = string.Format(ConferenceRoom, caller.UserName, receiver.UserName, model.BookingId);

                    // Update start time conference
                    Services.Call.UpdateConferenceTime(model.CallId, true);

                    // Begin call duration show popup to user
                    CallHelper.CallDuration(Request["CallSid"], model.IsCustomer, Services, true);

                    // Begin conference timer
                    CallHelper.StartConferenceTimer(model.ReceiverId, model.CallId, model.BookingId, room);

                    // Dial conference
                    var callHangUpUrl = Utilities.FormatLink(Url.Action("CallHangUp", "Conference", model));
                    response.DialConference(room,
                        new
                        {
                            endConferenceOnExit = true
                        },
                        new
                        {
                            record = true,
                            trim = "trim-silence",
                            transcribe = false,
                            action = callHangUpUrl
                        });
                }
            }
            catch (Exception e)
            {
                Log.Error("First client join conference. Error: ", e);

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

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


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