コード例 #1
0
ファイル: BasicConferencing.cs プロジェクト: mujiansu/Lync
        private void EndDeliverInvitation(IAsyncResult ar)
        {
            ConferenceInvitation invitation = ar.AsyncState as ConferenceInvitation;

            try
            {
                invitation.EndDeliver(ar);
            }
            catch (OperationFailureException opFailEx)
            {
                // OperationFailureException: Indicates failure to connect the
                // call to the remote party.
                // TODO (Left to the reader): Add error handling code
                Console.WriteLine(opFailEx.ToString());
            }
            catch (RealTimeException exception)
            {
                // RealTimeException may be thrown on media or link-layer failures.
                // TODO (Left to the reader): Add error handling code
                Console.WriteLine(exception.ToString());
            }
            finally
            {
                //Again, just to sync the completion of the code.
                _waitForConversationInviteRemoteParticipants.Set();
            }
        }
コード例 #2
0
ファイル: GetContactService.cs プロジェクト: mujiansu/Lync
 private void SendConferenceInvitation(AsyncTask task, object state)
 {
     task.DoOneStep(
         delegate()
     {
         string uriToDialOutTo     = (string)state;
         McuDialOutOptions options = new McuDialOutOptions();
         options.Issuer            = this.CustomerSession.CustomerConversation.LocalParticipant;
         ConferenceInvitationSettings convSettings = new ConferenceInvitationSettings();
         convSettings.AvailableMediaTypes.Add(MediaType.Audio);
         var confInvitation = new ConferenceInvitation(this.CustomerSession.CustomerConversation, convSettings);
         this.StartMusic();
         confInvitation.BeginDeliver(
             uriToDialOutTo,
             delegate(IAsyncResult ar)
         {
             task.DoFinalStep(
                 delegate()
             {
                 this.StopMusic();
                 confInvitation.EndDeliver(ar);
             });
         },
             null);
     });
 }
コード例 #3
0
        // Callback method referred to in the call to BeginDeliver on the ConferenceInvitation instance.
        private void InvitationDeliverCB(IAsyncResult ar)
        {
            ConferenceInvitation conferenceInvite = ar.AsyncState as ConferenceInvitation;

            try
            {
                conferenceInvite.EndDeliver(ar);
            }

            // A production application should have catch blocks for a number
            // of other exceptions, including FailureResponseException, OperationTimeoutException,
            // and OperationFailureException.
            catch (RealTimeException exception)
            {
                Console.WriteLine(exception.ToString());
            }
            // Synchronize with main thread.
            _waitUntilConferenceInvitationIsDelivered.Set();
        }
コード例 #4
0
        private void InviteToConference(string uri, CompletionDelegate completionDelegate)
        {
            Debug.Assert(!string.IsNullOrEmpty(uri), "New user could not be null.");

            ConferenceInvitationSettings convSettings = new ConferenceInvitationSettings();

            convSettings.AvailableMediaTypes.Add(MediaType.Audio);
            var confInvitation = new ConferenceInvitation(this.CustomerSession.CustomerConversation, convSettings);

            try
            {
                if (this.CustomerSession.RosterTrackingService.ParticipantCount == 1)
                {
                    this.StartMusic(this.CustomerSession.CustomerServiceChannel.ServiceChannelCall);
                }
                confInvitation.BeginDeliver(
                    uri,
                    ar =>
                {
                    try
                    {
                        confInvitation.EndDeliver(ar);
                        completionDelegate(null);
                    }
                    catch (RealTimeException rte)
                    {
                        this.StopMusic(this.CustomerSession.CustomerServiceChannel.ServiceChannelCall);
                        completionDelegate(rte);
                    }
                }, null);
            }
            catch (InvalidOperationException ioe)
            {
                this.Logger.Log(Logger.LogLevel.Error, ioe);
                this.StopMusic(this.CustomerSession.CustomerServiceChannel.ServiceChannelCall);
                completionDelegate(ioe);
            }
        }
コード例 #5
0
        private void InviteRecipientToConference()
        {
            Console.WriteLine("Inviting the recipient (" + _recipientSipUri + ") to incoming call.");
            ConferenceInvitation invitation = new ConferenceInvitation(_backEndCallLeg.Conversation);

            try
            {
                // Invite the recipient to the conference using a conference invitation.
                invitation.BeginDeliver(
                    _recipientSipUri,
                    deliverAsyncResult =>
                    {
                        try
                        {
                            invitation.EndDeliver(deliverAsyncResult);
                            Console.WriteLine("Invited recipient to the conference.");
                        }
                        catch (RealTimeException ex)
                        {
                            Console.WriteLine(ex);
                        }
                    },
                    null);
            }
            catch (InvalidOperationException ex)
            {
                Console.WriteLine(ex);
            }
        }