private void StartMusicOnHoldPlayback(object sender, AudioVideoFlowConfigurationRequestedEventArgs args) { _mohServer._mohPlayer.AttachFlow(args.Flow); _mohServer._mohPlayer.StateChanged += this.OnPlayerStateChanged; _mohServer._mohFileSource.BeginPrepareSource( MediaSourceOpenMode.Buffered, ar => { WmaFileSource fileSource = ar.AsyncState as WmaFileSource; try { fileSource.EndPrepareSource(ar); _mohServer._mohPlayer.Start(); } catch (OperationFailureException ex) { _mohServer.BeginShutDown( sar => { AcdMusicOnHoldServer mohServer = sar.AsyncState as AcdMusicOnHoldServer; mohServer.EndShutDown(sar); }, _mohServer); this.SetAsCompleted(ex, false); } }, _mohServer._mohFileSource); }
internal void Process() { _mohServer._mohFileSource.BeginPrepareSource( MediaSourceOpenMode.Buffered, ar => { WmaFileSource fileSource = ar.AsyncState as WmaFileSource; try { fileSource.EndPrepareSource(ar); _mohServer._mohPlayer.Start(); lock (_mohServer._syncRoot) { _mohServer.UpdateState(MusicOnHoldServerState.Started); } this.SetAsCompleted(null, false); } catch (OperationFailureException ex) { _mohServer.BeginShutDown( sar => { AcdMusicOnHoldServer mohServer = sar.AsyncState as AcdMusicOnHoldServer; mohServer.EndShutDown(sar); }, _mohServer); this.SetAsCompleted(ex, false); } }, _mohServer._mohFileSource); }
internal TerminateMoHChannelAsyncResult( AcdMusicOnHoldServer mohServer, AcdServiceChannel channel, AsyncCallback userCallback, object state) : base(userCallback, state) { _mohServer = mohServer; _mohChannel = channel; }
internal EstablishMoHChannelAsyncResult (AcdMusicOnHoldServer mohServer, string participantUri, AcdConferenceServicesAnchor anchor, AsyncCallback userCallback, object state) : base(userCallback, state) { _mohServer = mohServer; _anchor = anchor; _participantUri = participantUri; }
internal ShutDownAsyncResult(AcdMusicOnHoldServer mohServer, AsyncCallback userCallback, object state) : base(userCallback, state) { _mohServer = mohServer; }
internal StartUpAsyncResult(AcdMusicOnHoldServer mohServer, AsyncCallback userCallback, object state) : base(userCallback, state) { _mohServer = mohServer; _mohServer._mohPlayer.StateChanged += this.OnPlayerStateChanged; }
/// <summary> /// Starts subscribing to the Presence of agents upon successful registration of the endpoint /// </summary> private void OnEstablishComplete(IAsyncResult result) { try { _matchMaker._endpoint.EndEstablish(result); //create a SubscriptionTarget for each agent RemotePresentitySubscriptionTarget[] contacts = new RemotePresentitySubscriptionTarget[_matchMaker._configuration.Agents.Count]; for (int i = 0; i < _matchMaker.Configuration.Agents.Count; i++) { contacts[i] = new RemotePresentitySubscriptionTarget(_matchMaker._configuration.Agents[i].SignInAddress); } RemotePresenceView MatchMakerPresence = new RemotePresenceView(_matchMaker._endpoint); //Initiate the persistent batch subscription to the list of agents //Only interested in subscribing to the Agents Availability. We should not expect more than one category instance //per Remote Presentity notification change. Always register the event handler before starting the subscription. MatchMakerPresence.PresenceNotificationReceived += _matchMaker.HandleAgentAvailabilityChanged; MatchMakerPresence.StartSubscribingToPresentities(contacts); try { _matchMaker._mohServer = new AcdMusicOnHoldServer(_matchMaker, _matchMaker.Configuration.MusicOnHoldFilePath, _matchMaker._logger); _matchMaker._mohServer.BeginStartUp(ar => { AcdMusicOnHoldServer mohServer = ar.AsyncState as AcdMusicOnHoldServer; mohServer.EndStartUp(ar); lock (_matchMaker._syncRoot) { _matchMaker.UpdateState(MatchMakerState.Started); } this.SetAsCompleted(null, false); }, _matchMaker._mohServer); } catch (RealTimeException ex) { _matchMaker._logger.Log("AcdAgentMatchMaker failed to subscribe to the Presence of its Agents", ex); _matchMaker.BeginShutdown((asyncResult) => { _matchMaker.EndShutdown(asyncResult); this.SetAsCompleted(ex, false); }, ex); } } catch (RealTimeException ex) { _matchMaker._logger.Log("AcdAgentMatchMaker failed to subscribe to the Presence of its Agents; verify your agent configuration.", ex); this.SetAsCompleted(ex, false); _matchMaker.BeginShutdown((asyncResult) => { _matchMaker.EndShutdown(asyncResult); this.SetAsCompleted(ex, false); }, ex); } }