Exemplo n.º 1
0
        public void Start()
        {
            try
            {
                logger.Debug("SIP Notifier Daemon starting...");

                // Pre-flight checks.
                if (m_sipNotifierSocketsNode == null || m_sipNotifierSocketsNode.ChildNodes.Count == 0)
                {
                    throw new ApplicationException("The SIP Notifier cannot start without at least one socket specified to listen on, please check config file.");
                }

                // Send events from this process to the monitoring socket.
                if (m_monitorLoopbackPort != 0)
                {
                    // Events will be sent by the monitor channel to the loopback interface and this port.
                    m_monitorEventWriter = new SIPMonitorEventWriter(m_monitorLoopbackPort);
                    logger.Debug("Monitor channel initialised for 127.0.0.1:" + m_monitorLoopbackPort + ".");
                }

                // Configure the SIP transport layer.
                m_sipTransport = new SIPTransport(SIPDNSManager.ResolveSIPService, new SIPTransactionEngine(), false);
                List <SIPChannel> sipChannels = SIPTransportConfig.ParseSIPChannelsNode(m_sipNotifierSocketsNode);
                m_sipTransport.AddSIPChannel(sipChannels);

                m_notifierCore = new NotifierCore(
                    FireSIPMonitorEvent,
                    m_sipTransport,
                    GetCustomer_External,
                    GetDialogues_External,
                    GetDialogue_External,
                    GetCanonicalDomain_External,
                    m_sipAssetPersistor,
                    GetBindingsCount_External,
                    SIPAuthenticateRequest_External,
                    m_outboundProxy,
                    m_publisher);

                m_notifyManager = new SIPNotifyManager(
                    m_sipTransport,
                    m_outboundProxy,
                    FireSIPMonitorEvent,
                    m_sipAssetPersistor.Get,
                    GetSIPRegistrarBindings_External,
                    GetCanonicalDomain_External);

                m_sipTransport.SIPTransportRequestReceived += GotRequest;

                logger.Debug("SIP Notifier Daemon successfully started.");
            }
            catch (Exception excp)
            {
                logger.Error("Exception SIPNotifierDaemon Start. " + excp.Message);
            }
        }