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(); } }
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); }); }
// 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(); }
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); } }
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); } }