Exemplo n.º 1
0
            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);
            }
Exemplo n.º 2
0
            internal void Process()
            {
                _mohServer._mohPlayer.Stop();

                //close the source to release unmanaged resources
                _mohServer._mohFileSource.Close();

                List <AudioVideoFlow> listOfAudioVideoFlows = new List <AudioVideoFlow>(_mohServer._mohPlayer.AudioVideoFlows);

                listOfAudioVideoFlows.ForEach(avFlow => { _mohServer._mohPlayer.DetachFlow(avFlow); });

                lock (_mohServer._syncRoot)
                {
                    _mohServer._listOfPendingMohCallAsyncResults.ForEach(sdar => { sdar.SetAsCompleted(null, false); });
                    _mohServer.UpdateState(MusicOnHoldServerState.Terminated);
                }
                this.SetAsCompleted(null, false);
            }