示例#1
0
 private void btnStop_Click(object sender, EventArgs e)
 {
     daemon.Stop();
     lblInit.Text      = "sip服务已停止,请启动后再进行业务";
     lblInit.ForeColor = Color.Red;
 }
        public void Stop()
        {
            try
            {
                logger.Debug("SIP Application Server stopping...");

                m_dialPlanEngine.StopScriptMonitoring = true;

                if (m_accessPolicyHost != null && m_accessPolicyHost.State == CommunicationState.Opened)
                {
                    m_accessPolicyHost.Close();
                }

                if (m_sipProvisioningHost != null && m_sipProvisioningHost.State == CommunicationState.Opened)
                {
                    m_sipProvisioningHost.Close();
                }

                if (m_callManagerSvcHost != null && m_callManagerSvcHost.State == CommunicationState.Opened)
                {
                    m_callManagerSvcHost.Close();
                }

                if (m_sipNotificationsHost != null && m_sipNotificationsHost.State == CommunicationState.Opened)
                {
                    m_sipNotificationsHost.Close();
                }

                if (m_callManager != null)
                {
                    m_callManager.Stop();
                }

                if (m_rtccCore != null)
                {
                    m_rtccCore.Stop();
                }

                //if (m_notifyManager != null)
                //{
                //    m_notifyManager.Stop();
                //}

                if (m_monitorEventWriter != null)
                {
                    m_monitorEventWriter.Close();
                }

                if (m_sipProxyDaemon != null)
                {
                    m_sipProxyDaemon.Stop();
                }

                if (m_sipMonitorDaemon != null)
                {
                    m_sipMonitorDaemon.Stop();
                }

                if (m_sipRegistrarDaemon != null)
                {
                    m_sipRegistrarDaemon.Stop();
                }

                if (m_sipNotifierDaemon != null)
                {
                    m_sipNotifierDaemon.Stop();
                }

                if (m_sipRegAgentDaemon != null)
                {
                    m_sipRegAgentDaemon.Stop();
                }

                if (m_sipNotifierDaemon != null)
                {
                    m_sipNotifierDaemon.Stop();
                }

                if (m_rateUpdater != null)
                {
                    m_rateUpdater.Stop();
                }

                // Shutdown the SIPTransport layer.
                m_sipTransport.Shutdown();
                DNSManager.Stop();

                m_sipSorceryPersistor.StopCDRWrites = true;

                logger.Debug("SIP Application Server stopped.");
            }
            catch (Exception excp)
            {
                logger.Error("Exception SIPAppServerDaemon Stop." + excp.Message);
            }
        }