SIPSorcery.MonitoringConsole.SetNotifierClient C# (CSharp) Method

SetNotifierClient() public method

public SetNotifierClient ( SIPSorceryNotificationClient notificationsClient ) : void
notificationsClient SIPSorceryNotificationClient
return void
        public void SetNotifierClient(SIPSorceryNotificationClient notificationsClient)
        {
            m_sipNotifierClient = notificationsClient;
            m_sipNotifierClient.ControlEventReceived += (eventStr) => { AppendMonitorText(eventStr); };
        }

Usage Example

Esempio n. 1
0
        private void GetCustomerCompleted(LoadOperation <Customer> lo)
        {
            if (lo.HasError)
            {
                LogActivityMessage(MessageLevelsEnum.Warn, "Error loading API key for notifications service. " + lo.Error.Message);
                lo.MarkErrorAsHandled();
            }
            else
            {
                SIPEntitiesDomainContext riaContext = (SIPEntitiesDomainContext)lo.UserState;
                Customer customer = riaContext.Customers.FirstOrDefault();

                if (customer == null)
                {
                    LogActivityMessage(MessageLevelsEnum.Warn, "User record could not be loaded when attempting to retrieve API key for notifications service.");
                }
                else
                {
                    CDR.TimeZoneOffsetMinutes = customer.TimeZoneOffsetMinutes;
                    SIPProviderBinding.TimeZoneOffsetMinutes  = customer.TimeZoneOffsetMinutes;
                    SIPRegistrarBinding.TimeZoneOffsetMinutes = customer.TimeZoneOffsetMinutes;
                    SIPAccount.TimeZoneOffsetMinutes          = customer.TimeZoneOffsetMinutes;
                    m_serviceLevelTextBlock.Text = customer.ServiceLevel;

                    if (!m_notificationsURL.StartsWith("disable"))
                    {
                        m_sipNotifierClient = new SIPSorceryNotificationClient(LogActivityMessage, m_notificationsURL, customer.APIKey);
                        m_sipNotifierClient.StatusChanged        += NotificationsServiceStatusChanged;
                        m_sipNotifierClient.MachineEventReceived += SIPEventMonitorClient_MonitorEventReceived;
                        m_monitorConsole.SetNotifierClient(m_sipNotifierClient);
                        m_sipNotifierClient.Connect();
                    }
                }
            }
        }