private void ManagerIsAliveCompleted(object sender, SIPSorcery.SIPSorceryManagerClient.IsAliveCompletedEventArgs e)
 {
     if (IsManagerAliveComplete != null)
     {
         IsManagerAliveComplete(e);
     }
 }
 public void SIPMonitorMachineEventHandler(SIPSorcery.SIP.App.SIPMonitorMachineEvent machineEvent)
 {
     // Update the calls display.
     if (m_initialLoadComplete && !m_sipCallsPanelRefreshInProgress)
     {
         m_sipCallsPanel.RefreshAsync();
     }
 }
 public void SIPMonitorMachineEventHandler(SIPSorcery.SIP.App.SIPMonitorMachineEvent machineEvent)
 {
     // Update the bindings display.
     if (!m_sipAccountsPanelRefreshInProgress)
     {
         m_sipBindingsPanel.RefreshAsync();
     }
 }
        private void GetCustomerComplete(SIPSorcery.SIPSorceryProvisioningClient.GetCustomerCompletedEventArgs e) {
            if (e.Error != null) {
                UIHelper.SetText(m_statusTextBlock, e.Error.Message);
            }
            else {
                m_customer = e.Result;
                UIHelper.SetText(m_statusTextBlock, String.Empty);
                UIHelper.SetText(m_firstNameTextBox, m_customer.FirstName);
                UIHelper.SetText(m_lastNameTextBox, m_customer.LastName);
                UIHelper.SetText(m_emailAddressTextBox, m_customer.EmailAddress);
                UIHelper.SetText(m_securityAnswerTextBox, m_customer.SecurityAnswer);
                UIHelper.SetText(m_cityTextBox, m_customer.City);

                if (m_customer.WebSite != null)
                {
                    UIHelper.SetText(m_webSiteTextBox, m_customer.WebSite);
                }

                for (int questionIndex = 0; questionIndex < m_securityQuestionListBox.Items.Count; questionIndex++) {
                    if (((TextBlock)m_securityQuestionListBox.Items[questionIndex]).Text == m_customer.SecurityQuestion) {
                        m_securityQuestionListBox.SelectedIndex = questionIndex;
                        break;
                    }
                }

                for (int countryIndex = 0; countryIndex < m_countryListBox.Items.Count; countryIndex++) {
                    if (((TextBlock)m_countryListBox.Items[countryIndex]).Text == m_customer.Country) {
                        m_countryListBox.SelectedIndex = countryIndex;
                        break;
                    }
                }

                if (!m_customer.TimeZone.IsNullOrBlank()) {
                    for (int timezoneIndex = 0; timezoneIndex < m_timezoneListBox.Items.Count; timezoneIndex++) {
                        if (((TextBlock)m_timezoneListBox.Items[timezoneIndex]).Text == m_customer.TimeZone) {
                            m_timezoneListBox.SelectedIndex = timezoneIndex;
                            break;
                        }
                    }
                }

                SetUpdateButtonsEnabled(true);
            }
        }
 public void SIPMonitorMachineEventHandler(SIPSorcery.SIP.App.SIPMonitorMachineEvent machineEvent)
 {
     // Update the bindings display.
     if (!m_sipRegistrationAgentBindingsPanelRefreshInProgress)
     {
         m_sipProviderRegistrationsPanel.RefreshAsync();
     }
 }
 private void PersistorIsAliveComplete(SIPSorcery.SIPSorceryProvisioningClient.IsAliveCompletedEventArgs e)
 {
     /*try
     {
         if (!m_exit)
         {
             if (e.Error == null && m_sipNotifierClient == null)
             {
                 m_sipNotifierClient = new PollingDuplexClient(PollingClientDebugMessage, m_authId, m_notificationsURL);
                 m_sipNotifierClient.NotificationReceived += (notificationText) => {
                     SIPMonitorEvent monitorEvent = SIPMonitorEvent.ParseEventCSV(notificationText);
                     SIPEventMonitorClient_MonitorEventReceived((SIPMonitorMachineEvent)monitorEvent);};
                 m_sipNotifierClient.Closed += () => {
                     //if (m_sipNotifierClient != null)
                     //{
                     //    LogActivityMessage(MessageLevelsEnum.Warn, "Machine monitor notification channel closed at " + DateTime.Now.ToString("dd MMM yyyy HH:mm:ss") + ".");
                     //}
                     CloseNotificationChannel(true);
                 };
                 m_sipNotifierClient.Subscribe(SIPMonitorClientTypesEnum.Machine.ToString(), WILDCARD_EVENT_FILTER);
             }
             else
             {
                 //LogActivityMessage(MessageLevelsEnum.Warn, "Connection to notification server failed.");
                 if (!m_exit)
                 {
                     m_notificationsTimer = new Timer(delegate { m_persistor.IsAliveAsync(); }, null, NOTIFICATION_RECONNECT_DELAY, Timeout.Infinite);
                 }
             }
         }
     }
     catch
     {
         // LogActivityMessage(MessageLevelsEnum.Warn, "Connection to notification server failed.");
         if (!m_exit)
         {
             m_notificationsTimer = new Timer(delegate { m_persistor.IsAliveAsync(); }, null, NOTIFICATION_RECONNECT_DELAY, Timeout.Infinite);
         }
     }*/
 }
        public string AddSIPAccount(SIPSorcery.Entities.SIPAccount sipAccount)
        {
            Customer customer = AuthoriseRequest();
            sipAccount.Owner = customer.CustomerUsername;

            //string validationError = SIPAccount.ValidateAndClean(sipAccount);
            string validationError = SIPSorcery.Entities.SIPAccount.Validate(sipAccount);
            if (validationError != null)
            {
                logger.Warn("Validation error in AddSIPAccount for customer " + customer.CustomerUsername + ". " + validationError);
                throw new ApplicationException(validationError);
            }
            else
            {
                //return SIPAccountPersistor.Add(sipAccount);
                return m_service.InsertSIPAccount(customer.CustomerUsername, sipAccount);
            }
        }