Пример #1
0
        /// <summary>
        /// Cleans up any resources being used.
        /// </summary>
        public void Dispose()
        {
            if (m_IsDisposed)
            {
                return;
            }
            m_IsDisposed = true;

            if (m_pStack != null)
            {
                m_pStack.Dispose();
                m_pStack = null;
            }
            m_pRegistrar     = null;
            m_pB2BUA         = null;
            m_pProxyContexts = null;
        }
Пример #2
0
        /// <summary>
        /// Cleans up any resources being used.
        /// </summary>
        public void Dispose()
        {
            lock (m_pLock)
            {
                if (m_IsDisposed)
                {
                    return;
                }

                // Hang up all calls.
                foreach (SIP_UA_Call call in m_pCalls.ToArray())
                {
                    call.Terminate();
                }

                // Wait till all registrations and calls disposed or wait timeout reached.
                DateTime start = DateTime.Now;
                while (m_pCalls.Count > 0)
                {
                    Thread.Sleep(500);

                    // Timeout, just kill all UA.
                    if (((DateTime.Now - start)).Seconds > 15)
                    {
                        break;
                    }
                }

                m_IsDisposed = true;

                RequestReceived = null;
                IncomingCall    = null;

                m_pStack.Dispose();
                m_pStack = null;
            }
        }