public static Task <Conference> UpdateConferenceAsync(this ConferenceServices cs, ConferenceScheduleInformation information) { return(Task <Conference> .Factory.FromAsync( cs.BeginUpdateConference, cs.EndUpdateConference, information, null)); }
public static Task<Conference> ScheduleConferenceAsync(this ConferenceServices cs, ConferenceScheduleInformation information) { return Task<Conference>.Factory.FromAsync( cs.BeginScheduleConference, cs.EndScheduleConference, information, null); }
public static Task<Conference> ScheduleConferenceAsync(this ConferenceServices self, ConferenceScheduleInformation information) { return Task.Factory.FromAsync<ConferenceScheduleInformation, Conference>( self.BeginScheduleConference, self.EndScheduleConference, information, null); }
/// <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); } } }
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); }); }
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); } } }
public Location(int id, string name, string fileName, LocalEndpoint endpoint) { if (!File.Exists(fileName)) throw new FileNotFoundException(fileName); _id = id; _Name = name; _FileName = fileName; _Endpoint = endpoint; ConferenceScheduleInformation csi = new ConferenceScheduleInformation() { AccessLevel = ConferenceAccessLevel.Everyone, Description = _Name, ExpiryTime = DateTime.Now.AddYears(5), AutomaticLeaderAssignment = AutomaticLeaderAssignment.Everyone }; csi.Mcus.Add(new ConferenceMcuInformation(McuType.AudioVideo)); _Endpoint.ConferenceServices.BeginScheduleConference(csi, ar => { try { _conference = _Endpoint.ConferenceServices.EndScheduleConference(ar); Log("Conference " + _conference.ConferenceId + " scheduled. Starting music..."); Log(_conference.ConferenceUri); ConversationSettings cs = new ConversationSettings() { Subject = _Name }; _conversation = new Conversation(_Endpoint, cs); ConferenceJoinOptions cjo = new ConferenceJoinOptions() { JoinMode = JoinMode.TrustedParticipant }; _conversation.ConferenceSession.BeginJoin(_conference.ConferenceUri, cjo, ar1 => { try { _conversation.ConferenceSession.EndJoin(ar1); _avCall = new AudioVideoCall(_conversation); _avCall.AudioVideoFlowConfigurationRequested += new EventHandler<AudioVideoFlowConfigurationRequestedEventArgs>(_avCall_AudioVideoFlowConfigurationRequested); AudioVideoCallEstablishOptions options = new AudioVideoCallEstablishOptions() { UseGeneratedIdentityForTrustedConference = true, SupportsReplaces = CapabilitySupport.Supported }; _avCall.BeginEstablish( options, ar2 => { try { _avCall.EndEstablish(ar2); } catch (Exception ex) { Log(ex.ToString()); } }, null); } catch (Exception ex) { Log(ex.ToString()); } }, null); } catch (Exception ex) { Log(ex.ToString()); } }, null); }
private void Run() { // A helper class to take care of platform and endpoint setup and // cleanup. This has been abstracted from this sample to focus on // Call Control. _helper = new UCMASampleHelper(); // Create a user endpoint, using the network credential object // defined above. _callerEndpoint = _helper.CreateEstablishedUserEndpoint( "Conference Leader" /* friendly name for conference leader endpoint */); // Create a second user endpoint, using the network credential object // defined above. _calleeEndpoint = _helper.CreateEstablishedUserEndpoint( "Conference Attendee" /* friendly name for conference attendee endpoint */); // Get the URI for the user logged onto Microsoft Lync String _ocUserURI = "sip:" + UCMASampleHelper.PromptUser( "Enter the URI for the user logged onto Microsoft Lync, in the User@Host format => ", "RemoteUserURI" /* key to specify remote user's URI in app.config */); // One of the endpoints schedules the conference in advance. At // schedule time, all the conference settings are set. // The base conference settings object, used to set the policies for the conference. ConferenceScheduleInformation conferenceScheduleInformation = new ConferenceScheduleInformation(); // An open meeting (participants can join who are not on the list), // but requiring authentication (no anonymous users allowed.) conferenceScheduleInformation.AccessLevel = ConferenceAccessLevel.SameEnterprise; // The below flag determines whether or not the passcode is optional // for users joining the conference. conferenceScheduleInformation.IsPasscodeOptional = true; conferenceScheduleInformation.Passcode = "1357924680"; // The verbose description of the conference conferenceScheduleInformation.Description = "Interesting Description"; // The below field indicates the date and time after which the conference can be deleted. conferenceScheduleInformation.ExpiryTime = System.DateTime.Now.AddHours(5); // These two lines assign a set of modalities (here, only // InstantMessage) from the available MCUs to the conference. Custom // modalities (and their corresponding MCUs) may be added at this // time as part of the extensibility model. ConferenceMcuInformation instantMessageMCU = new ConferenceMcuInformation(McuType.InstantMessaging); conferenceScheduleInformation.Mcus.Add(instantMessageMCU); // Now that the setup object is complete, schedule the conference // using the conference services off of Endpoint. Note: the conference // organizer is considered a leader of the conference by default. _callerEndpoint.ConferenceServices.BeginScheduleConference(conferenceScheduleInformation, EndScheduleConference, _callerEndpoint.ConferenceServices); // Wait for the scheduling to complete. _waitForConferenceScheduling.WaitOne(); // Now that the conference is scheduled, it's time to join it. As we // already have a reference to the conference object populated from // the EndScheduleConference call, we do not need to get the // conference first. Initialize a conversation off of the endpoint, // and join the conference from the uri provided above. Conversation callerConversation = new Conversation(_callerEndpoint); callerConversation.ConferenceSession.StateChanged += new EventHandler <StateChangedEventArgs <ConferenceSessionState> >(ConferenceSession_StateChanged); // Join and wait, again forcing synchronization. callerConversation.ConferenceSession.BeginJoin(_conference.ConferenceUri, null /*joinOptions*/, EndJoinConference, callerConversation.ConferenceSession); _waitForConferenceJoin.WaitOne(); // Placing the calls on the conference-connected conversation // connects to the respective MCUs. These calls may then be used to // communicate with the conference/MCUs. InstantMessagingCall instantMessagingCall = new InstantMessagingCall(callerConversation); // Hooking up event handlers and then placing the call. instantMessagingCall.InstantMessagingFlowConfigurationRequested += this.instantMessagingCall_InstantMessagingFlowConfigurationRequested; instantMessagingCall.StateChanged += this._call_StateChanged; instantMessagingCall.BeginEstablish(EndCallEstablish, instantMessagingCall); //Synchronize to ensure that call has completed. _waitForCallEstablish.WaitOne(); //send conf invite ConferenceInvitationDeliverOptions deliverOptions = new ConferenceInvitationDeliverOptions(); deliverOptions.ToastMessage = new ToastMessage("Welcome to my conference"); ConferenceInvitation invitation = new ConferenceInvitation(callerConversation); invitation.BeginDeliver(_ocUserURI, deliverOptions, EndDeliverInvitation, invitation); // Synchronize to ensure that invitation is complete _waitForConversationInviteRemoteParticipants.WaitOne(); //And from the other endpoint's perspective: //Initialize a conversation off of the endpoint, and join the //conference from the uri provided above. Conversation calleeConversation = new Conversation(_calleeEndpoint); calleeConversation.ConferenceSession.StateChanged += new EventHandler <StateChangedEventArgs <ConferenceSessionState> >(ConferenceSession_StateChanged); // Join and wait, again forcing synchronization. calleeConversation.ConferenceSession.BeginJoin(_conference.ConferenceUri, null /*joinOptions*/, EndJoinConference, calleeConversation.ConferenceSession); _waitForConferenceJoin.WaitOne(); // Placing the calls on the conference-connected conversation // connects to the respective MCUs. These calls may then be used to //communicate with the conference/MCUs. InstantMessagingCall instantMessagingCall2 = new InstantMessagingCall(calleeConversation); //Hooking up event handlers and then placing the call. instantMessagingCall2.InstantMessagingFlowConfigurationRequested += this.instantMessagingCall2_InstantMessagingFlowConfigurationRequested; instantMessagingCall2.StateChanged += this._call_StateChanged; instantMessagingCall2.BeginEstablish(EndCallEstablish, instantMessagingCall2); //Synchronize to ensure that call has completed. _waitForCallEstablish.WaitOne(); //Synchronize to ensure that all messages are sent and received _waitForMessageReceived.WaitOne(); //Wait for shutdown initiated by user _waitForShutdown.WaitOne(); UCMASampleHelper.PauseBeforeContinuing("Press ENTER to shutdown and exit."); }
public Location(int id, string name, string fileName, LocalEndpoint endpoint) { if (!File.Exists(fileName)) { throw new FileNotFoundException(fileName); } _id = id; _Name = name; _FileName = fileName; _Endpoint = endpoint; ConferenceScheduleInformation csi = new ConferenceScheduleInformation() { AccessLevel = ConferenceAccessLevel.Everyone, Description = _Name, ExpiryTime = DateTime.Now.AddYears(5), AutomaticLeaderAssignment = AutomaticLeaderAssignment.Everyone }; csi.Mcus.Add(new ConferenceMcuInformation(McuType.AudioVideo)); _Endpoint.ConferenceServices.BeginScheduleConference(csi, ar => { try { _conference = _Endpoint.ConferenceServices.EndScheduleConference(ar); Log("Conference " + _conference.ConferenceId + " scheduled. Starting music..."); Log(_conference.ConferenceUri); ConversationSettings cs = new ConversationSettings() { Subject = _Name }; _conversation = new Conversation(_Endpoint, cs); ConferenceJoinOptions cjo = new ConferenceJoinOptions() { JoinMode = JoinMode.TrustedParticipant }; _conversation.ConferenceSession.BeginJoin(_conference.ConferenceUri, cjo, ar1 => { try { _conversation.ConferenceSession.EndJoin(ar1); _avCall = new AudioVideoCall(_conversation); _avCall.AudioVideoFlowConfigurationRequested += new EventHandler <AudioVideoFlowConfigurationRequestedEventArgs>(_avCall_AudioVideoFlowConfigurationRequested); AudioVideoCallEstablishOptions options = new AudioVideoCallEstablishOptions() { UseGeneratedIdentityForTrustedConference = true, SupportsReplaces = CapabilitySupport.Supported }; _avCall.BeginEstablish( options, ar2 => { try { _avCall.EndEstablish(ar2); } catch (Exception ex) { Log(ex.ToString()); } }, null); } catch (Exception ex) { Log(ex.ToString()); } }, null); } catch (Exception ex) { Log(ex.ToString()); } }, null); }