Esempio n. 1
0
 public static Task <bool> CheckPasscodeIsOptional(this
                                                   ConferenceServices cs, RealTimeAddress conferenceAddress)
 {
     return(Task <bool> .Factory.FromAsync(
                cs.BeginCheckPasscodeIsOptional,
                cs.EndCheckPasscodeIsOptional, conferenceAddress, null));
 }
Esempio n. 2
0
 public static Task <Conference> UpdateConferenceAsync(this
                                                       ConferenceServices cs, ConferenceScheduleInformation information)
 {
     return(Task <Conference> .Factory.FromAsync(
                cs.BeginUpdateConference,
                cs.EndUpdateConference, information, null));
 }
Esempio n. 3
0
 public static Task <Conference> GetConferenceAsync(this
                                                    ConferenceServices cs, string conferenceId)
 {
     return(Task <Conference> .Factory.FromAsync(
                cs.BeginGetConference,
                cs.EndGetConference, conferenceId, null));
 }
Esempio n. 4
0
 public static Task CancelConferenceAsync(this
                                          ConferenceServices cs, string conferenceId)
 {
     return(Task.Factory.FromAsync(
                cs.BeginCancelConference,
                cs.EndCancelConference, conferenceId, null));
 }
Esempio n. 5
0
        private void EndScheduleConference(IAsyncResult ar)
        {
            ConferenceServices confSession = ar.AsyncState as ConferenceServices;

            try
            {
                //End schedule conference returns the conference object, which
                // contains the vast majority of the data relevant to that
                // conference.
                _conference = confSession.EndScheduleConference(ar);
                Console.WriteLine("");
                Console.WriteLine(" The conference is now scheduled.");
                Console.WriteLine("");
            }
            catch (ConferenceFailureException confFailEx)
            {
                // ConferenceFailureException may be thrown on failures to
                // schedule due to MCUs being absent or unsupported, or due to
                // malformed parameters.
                // TODO (Left to the reader): Add error handling code
                Console.WriteLine(confFailEx.ToString());
            }

            //Again, for sync. reasons.
            _waitForConferenceScheduling.Set();
        }
Esempio n. 6
0
 public static Task <bool> VerifyPasscodeAsync(this
                                               ConferenceServices cs, RealTimeAddress conferenceAddress,
                                               string passcode)
 {
     return(Task <bool> .Factory.FromAsync(
                cs.BeginVerifyPasscode,
                cs.EndVerifyPasscode, conferenceAddress, passcode, null));
 }
Esempio n. 7
0
 public static Task <ConferencingCapabilities> GetConferencingCapabilities(this
                                                                           ConferenceServices cs)
 {
     return(Task <ConferencingCapabilities> .Factory.FromAsync(
                cs.BeginGetConferencingCapabilities,
                cs.EndGetConferencingCapabilities,
                null));
 }
Esempio n. 8
0
 public static Task <string> GetConferenceUriByPhoneConferenceId(this
                                                                 ConferenceServices cs, string phoneConferenceId)
 {
     return(Task <string> .Factory.FromAsync(
                cs.BeginGetConferenceUriByPhoneConferenceId,
                cs.EndGetConferenceUriByPhoneConferenceId,
                phoneConferenceId, null));
 }
Esempio n. 9
0
        /// <summary>
        /// Overridden process method.
        /// </summary>
        public override void Process()
        {
            // Schedule the conference.
            ConferenceServices conferenceManagement = this.customerConversation.Endpoint.ConferenceServices;

            //Create a conference to anchor the incoming customer call
            ConferenceScheduleInformation conferenceScheduleInfo = new ConferenceScheduleInformation();

            conferenceScheduleInfo.AutomaticLeaderAssignment = AutomaticLeaderAssignment.Everyone;
            conferenceScheduleInfo.LobbyBypass        = LobbyBypass.EnabledForGatewayParticipants;
            conferenceScheduleInfo.AccessLevel        = ConferenceAccessLevel.Everyone;
            conferenceScheduleInfo.PhoneAccessEnabled = false;
            conferenceScheduleInfo.ExpiryTime         = DateTime.UtcNow.Add(TimeSpan.FromMinutes(60));

            bool      unhandledExceptionOccured = true;
            Exception caughtException           = null;

            try
            {
                conferenceManagement.BeginScheduleConference(conferenceScheduleInfo,
                                                             this.ConferenceScheduled,
                                                             conferenceManagement);
                unhandledExceptionOccured = false;
            }
            catch (InvalidOperationException ioe)
            {
                caughtException = ioe;
                Console.WriteLine("Exception during scheduling conference {0}", ioe);
                this.logger.Log("Exception during scheduling conference {0}", ioe);
                unhandledExceptionOccured = false;
            }
            finally
            {
                if (unhandledExceptionOccured)
                {
                    caughtException = new OperationFailureException();
                }

                if (caughtException != null)
                {
                    this.CompleteEstablishment(caughtException);
                }
            }
        }
