コード例 #1
0
        /// <summary>
        /// Conference join callback.
        /// </summary>
        /// <param name="asyncResult"></param>
        private void ConferenceJoinCompleted(IAsyncResult asyncResult)
        {
            bool      unhandledExceptionOccured = true;
            Exception caughtException           = null;

            try
            {
                this.trustedConversation.ConferenceSession.EndJoin(asyncResult);

                var options = new AudioVideoMcuDialOutOptions();
                options.Media.Add(new McuMediaChannel(MediaType.Audio, McuMediaChannelStatus.SendReceive));
                options.ParticipantUri = this.parent.CustomerUri;

                this.trustedConversation.ConferenceSession.AudioVideoMcuSession.BeginDialOut(
                    this.trustedConversation.Endpoint.EndpointUri,
                    options,
                    this.SelfDialOutCompleted,
                    null);

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

                if (caughtException != null)
                {
                    this.CompleteEstablishment(caughtException);
                }
            }
        }
コード例 #2
0
        private void DialOut(string destinationUri, string rosterUri, string displayName, CompletionDelegate completionDelegate)
        {
            try
            {
                var avmcuSession = this.CustomerSession.CustomerConversation.ConferenceSession.AudioVideoMcuSession;
                AudioVideoMcuDialOutOptions options = new AudioVideoMcuDialOutOptions();
                options.PrivateAssistantDisabled = true;
                options.ParticipantUri           = rosterUri; // uri that is shown in Roster.
                options.ParticipantDisplayName   = displayName;
                bool stopMusic = false;
                if (this.CustomerSession.RosterTrackingService.ParticipantCount == 1)
                {
                    this.StartMusic(this.CustomerSession.CustomerServiceChannel.ServiceChannelCall);
                    stopMusic = true;
                }

                avmcuSession.BeginDialOut(
                    destinationUri, // Uri to send the dial out to.
                    options,
                    ar =>
                {
                    try
                    {
                        if (stopMusic)
                        {
                            this.StopMusic(this.CustomerSession.CustomerServiceChannel.ServiceChannelCall);
                        }
                        avmcuSession.EndDialOut(ar);
                        completionDelegate(null);
                    }
                    catch (RealTimeException rte)
                    {
                        completionDelegate(rte);
                    }
                },
                    null);
            }
            catch (InvalidOperationException ioe)
            {
                completionDelegate(ioe);
            }
        }