Exemplo n.º 1
0
 internal StartUpAsyncResult(string presenterUri, AsyncCallback userCallback, Object state, AcdConferenceServicesAnchor anchor)
     : base(userCallback, state)
 {
     Debug.Assert(anchor != null);
     _anchor       = anchor;
     _presenterUri = presenterUri;
 }
Exemplo n.º 2
0
 internal EstablishMoHChannelAsyncResult
     (AcdMusicOnHoldServer mohServer,
     string participantUri,
     AcdConferenceServicesAnchor anchor,
     AsyncCallback userCallback,
     object state)
     : base(userCallback, state)
 {
     _mohServer      = mohServer;
     _anchor         = anchor;
     _participantUri = participantUri;
 }
Exemplo n.º 3
0
 internal ShutDownAsyncResult(AsyncCallback userCallback, object state, AcdConferenceServicesAnchor anchor) : base(userCallback, state)
 {
     _anchor = anchor;
 }
Exemplo n.º 4
0
            internal void Process()
            {
                if (String.IsNullOrEmpty(_anchor._conferenceUri))
                {
                    _anchor.AuthorizeParticipant(_presenterUri);
                    _anchor.ElevateToPresenter(_presenterUri);

                    ConferenceServices conferenceManagement = _anchor._endpoint.ConferenceServices;

                    //Create a conference to anchor the incoming customer call
                    ConferenceScheduleInformation conferenceScheduleInfo = new ConferenceScheduleInformation();
                    conferenceScheduleInfo.AutomaticLeaderAssignment = AutomaticLeaderAssignment.Disabled;
                    conferenceScheduleInfo.LobbyBypass        = LobbyBypass.Disabled;
                    conferenceScheduleInfo.AccessLevel        = ConferenceAccessLevel.Locked;
                    conferenceScheduleInfo.PhoneAccessEnabled = false;
                    conferenceScheduleInfo.Mcus.Add(new ConferenceMcuInformation(MediaType.ApplicationSharing));
                    conferenceScheduleInfo.Mcus.Add(new ConferenceMcuInformation(McuType.AudioVideo));
                    conferenceScheduleInfo.Mcus.Add(new ConferenceMcuInformation(McuType.InstantMessaging));

                    try
                    {
                        //schedule the conference
                        conferenceManagement.BeginScheduleConference(conferenceScheduleInfo,
                                                                     ar =>
                        {
                            try
                            {
                                _anchor._conference = conferenceManagement.EndScheduleConference(ar);
                            }
                            catch (RealTimeException rtex)
                            {
                                this.SetAsCompleted(rtex, false);
                                return;
                            }
                            _anchor._conferenceUri = _anchor._conference.ConferenceUri;
                            _anchor.RegisterForEvents();

                            //Join the conference as a trusted conferencing user (invisible in the roster)
                            ConferenceJoinOptions options = new ConferenceJoinOptions();
                            options.JoinMode = JoinMode.TrustedParticipant;


                            try
                            {
                                _anchor._conversation.ConferenceSession.BeginJoin(_anchor._conference.ConferenceUri,
                                                                                  options,
                                                                                  jar =>
                                {
                                    Conversation conv = jar.AsyncState as Conversation;
                                    try
                                    {
                                        conv.ConferenceSession.EndJoin(jar);

                                        //Update the state of the anchor when the operation succeeds
                                        _anchor.UpdateState(ConferenceServicesAnchorState.Established);

                                        this.SetAsCompleted(null, false);
                                    }
                                    catch (RealTimeException rtex)
                                    {
                                        if (null != _anchor)
                                        {
                                            _anchor._logger.Log("AcdConferenceServicesAnchor failed to create a conference", rtex);
                                        }
                                        _anchor.BeginShutDown(sar =>
                                        {
                                            AcdConferenceServicesAnchor anchor = sar.AsyncState as AcdConferenceServicesAnchor;
                                            anchor.EndShutDown(sar);
                                        },
                                                              _anchor);
                                        this.SetAsCompleted(rtex, false);
                                    }
                                }
                                                                                  , _anchor._conversation);
                            }
                            catch (InvalidOperationException ivoex)
                            {
                                _anchor._logger.Log("AcdConferenceServicesAnchor failed to create a conference", ivoex);
                                _anchor.BeginShutDown(sar =>
                                {
                                    AcdConferenceServicesAnchor anchor = sar.AsyncState as AcdConferenceServicesAnchor;
                                    anchor.EndShutDown(sar);
                                },
                                                      _anchor);
                                this.SetAsCompleted(new OperationFailureException("AcdConferenceServicesAnchor failed creating a conference", ivoex), false);
                            }
                        },
                                                                     conferenceManagement);
                    }
                    catch (InvalidOperationException ivoex)
                    {
                        _anchor._logger.Log("AcdConferenceServicesAnchor failed to create a conference", ivoex);
                        _anchor.BeginShutDown(sar =>
                        {
                            AcdConferenceServicesAnchor anchor = sar.AsyncState as AcdConferenceServicesAnchor;
                            anchor.EndShutDown(sar);
                        },
                                              _anchor);
                        this.SetAsCompleted(new OperationFailureException("AcdConferenceServicesAnchor failed to create a conference", ivoex), false);
                    }
                }
                else
                {
                    _anchor.RegisterForEvents();

                    ConferenceJoinOptions options = new ConferenceJoinOptions();
                    options.JoinMode = JoinMode.TrustedParticipant;


                    try
                    {
                        _anchor._conversation.ConferenceSession.BeginJoin(_anchor._conferenceUri,
                                                                          options,
                                                                          jar =>
                        {
                            Conversation conv = jar.AsyncState as Conversation;
                            try
                            {
                                conv.ConferenceSession.EndJoin(jar);
                                _anchor.UpdateState(ConferenceServicesAnchorState.Established);
                                this.SetAsCompleted(null, false);
                            }
                            catch (RealTimeException rtex)
                            {
                                if (null != _anchor)
                                {
                                    _anchor._logger.Log("AcdConferenceServicesAnchor failed to create a conference", rtex);
                                }
                                _anchor.BeginShutDown(sar =>
                                {
                                    AcdConferenceServicesAnchor anchor = sar.AsyncState as AcdConferenceServicesAnchor;
                                    anchor.EndShutDown(sar);
                                },
                                                      _anchor);
                                this.SetAsCompleted(rtex, false);
                            }
                        },
                                                                          _anchor._conversation);
                    }
                    catch (InvalidOperationException ivoex)
                    {
                        _anchor._logger.Log("AcdConferenceServicesAnchor failed to create a conference", ivoex);
                        _anchor.BeginShutDown(sar =>
                        {
                            AcdConferenceServicesAnchor anchor = sar.AsyncState as AcdConferenceServicesAnchor;
                            anchor.EndShutDown(sar);
                        },
                                              _anchor);
                        this.SetAsCompleted(new OperationFailureException("AcdConferenceServicesAnchor failed to create a conference", ivoex), false);
                    }
                }
            }