Esempio n. 10
0
        /// <summary>
        /// Conference scheduled callback.
        /// </summary>
        /// <param name="asyncResult"></param>
        private void ConferenceScheduled(IAsyncResult asyncResult)
        {
            ConferenceServices conferenceManagement = asyncResult.AsyncState as ConferenceServices;

            bool      unhandledExceptionOccured = true;
            Exception caughtException           = null;

            try
            {
                conferenceManagement.EndScheduleConference(asyncResult);

                ConferenceJoinOptions options = new ConferenceJoinOptions();
                this.trustedConversation.ConferenceSession.BeginJoin(options, this.ConferenceJoinCompleted, null);

                unhandledExceptionOccured = false;
            }
            catch (InvalidOperationException ioe)
            {
                caughtException = ioe;
                Console.WriteLine("Exception during scheduling conference {0}", ioe);
                this.logger.Log("Exception during scheduling conference {0}", ioe);
                unhandledExceptionOccured = false;
            }
            catch (RealTimeException rte)
            {
                caughtException = rte;
                Console.WriteLine("Exception during scheduling conference {0}", rte);
                this.logger.Log("Exception during scheduling conference {0}", rte);
                unhandledExceptionOccured = false;
            }
            finally
            {
                if (unhandledExceptionOccured)
                {
                    caughtException = new OperationFailureException();
                }

                if (caughtException != null)
                {
                    this.CompleteEstablishment(caughtException);
                }
            }
        }
Esempio n. 11
0
        private void StartupScheduleConference(AsyncTask task, object state)
        {
            task.DoOneStep(
                delegate()
            {
                m_tcuConversation = new Conversation(m_parent.AppFrontEnd.Endpoint);
                m_tcuConversation.ApplicationContext = this;

                m_avmcuSession = m_tcuConversation.ConferenceSession.AudioVideoMcuSession;
                m_avmcuSession.ParticipantEndpointAttendanceChanged += this.ParticipantEndpointAttendanceChanged;

                ConferenceServices conferenceManagement = m_parent.AppFrontEnd.Endpoint.ConferenceServices;

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

                //schedule the conference
                conferenceManagement.BeginScheduleConference(conferenceScheduleInfo,
                                                             delegate(IAsyncResult sch)
                {
                    task.DoFinalStep(
                        delegate()
                    {
                        Conference conference;
                        conference      = conferenceManagement.EndScheduleConference(sch);
                        task.TaskResult = new ConferenceActionResult(conference);             // Store so that next task can get it.
                    });
                },
                                                             null);
            });
        }
Esempio n. 12
0
            internal void Process()
            {
                if (_anchor._conversation.State != ConversationState.Idle)
                {
                    if (null != _anchor._conference)
                    {
                        _anchor._conversation.ConferenceSession.BeginTerminateConference(ar =>
                        {
                            ConferenceSession confSession = ar.AsyncState as ConferenceSession;
                            confSession.EndTerminateConference(ar);

                            confSession.Conversation.Endpoint.ConferenceServices.BeginCancelConference(_anchor._conference.ConferenceId,
                                                                                                       cac =>
                            {
                                ConferenceServices confServices = cac.AsyncState as ConferenceServices;
                                try
                                {
                                    confServices.EndCancelConference(cac);
                                }
                                catch (RealTimeException)
                                {
                                    //TODO: trace statement
                                }
                                finally
                                {
                                    this.SetAsCompleted(null, false);
                                    _anchor.UpdateState(ConferenceServicesAnchorState.Terminated);
                                    foreach (ShutDownAsyncResult sar in _anchor._listOfShutDownAsyncResults)
                                    {
                                        sar.SetAsCompleted(null, false);
                                    }
                                }
                            },
                                                                                                       confSession.Conversation.Endpoint.ConferenceServices);
                        },
                                                                                         _anchor._conversation.ConferenceSession);
                    }
                    else
                    {
                        _anchor.Conversation.BeginTerminate(ter =>
                        {
                            _anchor.Conversation.EndTerminate(ter);

                            _anchor.UpdateState(ConferenceServicesAnchorState.Terminated);

                            foreach (ShutDownAsyncResult sar in _anchor._listOfShutDownAsyncResults)
                            {
                                sar.SetAsCompleted(null, false);
                            }

                            this.SetAsCompleted(null, false);
                        },
                                                            null);
                    }
                }
                else
                {
                    _anchor.Conversation.BeginTerminate(ter =>
                    {
                        _anchor.Conversation.EndTerminate(ter);

                        _anchor.UpdateState(ConferenceServicesAnchorState.Terminated);

                        foreach (ShutDownAsyncResult sar in _anchor._listOfShutDownAsyncResults)
                        {
                            sar.SetAsCompleted(null, false);
                        }

                        this.SetAsCompleted(null, false);
                    },
                                                        null);
                }
            }
Esempio n. 13
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);
                    }
                }
            }
Esempio n. 14
0
 public static Task <Collection <ConferenceSummary> > GetConferenceSummariesAsync(this
                                                                                  ConferenceServices cs, SchedulingTemplate schedulingTemplate)
 {
     return(Task <Collection <ConferenceSummary> > .Factory.FromAsync(
                cs.BeginGetConferenceSummaries,
                cs.EndGetConferenceSummaries, schedulingTemplate, null));
 }