Esempio n. 1
0
        internal IAsyncResult BeginTerminateMohChannel(AcdServiceChannel channel, AsyncCallback userCallback, object state)
        {
            TerminateMoHChannelAsyncResult ar = new TerminateMoHChannelAsyncResult(this, channel, userCallback, state);

            lock (_syncRoot)
            {
                if (_state == MusicOnHoldServerState.Started)
                {
                    ThreadPool.QueueUserWorkItem((waitState) =>
                    {
                        var tempAr = waitState as TerminateMoHChannelAsyncResult;
                        tempAr.Process();
                    }, ar);
                }
                else
                {
                    throw new InvalidOperationException("AcdMusicOnHoldServer is shutting down or in an invalid state to perform this action.");
                }
            }

            return(ar);
        }
Esempio n. 2
0
        internal void EndTerminateMohChannel(IAsyncResult ar)
        {
            TerminateMoHChannelAsyncResult result = ar as TerminateMoHChannelAsyncResult;

            result.EndInvoke();
        }