public SIPProvisioningWebService(
            SIPAssetPersistor <SIPAccount> sipAccountPersistor,
            SIPAssetPersistor <SIPDialPlan> sipDialPlanPersistor,
            SIPAssetPersistor <SIPProvider> sipProviderPersistor,
            SIPAssetPersistor <SIPProviderBinding> sipProviderBindingsPersistor,
            SIPAssetPersistor <SIPRegistrarBinding> sipRegistrarBindingsPersistor,
            SIPAssetPersistor <SIPDialogueAsset> sipDialoguePersistor,
            SIPAssetPersistor <SIPCDRAsset> sipCDRPersistor,
            CustomerSessionManager crmSessionManager,
            SIPDomainManager sipDomainManager,
            SIPMonitorLogDelegate log,
            int newCustomersAllowedLimit,
            bool inviteCodeRequired) :
            base(crmSessionManager)
        {
            SIPAccountPersistor           = sipAccountPersistor;
            DialPlanPersistor             = sipDialPlanPersistor;
            SIPProviderPersistor          = sipProviderPersistor;
            SIPProviderBindingsPersistor  = sipProviderBindingsPersistor;
            SIPRegistrarBindingsPersistor = sipRegistrarBindingsPersistor;
            SIPDialoguePersistor          = sipDialoguePersistor;
            SIPCDRPersistor            = sipCDRPersistor;
            SIPDomainManager           = sipDomainManager;
            LogDelegate_External       = log;
            m_newCustomersAllowedLimit = newCustomersAllowedLimit;
            m_inviteCodeRequired       = inviteCodeRequired;

            if (!String.IsNullOrEmpty(m_providerRegistrationsDisabled))
            {
                Boolean.TryParse(m_providerRegistrationsDisabled, out m_providerRegDisabled);
            }

            //SIPSorcery.Entities.Services.SIPEntitiesDomainService domainSvc = new Entities.Services.SIPEntitiesDomainService();
        }
 public SIPRegAgentDaemon(
     SIPAssetPersistor<SIPProvider> providerPersistor,
     SIPAssetPersistor<SIPProviderBinding> bindingPersistor)
 {
     m_providerPersistor = providerPersistor;
     m_bindingPersistor = bindingPersistor;
 }
 public SIPProvisioningWebService(
     SIPAssetPersistor <SIPAccount> sipAccountPersistor,
     SIPAssetPersistor <SIPDialPlan> sipDialPlanPersistor,
     SIPAssetPersistor <SIPProvider> sipProviderPersistor,
     SIPAssetPersistor <SIPProviderBinding> sipProviderBindingsPersistor,
     SIPAssetPersistor <SIPRegistrarBinding> sipRegistrarBindingsPersistor,
     SIPAssetPersistor <SIPDialogueAsset> sipDialoguePersistor,
     SIPAssetPersistor <SIPCDRAsset> sipCDRPersistor,
     CustomerSessionManager crmSessionManager,
     SIPDomainManager sipDomainManager,
     SIPMonitorLogDelegate log,
     int newCustomersAllowedLimit)
 {
     SIPAccountPersistor           = sipAccountPersistor;
     DialPlanPersistor             = sipDialPlanPersistor;
     SIPProviderPersistor          = sipProviderPersistor;
     SIPProviderBindingsPersistor  = sipProviderBindingsPersistor;
     SIPRegistrarBindingsPersistor = sipRegistrarBindingsPersistor;
     SIPDialoguePersistor          = sipDialoguePersistor;
     SIPCDRPersistor            = sipCDRPersistor;
     CRMCustomerPersistor       = crmSessionManager.CustomerPersistor;
     CRMSessionManager          = crmSessionManager;
     SIPDomainManager           = sipDomainManager;
     LogDelegate_External       = log;
     m_newCustomersAllowedLimit = newCustomersAllowedLimit;
 }
 public ProvisioningServiceInstanceProvider(
     SIPAssetPersistor <SIPAccount> sipAccountPersistor,
     SIPAssetPersistor <SIPDialPlan> sipDialPlanPersistor,
     SIPAssetPersistor <SIPProvider> sipProviderPersistor,
     SIPAssetPersistor <SIPProviderBinding> sipProviderBindingsPersistor,
     SIPAssetPersistor <SIPRegistrarBinding> sipRegistrarBindingsPersistor,
     SIPAssetPersistor <SIPDialogueAsset> sipDialoguePersistor,
     SIPAssetPersistor <SIPCDRAsset> sipCDRPersistor,
     CustomerSessionManager crmSessionManager,
     SIPDomainManager sipDomainManager,
     SIPMonitorLogDelegate log,
     int newCustomersAllowedLimit,
     bool inviteCodeRequired)
 {
     m_sipAccountPersistor           = sipAccountPersistor;
     m_sipDialPlanPersistor          = sipDialPlanPersistor;
     m_sipProviderPersistor          = sipProviderPersistor;
     m_sipProviderBindingsPersistor  = sipProviderBindingsPersistor;
     m_sipRegistrarBindingsPersistor = sipRegistrarBindingsPersistor;
     m_sipDialoguePersistor          = sipDialoguePersistor;
     m_sipCDRPersistor          = sipCDRPersistor;
     m_crmCustomerPersistor     = crmSessionManager.CustomerPersistor;
     m_crmSessionManager        = crmSessionManager;
     m_sipDomainManager         = sipDomainManager;
     m_logDelegate              = log;
     m_newCustomersAllowedLimit = newCustomersAllowedLimit;
     m_inviteCodeRequired       = inviteCodeRequired;
 }
        public void Read()
        {
            SIPAssetPersistor <SIPAccount> account = SIPAssetPersistorFactory <SIPAccount> .CreateSIPAssetPersistor(m_storageType, m_connStr, m_XMLFilename);

            _sipAccount = account;
            _accounts   = account.Get();
        }
 public CustomerSessionManager(SIPSorceryConfiguration sipSorceryConfig)
 {
     StorageTypes storageType = sipSorceryConfig.PersistenceStorageType;
     string connectionString = sipSorceryConfig.PersistenceConnStr;
     m_customerPersistor = SIPAssetPersistorFactory<Customer>.CreateSIPAssetPersistor(storageType, connectionString, CUSTOMERS_XML_FILENAME);
     m_customerSessionPersistor = SIPAssetPersistorFactory<CustomerSession>.CreateSIPAssetPersistor(storageType, connectionString, CUSTOMER_SESSIONS_XML_FILENAME);
 }
Exemple #7
0
 public SIPRegAgentDaemon(
     SIPAssetPersistor <SIPProvider> providerPersistor,
     SIPAssetPersistor <SIPProviderBinding> bindingPersistor)
 {
     m_providerPersistor = providerPersistor;
     m_bindingPersistor  = bindingPersistor;
 }
        static void Main(string[] args)
        {
            try
            {
                logger.Debug("SIP Notifier starting");

                m_sipNotifierStorageType    = (AppState.GetConfigSetting(m_storageTypeKey) != null) ? StorageTypesConverter.GetStorageType(AppState.GetConfigSetting(m_storageTypeKey)) : StorageTypes.Unknown;;
                m_sipNotifierStorageConnStr = AppState.GetConfigSetting(m_connStrKey);

                if (m_sipNotifierStorageType == StorageTypes.Unknown || m_sipNotifierStorageConnStr.IsNullOrBlank())
                {
                    throw new ApplicationException("The SIP Notifier cannot start with no persistence settings.");
                }

                if (m_sipNotifierStorageType == StorageTypes.XML && !Directory.Exists(m_sipNotifierStorageConnStr))
                {
                    throw new ApplicationException("Directory " + m_sipNotifierStorageConnStr + " does not exist for XML persistor.");
                }

                SIPAssetPersistor <Customer> customerPersistor = SIPAssetPersistorFactory <Customer> .CreateSIPAssetPersistor(m_sipNotifierStorageType, m_sipNotifierStorageConnStr, m_customersXMLFilename);

                SIPAssetPersistor <SIPAccount> sipAccountsPersistor = SIPAssetPersistorFactory <SIPAccount> .CreateSIPAssetPersistor(m_sipNotifierStorageType, m_sipNotifierStorageConnStr, m_sipAccountsXMLFilename);

                SIPAssetPersistor <SIPRegistrarBinding> sipRegistrarBindingsPersistor = SIPAssetPersistorFactory <SIPRegistrarBinding> .CreateSIPAssetPersistor(m_sipNotifierStorageType, m_sipNotifierStorageConnStr, m_registrarBindingsXMLFilename);

                SIPAssetPersistor <SIPDialogueAsset> sipDialoguePersistor = SIPAssetPersistorFactory <SIPDialogueAsset> .CreateSIPAssetPersistor(m_sipNotifierStorageType, m_sipNotifierStorageConnStr, m_sipDialoguesXMLFilename);

                SIPDomainManager sipDomainManager = new SIPDomainManager(m_sipNotifierStorageType, m_sipNotifierStorageConnStr);

                SIPNotifierDaemon daemon = new SIPNotifierDaemon(
                    customerPersistor.Get,
                    sipDialoguePersistor.Get,
                    sipDialoguePersistor.Get,
                    sipDomainManager.GetDomain,
                    sipAccountsPersistor,
                    sipRegistrarBindingsPersistor.Get,
                    sipAccountsPersistor.Get,
                    sipRegistrarBindingsPersistor.Count,
                    SIPRequestAuthenticator.AuthenticateSIPRequest,
                    null);

                if (args != null && args.Length == 1 && args[0].StartsWith("-c"))
                {
                    Thread daemonThread = new Thread(daemon.Start);
                    daemonThread.Start();
                    m_notifierUp.WaitOne();
                }
                else
                {
                    System.ServiceProcess.ServiceBase[] ServicesToRun;
                    ServicesToRun = new System.ServiceProcess.ServiceBase[] { new Service(daemon) };
                    System.ServiceProcess.ServiceBase.Run(ServicesToRun);
                }
            }
            catch (Exception excp)
            {
                Console.WriteLine("Exception Main. " + excp.Message);
                logger.Error("Exception Main. " + excp.Message);
            }
        }
Exemple #9
0
        public void Read()
        {
            SipAccountDataStorage = SIPAssetPersistorFactory <SIPAccount> .CreateSIPAssetPersistor(m_storageType, m_connStr, m_XMLFilename);

            SipAccountDataStorage.Added += Account_Added;
            _sipAccountsCache            = SipAccountDataStorage.Get();
        }
Exemple #10
0
        public SIPSorceryAuthorisationService()
        {
            SIPSorceryConfiguration sipSorceryConfig = new SIPSorceryConfiguration();

            CRMSessionManager    = new CustomerSessionManager(sipSorceryConfig);
            CRMCustomerPersistor = CRMSessionManager.CustomerPersistor;
        }
Exemple #11
0
        public CustomerSessionManager(SIPSorceryConfiguration sipSorceryConfig)
        {
            StorageTypes storageType      = sipSorceryConfig.PersistenceStorageType;
            string       connectionString = sipSorceryConfig.PersistenceConnStr;

            m_customerPersistor = SIPAssetPersistorFactory <Customer> .CreateSIPAssetPersistor(storageType, connectionString, CUSTOMERS_XML_FILENAME);

            m_customerSessionPersistor = SIPAssetPersistorFactory <CustomerSession> .CreateSIPAssetPersistor(storageType, connectionString, CUSTOMER_SESSIONS_XML_FILENAME);
        }
Exemple #12
0
 public RTCCCore(
     SIPMonitorLogDelegate logDelegate,
     SIPDialogueManager sipDialogueManager,
     SIPAssetPersistor <SIPDialogueAsset> sipDialoguePersistor)
 {
     Log_External           = logDelegate;
     m_sipDialogueManager   = sipDialogueManager;
     m_sipDialoguePersistor = sipDialoguePersistor;
 }
 public RTCCCore(
     SIPMonitorLogDelegate logDelegate,
     SIPDialogueManager sipDialogueManager,
     SIPAssetPersistor<SIPDialogueAsset> sipDialoguePersistor)
 {
     Log_External = logDelegate;
     m_sipDialogueManager = sipDialogueManager;
     m_sipDialoguePersistor = sipDialoguePersistor;
 }
 public SIPDomainManager(SIPAssetPersistor <SIPDomain> sipDomain)
 {
     m_sipDomainPersistor = sipDomain;
     //m_sipDomainPersistor = SIPAssetPersistorFactory<SIPDomain>.CreateSIPAssetPersistor(storageType, storageConnectionStr, m_storageFileName);
     //m_sipDomainPersistor.Added += new SIPAssetDelegate<SIPDomain>(d => { LoadSIPDomains(); });
     //m_sipDomainPersistor.Deleted += new SIPAssetDelegate<SIPDomain>(d => { LoadSIPDomains(); });
     //m_sipDomainPersistor.Updated += new SIPAssetDelegate<SIPDomain>(d => { LoadSIPDomains(); });
     //m_sipDomainPersistor.Modified += new SIPAssetsModifiedDelegate(() => { LoadSIPDomains(); });
     LoadSIPDomains();
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            try {
                logger.Debug("CustomerEmailConfirmation request from " + this.Context.Request.UserHostAddress + " for " + this.Request.QueryString["id"] + ".");

                string id = this.Request.QueryString["id"];
                if (!id.IsNullOrBlank())
                {
                    Guid customerId = new Guid(id);
                    m_crmPersistor = SIPAssetPersistorFactory <Customer> .CreateSIPAssetPersistor(m_crmStorageType, m_crmStorageConnStr, null);

                    Customer customer = m_crmPersistor.Get(customerId);

                    if (customer != null)
                    {
                        if (!customer.EmailAddressConfirmed)
                        {
                            customer.CreatedFromIPAddress  = this.Context.Request.UserHostAddress;
                            customer.EmailAddressConfirmed = true;

                            if (IsValidCustomer(m_validationRules, customer))
                            {
                                m_crmPersistor.Update(customer);
                                m_confirmed           = true;
                                m_confirmMessage.Text = "Thank you, your account has now been activated.";
                            }
                            else
                            {
                                customer.Suspended = true;
                                m_crmPersistor.Update(customer);
                                m_confirmed           = false;
                                m_confirmMessage.Text = "Your account has been confirmed but not approved. You will receive an email within 48 hours if it is approved.";
                            }
                        }
                        else
                        {
                            m_confirmed           = false;
                            m_confirmMessage.Text = "Your account has already been confirmed.";
                        }
                    }
                    else
                    {
                        m_confirmMessage.Text = "No matching customer record could be found. Please check that you entered the confirmation URL correctly.";
                    }
                }
                else
                {
                    m_confirmMessage.Text = "Your account could not be confirmed. Please check that you entered the confirmation URL correctly.";
                }
            }
            catch (Exception excp) {
                logger.Error("Exception CustomerEmailConfirmation. " + excp.Message);
                m_confirmMessage.Text = "There was an error confirming your account. Please check that you entered the confirmation URL correctly.";
            }
        }
Exemple #16
0
        public static SIPProvisioningWebService CreateProvisioningService()
        {
            try
            {
                m_serverStorageType    = (ConfigurationManager.AppSettings[m_storageTypeKey] != null) ? StorageTypesConverter.GetStorageType(ConfigurationManager.AppSettings[m_storageTypeKey]) : StorageTypes.Unknown;
                m_serverStorageConnStr = ConfigurationManager.AppSettings[m_connStrKey];
                Int32.TryParse(ConfigurationManager.AppSettings[NEW_CUSTOMERS_ALLOWED_LIMIT_KEY], out m_newCustomersAllowedLimit);
                Boolean.TryParse(ConfigurationManager.AppSettings[INVITE_CODE_REQUIRED_KEY], out m_inviteCodeRequired);

                if (m_serverStorageType == StorageTypes.Unknown || m_serverStorageConnStr.IsNullOrBlank())
                {
                    throw new ApplicationException("The Provisioning Web Service cannot start with no persistence settings specified.");
                }

                // Prevent users from creaing loopback or other crazy providers.
                m_disabledProviderServerPattern = ConfigurationManager.AppSettings[DISABLED_PROVIDER_SERVERS_PATTERN];
                if (!m_disabledProviderServerPattern.IsNullOrBlank())
                {
                    SIPProvider.DisallowedServerPatterns = m_disabledProviderServerPattern;
                }

                // The Registration Agent wants to know about any changes to SIP Provider entries in order to update any SIP
                // Provider bindings it is maintaining or needs to add or remove.
                SIPAssetPersistor <SIPProvider> sipProviderPersistor = SIPAssetPersistorFactory <SIPProvider> .CreateSIPAssetPersistor(m_serverStorageType, m_serverStorageConnStr, m_providersStorageFileName);

                SIPAssetPersistor <SIPProviderBinding> sipProviderBindingsPersistor = SIPAssetPersistorFactory <SIPProviderBinding> .CreateSIPAssetPersistor(m_serverStorageType, m_serverStorageConnStr, m_providerBindingsStorageFileName);

                SIPProviderBindingSynchroniser sipProviderBindingSynchroniser = new SIPProviderBindingSynchroniser(sipProviderBindingsPersistor);

                sipProviderPersistor.Added   += sipProviderBindingSynchroniser.SIPProviderAdded;
                sipProviderPersistor.Updated += sipProviderBindingSynchroniser.SIPProviderUpdated;
                sipProviderPersistor.Deleted += sipProviderBindingSynchroniser.SIPProviderDeleted;

                return(new SIPProvisioningWebService(
                           SIPAssetPersistorFactory <SIPAccountAsset> .CreateSIPAssetPersistor(m_serverStorageType, m_serverStorageConnStr, m_sipAccountsStorageFileName),
                           SIPAssetPersistorFactory <SIPDialPlan> .CreateSIPAssetPersistor(m_serverStorageType, m_serverStorageConnStr, m_dialplansStorageFileName),
                           sipProviderPersistor,
                           sipProviderBindingsPersistor,
                           SIPAssetPersistorFactory <SIPRegistrarBinding> .CreateSIPAssetPersistor(m_serverStorageType, m_serverStorageConnStr, m_registrarBindingsStorageFileName),
                           SIPAssetPersistorFactory <SIPDialogueAsset> .CreateSIPAssetPersistor(m_serverStorageType, m_serverStorageConnStr, m_dialoguesStorageFileName),
                           SIPAssetPersistorFactory <SIPCDRAsset> .CreateSIPAssetPersistor(m_serverStorageType, m_serverStorageConnStr, m_cdrsStorageFileName),
                           new CustomerSessionManager(m_serverStorageType, m_serverStorageConnStr),
                           new SIPDomainManager(m_serverStorageType, m_serverStorageConnStr),
                           (e) => { logger.Debug(e.Message); },
                           m_newCustomersAllowedLimit,
                           m_inviteCodeRequired));
            }
            catch (Exception excp)
            {
                logger.Error("Exception CreateProvisioningServicee. " + excp.Message);
                throw;
            }
        }
Exemple #17
0
 public SIPRegistrarDaemon(
     GetCanonicalDomainDelegate getDomain,
     SIPAssetGetDelegate <SIPAccountAsset> getSIPAccount,
     SIPAssetPersistor <SIPRegistrarBinding> registrarBindingsPersistor,
     SIPAuthenticateRequestDelegate sipRequestAuthenticator,
     SIPAssetPersistor <Customer> customerPersistor)
 {
     GetCanonicalDomain_External     = getDomain;
     GetSIPAccount_External          = getSIPAccount;
     m_registrarBindingsPersistor    = registrarBindingsPersistor;
     SIPAuthenticateRequest_External = sipRequestAuthenticator;
     CustomerPersistor_External      = customerPersistor;
 }
 public SIPRegistrarBindingsManager(
     //SIPMonitorLogDelegate sipMonitorEventLog,
     SIPAssetPersistor <SIPRegistrarBinding> bindingsPersistor,
     //SendNATKeepAliveDelegate sendNATKeepAlive,
     int maxBindingsPerAccount,
     SIPUserAgentConfigurationManager userAgentConfigs)
 {
     //SIPMonitorEventLog_External = sipMonitorEventLog;
     m_bindingsPersistor = bindingsPersistor;
     //SendNATKeepAlive_External = sendNATKeepAlive;
     m_maxBindingsPerAccount = (maxBindingsPerAccount != 0) ? maxBindingsPerAccount : DEFAULT_BINDINGS_PER_USER;
     m_userAgentConfigs      = userAgentConfigs;
 }
 public SIPRegistrarDaemon(
     GetCanonicalDomainDelegate getDomain,
     SIPAssetGetDelegate<SIPAccount> getSIPAccount,
     //SIPAssetGetFromDirectQueryDelegate<SIPAccount> getSIPAccountFromQuery,
     SIPAssetPersistor<SIPRegistrarBinding> registrarBindingsPersistor,
     SIPAuthenticateRequestDelegate sipRequestAuthenticator
     ) {
     GetCanonicalDomain_External = getDomain;
     GetSIPAccount_External = getSIPAccount;
     //GetSIPAccountFromQuery_External = getSIPAccountFromQuery;
     m_registrarBindingsPersistor = registrarBindingsPersistor;
     SIPAuthenticateRequest_External = sipRequestAuthenticator;
 }
        static void Main(string[] args)
        {
            try
            {
                logger.Debug("SIP Registration Agent starting");

                m_sipRegAgentStorageType    = (AppState.GetConfigSetting(m_storageTypeKey) != null) ? StorageTypesConverter.GetStorageType(AppState.GetConfigSetting(m_storageTypeKey)) : StorageTypes.Unknown;
                m_sipRegAgentStorageConnStr = AppState.GetConfigSetting(m_connStrKey);

                if (m_sipRegAgentStorageType == StorageTypes.Unknown || m_sipRegAgentStorageConnStr.IsNullOrBlank())
                {
                    throw new ApplicationException("The SIP Registration Agent cannot start with no persistence settings.");
                }

                if (m_sipRegAgentStorageType == StorageTypes.XML && !Directory.Exists(m_sipRegAgentStorageConnStr))
                {
                    throw new ApplicationException("Directory " + m_sipRegAgentStorageConnStr + " does not exist for XML persistor.");
                }

                int minWorker, minIOC;
                ThreadPool.GetMinThreads(out minWorker, out minIOC);
                ThreadPool.SetMinThreads(MIN_THREADPOOL_WORKERS, minIOC);
                logger.Debug("ThreadPool minimum idle thread adusted from " + minWorker + " to " + MIN_THREADPOOL_WORKERS + ".");

                SIPAssetPersistor <SIPProvider> sipProvidersPersistor = SIPAssetPersistorFactory <SIPProvider> .CreateSIPAssetPersistor(m_sipRegAgentStorageType, m_sipRegAgentStorageConnStr, m_sipProvidersXMLFilename);

                SIPAssetPersistor <SIPProviderBinding> sipProviderBindingsPersistor = SIPAssetPersistorFactory <SIPProviderBinding> .CreateSIPAssetPersistor(m_sipRegAgentStorageType, m_sipRegAgentStorageConnStr, m_sipProviderBindingsXMLFilename);

                SIPRegAgentDaemon daemon = new SIPRegAgentDaemon(sipProvidersPersistor, sipProviderBindingsPersistor);
                SIPDNSManager.SIPMonitorLogEvent = daemon.FireSIPMonitorEvent;

                if (args != null && args.Length == 1 && args[0].StartsWith("-c"))
                {
                    Thread daemonThread = new Thread(daemon.Start);
                    daemonThread.Start();
                    m_regAgentUp.WaitOne();
                }
                else
                {
                    System.ServiceProcess.ServiceBase[] ServicesToRun;
                    ServicesToRun = new System.ServiceProcess.ServiceBase[] { new Service(daemon) };
                    System.ServiceProcess.ServiceBase.Run(ServicesToRun);
                }
            }
            catch (Exception excp)
            {
                Console.WriteLine("Exception Main. " + excp.Message);
                logger.Error("Exception Main. " + excp.Message);
            }
        }
        protected void Page_Load(object sender, EventArgs e) {

            try {
                logger.Debug("CustomerEmailConfirmation request from " + this.Context.Request.UserHostAddress + " for " + this.Request.QueryString["id"] + ".");

                string id = this.Request.QueryString["id"];
                if (!id.IsNullOrBlank()) {
                    Guid customerId = new Guid(id);
                    m_crmPersistor = SIPAssetPersistorFactory<Customer>.CreateSIPAssetPersistor(m_crmStorageType, m_crmStorageConnStr, null);
                    Customer customer = m_crmPersistor.Get(customerId);

                    if (customer != null) {
                        if (!customer.EmailAddressConfirmed) {
                            customer.CreatedFromIPAddress = this.Context.Request.UserHostAddress;
                            customer.EmailAddressConfirmed = true;

                            if (IsValidCustomer(m_validationRules, customer)) {
                                m_crmPersistor.Update(customer);
                                m_confirmed = true;
                                m_confirmMessage.Text = "Thank you, your account has now been activated.";
                            }
                            else {
                                customer.Suspended = true;
                                m_crmPersistor.Update(customer);
                                m_confirmed = false;
                                m_confirmMessage.Text = "Your account has been confirmed but not approved. You will receive an email within 48 hours if it is approved.";
                            }
                        }
                        else {
                            m_confirmed = false;
                             m_confirmMessage.Text = "Your account has already been confirmed.";
                        }
                    }
                    else {
                        m_confirmMessage.Text = "No matching customer record could be found. Please check that you entered the confirmation URL correctly.";
                    }
                }
                else {
                    m_confirmMessage.Text = "Your account could not be confirmed. Please check that you entered the confirmation URL correctly.";
                }
            }
            catch (Exception excp) {
                logger.Error("Exception CustomerEmailConfirmation. " + excp.Message);
                m_confirmMessage.Text = "There was an error confirming your account. Please check that you entered the confirmation URL correctly.";
            }
        }
Exemple #22
0
        private void btnStart_Click(object sender, EventArgs e)
        {
            SIPAssetPersistor <SIPAccount> sipAccountsPersistor = SIPAssetPersistorFactory <SIPAccount> .CreateSIPAssetPersistor(m_sipRegistrarStorageType, m_sipRegistrarStorageConnStr, m_sipAccountsXMLFilename);

            SIPDomainManager sipDomainManager = new SIPDomainManager(m_sipRegistrarStorageType, m_sipRegistrarStorageConnStr);

            daemon            = new SIPRegistrarDaemon(sipDomainManager.GetDomain, sipAccountsPersistor.Get, SIPRequestAuthenticator.AuthenticateSIPRequest, _deviceList);
            lblInit.Text      = "sip服务已启动,等待初始化。。。";
            lblInit.ForeColor = Color.Blue;
            Thread daemonThread = new Thread(daemon.Start);

            daemonThread.Start();
            daemon.m_registrarCore.CatalogHandler += daemon_CatalogHandler;
            foreach (KeyValuePair <string, SipMonitorCore> monitorCore in daemon.m_registrarCore.MonitorItems)
            {
                monitorCore.Value.SipStatusHandler += monitorCore_SipStatusHandler;
            }
        }
Exemple #23
0
 public CallbackApp(
     SIPTransport sipTransport,
     ISIPCallManager callManager,
     DialStringParser dialStringParser,
     SIPMonitorLogDelegate logDelegate,
     string username,
     string adminMemberId,
     SIPEndPoint outboundProxy,
     SIPAssetPersistor <SIPDialogueAsset> sipDialoguePersistor)
 {
     m_sipTransport         = sipTransport;
     m_callManager          = callManager;
     m_dialStringParser     = dialStringParser;
     Log_External           = logDelegate;
     m_username             = username;
     m_adminMemberId        = adminMemberId;
     m_outboundProxy        = outboundProxy;
     m_sipDialoguePersistor = sipDialoguePersistor;
 }
 public SIPPresenceEventSubscription(
     SIPMonitorLogDelegate log,
     string sessionID,
     SIPURI resourceURI,
     SIPURI canonincalResourceURI,
     string filter,
     SIPDialogue subscriptionDialogue,
     int expiry,
     SIPAssetPersistor<SIPAccount> sipAccountPersistor,
     SIPAssetCountDelegate<SIPRegistrarBinding> getBindingsCount,
     bool switchboardSIPAccountsOnly
     )
     : base(log, sessionID, resourceURI, canonincalResourceURI, filter, subscriptionDialogue, expiry)
 {
     m_sipAccountPersistor = sipAccountPersistor;
     GetSIPRegistrarBindingsCount_External = getBindingsCount;
     Presence = new SIPEventPresence(resourceURI);
     m_switchboardSIPAccountsOnly = switchboardSIPAccountsOnly;
 }
        private Dictionary<string, SIPEventSubscription> m_subscriptions = new Dictionary<string, SIPEventSubscription>();    // [monitor session ID, subscription].

        public NotifierSubscriptionsManager(
            SIPMonitorLogDelegate logDelegate,
            SIPAssetGetListDelegate<SIPDialogueAsset> getDialogues,
            SIPAssetGetByIdDelegate<SIPDialogueAsset> getDialogue,
            SIPAssetPersistor<SIPAccount> sipAssetPersistor,
            SIPAssetCountDelegate<SIPRegistrarBinding> getBindingsCount,
            SIPTransport sipTransport,
            SIPEndPoint outboundProxy,
            ISIPMonitorPublisher publisher)
        {
            MonitorLogEvent_External = logDelegate;
            GetDialogues_External = getDialogues;
            GetDialogue_External = getDialogue;
            GetSIPRegistrarBindingsCount_External = getBindingsCount;
            m_sipAssetPersistor = sipAssetPersistor;
            m_sipTransport = sipTransport;
            m_outboundProxy = outboundProxy;
            m_publisher = publisher;
            m_publisher.MonitorEventReady += MonitorEventAvailable;
        }
        private Dictionary <string, SIPEventSubscription> m_subscriptions = new Dictionary <string, SIPEventSubscription>(); // [monitor session ID, subscription].

        public NotifierSubscriptionsManager(
            SIPMonitorLogDelegate logDelegate,
            SIPAssetGetListDelegate <SIPDialogueAsset> getDialogues,
            SIPAssetGetByIdDelegate <SIPDialogueAsset> getDialogue,
            SIPAssetPersistor <SIPAccount> sipAssetPersistor,
            SIPAssetCountDelegate <SIPRegistrarBinding> getBindingsCount,
            SIPTransport sipTransport,
            SIPEndPoint outboundProxy,
            ISIPMonitorPublisher publisher)
        {
            MonitorLogEvent_External = logDelegate;
            GetDialogues_External    = getDialogues;
            GetDialogue_External     = getDialogue;
            GetSIPRegistrarBindingsCount_External = getBindingsCount;
            m_sipAssetPersistor            = sipAssetPersistor;
            m_sipTransport                 = sipTransport;
            m_outboundProxy                = outboundProxy;
            m_publisher                    = publisher;
            m_publisher.MonitorEventReady += MonitorEventAvailable;
        }
Exemple #27
0
 public SIPNotifierDaemon(
     SIPAssetGetDelegate <Customer> getCustomer,
     SIPAssetGetListDelegate <SIPDialogueAsset> getDialogues,
     SIPAssetGetByIdDelegate <SIPDialogueAsset> getDialogue,
     GetCanonicalDomainDelegate getDomain,
     SIPAssetPersistor <SIPAccount> sipAsssetPersistor,
     SIPAssetGetListDelegate <SIPRegistrarBinding> getSIPRegistrarBindings,
     SIPAssetGetListDelegate <SIPAccount> getSIPAccounts,
     SIPAssetCountDelegate <SIPRegistrarBinding> getBindingsCount,
     SIPAuthenticateRequestDelegate sipRequestAuthenticator,
     ISIPMonitorPublisher publisher)
 {
     GetCustomer_External             = getCustomer;
     GetDialogues_External            = getDialogues;
     GetDialogue_External             = getDialogue;
     GetCanonicalDomain_External      = getDomain;
     m_sipAssetPersistor              = sipAsssetPersistor;
     GetSIPRegistrarBindings_External = getSIPRegistrarBindings;
     GetBindingsCount_External        = getBindingsCount;
     SIPAuthenticateRequest_External  = sipRequestAuthenticator;
     m_publisher = publisher ?? new SIPMonitorUDPSink(m_udpNotificationReceiverSocket);
 }
        public RegistrarCore(
            SIPTransport sipTransport,
            SIPRegistrarBindingsManager registrarBindingsManager,
            SIPAssetGetDelegate <SIPAccountAsset> getSIPAccount,
            GetCanonicalDomainDelegate getCanonicalDomain,
            bool mangleUACContact,
            bool strictRealmHandling,
            SIPMonitorLogDelegate proxyLogDelegate,
            SIPUserAgentConfigurationManager userAgentConfigs,
            SIPAuthenticateRequestDelegate sipRequestAuthenticator,
            string switchboarduserAgentPrefix,
            SIPAssetPersistor <Customer> customerPersistor)
        {
            m_sipTransport                   = sipTransport;
            m_registrarBindingsManager       = registrarBindingsManager;
            GetSIPAccount_External           = getSIPAccount;
            GetCanonicalDomain_External      = getCanonicalDomain;
            m_mangleUACContact               = mangleUACContact;
            m_strictRealmHandling            = strictRealmHandling;
            m_registrarLogEvent              = proxyLogDelegate;
            m_userAgentConfigs               = userAgentConfigs;
            SIPRequestAuthenticator_External = sipRequestAuthenticator;
            m_switchboarduserAgentPrefix     = switchboarduserAgentPrefix;
            CustomerPersistor_External       = customerPersistor;

            //try
            //{
            //    if (!switchboardCertificateName.IsNullOrBlank())
            //    {
            //        X509Certificate2 switchboardCertificate = AppState.LoadCertificate(StoreLocation.LocalMachine, switchboardCertificateName, false);
            //        m_switchbboardRSAProvider = (RSACryptoServiceProvider)switchboardCertificate.PrivateKey;
            //        logger.Debug("Switchboard RSA provider successfully loaded from " + switchboardCertificateName + " certificate.");
            //    }
            //}
            //catch (Exception excp)
            //{
            //    logger.Error("Exception loading switchboard certificate using " + switchboardCertificateName + ". " + excp.Message);
            //}
        }
        /// <summary>
        /// 加载设备信息
        /// </summary>
        public void Read()
        {
            SIPAssetPersistor <NvrItem> nvrItem = SIPAssetPersistorFactory <NvrItem> .CreateSIPAssetPersistor(m_storageType, m_connStr, m_XMLFilename);

            SIPAssetPersistor <ChannelItem> nvrChannel = SIPAssetPersistorFactory <ChannelItem> .CreateSIPAssetPersistor(m_storageType, m_connStr, m_XMLFilename);

            NvrItems     = nvrItem;
            ChannelItems = nvrChannel;
            _nvrItems    = nvrItem.Get();
            var nvrChannelItems = nvrChannel.Get();

            foreach (var item in _nvrItems)
            {
                foreach (var channel in nvrChannelItems)
                {
                    if (item.NvrID == channel.NvrID)
                    {
                        item.Add(channel);
                    }
                }
            }
        }
 public SIPNotifierDaemon(
     SIPAssetGetDelegate<Customer> getCustomer,
     SIPAssetGetListDelegate<SIPDialogueAsset> getDialogues,
     SIPAssetGetByIdDelegate<SIPDialogueAsset> getDialogue,
     GetCanonicalDomainDelegate getDomain,
     SIPAssetPersistor<SIPAccount> sipAsssetPersistor,
     SIPAssetGetListDelegate<SIPRegistrarBinding> getSIPRegistrarBindings,
     SIPAssetGetListDelegate<SIPAccount> getSIPAccounts,
     SIPAssetCountDelegate<SIPRegistrarBinding> getBindingsCount,
     SIPAuthenticateRequestDelegate sipRequestAuthenticator,
     ISIPMonitorPublisher publisher)
 {
     GetCustomer_External = getCustomer;
     GetDialogues_External = getDialogues;
     GetDialogue_External = getDialogue;
     GetCanonicalDomain_External = getDomain;
     m_sipAssetPersistor = sipAsssetPersistor;
     GetSIPRegistrarBindings_External = getSIPRegistrarBindings;
     GetBindingsCount_External = getBindingsCount;
     SIPAuthenticateRequest_External = sipRequestAuthenticator;
     m_publisher = publisher ?? new SIPMonitorUDPSink(m_udpNotificationReceiverSocket);
 }
Exemple #31
0
        public NotifierCore(
            SIPMonitorLogDelegate logDelegate,
            SIPTransport sipTransport,
            SIPAssetGetDelegate <Customer> getCustomer,
            SIPAssetGetListDelegate <SIPDialogueAsset> getDialogues,
            SIPAssetGetByIdDelegate <SIPDialogueAsset> getDialogue,
            GetCanonicalDomainDelegate getCanonicalDomain,
            SIPAssetPersistor <SIPAccount> sipAssetPersistor,
            SIPAssetCountDelegate <SIPRegistrarBinding> getBindingsCount,
            SIPAuthenticateRequestDelegate sipRequestAuthenticator,
            SIPEndPoint outboundProxy,
            ISIPMonitorPublisher publisher)
        {
            MonitorLogEvent_External         = logDelegate;
            m_sipTransport                   = sipTransport;
            GetCustomer_External             = getCustomer;
            m_sipAssetPersistor              = sipAssetPersistor;
            GetCanonicalDomain_External      = getCanonicalDomain;
            SIPRequestAuthenticator_External = sipRequestAuthenticator;
            m_outboundProxy                  = outboundProxy;
            m_subscriptionsManager           = new NotifierSubscriptionsManager(MonitorLogEvent_External, getDialogues, getDialogue, m_sipAssetPersistor, getBindingsCount, m_sipTransport, m_outboundProxy, publisher);

            ThreadPool.QueueUserWorkItem(delegate { ProcessSubscribeRequest(NOTIFIER_THREAD_NAME_PREFIX + "1"); });
        }
Exemple #32
0
        public CustomerSessionManager(StorageTypes storageType, string connectionString)
        {
            m_customerPersistor = SIPAssetPersistorFactory <Customer> .CreateSIPAssetPersistor(storageType, connectionString, CUSTOMERS_XML_FILENAME);

            m_customerSessionPersistor = SIPAssetPersistorFactory <CustomerSession> .CreateSIPAssetPersistor(storageType, connectionString, CUSTOMER_SESSIONS_XML_FILENAME);
        }
        public DialPlanEngine(
            SIPTransport sipTransport,
            GetCanonicalDomainDelegate getCanonicalDomain,
            SIPMonitorLogDelegate logDelegate,
            SIPAssetPersistor<SIPAccount> sipAssetPersistor,
            SIPAssetGetListDelegate<SIPRegistrarBinding> getBindings,
            SIPAssetPersistor<SIPDialPlan> dialPlanPersistor,
            SIPAssetPersistor<SIPDialogueAsset> sipDialoguePersistor,
            SIPEndPoint outboundProxySocket,
            string rubyScriptCommonPath,
            string impersonationUsername,
            string impersonationPassword)
        {
            m_sipTransport = sipTransport;
            GetCanonicalDomainDelegate_External = getCanonicalDomain;
            LogDelegate_External = logDelegate;
            m_sipAccountPersistor = sipAssetPersistor;
            GetSIPAccountBindings_External = getBindings;
            m_dialPlanPersistor = dialPlanPersistor;
            m_sipDialoguePersistor = sipDialoguePersistor;
            m_outboundProxySocket = outboundProxySocket;
            m_rubyScriptCommonPath = rubyScriptCommonPath;
            m_impersonationUsername = impersonationUsername;
            m_impersonationPassword = impersonationPassword;

            LoadRubyCommonScript();

            Thread monitorScriptsThread = new Thread(new ThreadStart(MonitorScripts));
            monitorScriptsThread.Name = MONITOR_THREAD_NAME;
            monitorScriptsThread.Start();
        }
Exemple #34
0
 public CallbackApp(
     SIPTransport sipTransport,
     ISIPCallManager callManager,
     DialStringParser dialStringParser,
     SIPMonitorLogDelegate logDelegate,
     string username,
     string adminMemberId,
     SIPEndPoint outboundProxy,
     SIPAssetPersistor<SIPDialogueAsset> sipDialoguePersistor)
 {
     m_sipTransport = sipTransport;
     m_callManager = callManager;
     m_dialStringParser = dialStringParser;
     Log_External = logDelegate;
     m_username = username;
     m_adminMemberId = adminMemberId;
     m_outboundProxy = outboundProxy;
     m_sipDialoguePersistor = sipDialoguePersistor;
 }
Exemple #35
0
 public SIPSorceryAuthorisationService(CustomerSessionManager crmSessionManager)
 {
     CRMSessionManager    = crmSessionManager;
     CRMCustomerPersistor = crmSessionManager.CustomerPersistor;
 }
 //public SIPDomainManager()
 //{ }
 public SIPDomainManager(StorageTypes storageType, string storageConnectionStr)
 {
     m_sipDomainPersistor = SIPAssetPersistorFactory<SIPDomain>.CreateSIPAssetPersistor(storageType, storageConnectionStr, m_storageFileName);
     m_sipDomainPersistor.Added += new SIPAssetDelegate<SIPDomain>(d => { LoadSIPDomains(); });
     m_sipDomainPersistor.Deleted += new SIPAssetDelegate<SIPDomain>(d => { LoadSIPDomains(); });
     m_sipDomainPersistor.Updated += new SIPAssetDelegate<SIPDomain>(d => { LoadSIPDomains(); });
     m_sipDomainPersistor.Modified += new SIPAssetsModifiedDelegate(() => { LoadSIPDomains(); });
     LoadSIPDomains();
 }
 public SIPSorceryAuthorisationService(CustomerSessionManager crmSessionManager)
 {
     CRMSessionManager = crmSessionManager;
     CRMCustomerPersistor = crmSessionManager.CustomerPersistor;
 }
        public NotifierCore(
            SIPMonitorLogDelegate logDelegate,
            SIPTransport sipTransport,
            SIPAssetGetDelegate<Customer> getCustomer,
            SIPAssetGetListDelegate<SIPDialogueAsset> getDialogues,
            SIPAssetGetByIdDelegate<SIPDialogueAsset> getDialogue,
            GetCanonicalDomainDelegate getCanonicalDomain,
            SIPAssetPersistor<SIPAccount> sipAssetPersistor,
            SIPAssetCountDelegate<SIPRegistrarBinding> getBindingsCount,
            SIPAuthenticateRequestDelegate sipRequestAuthenticator,
            SIPEndPoint outboundProxy,
            ISIPMonitorPublisher publisher)
        {
            MonitorLogEvent_External = logDelegate;
            m_sipTransport = sipTransport;
            GetCustomer_External = getCustomer;
            m_sipAssetPersistor = sipAssetPersistor;
            GetCanonicalDomain_External = getCanonicalDomain;
            SIPRequestAuthenticator_External = sipRequestAuthenticator;
            m_outboundProxy = outboundProxy;
            m_subscriptionsManager = new NotifierSubscriptionsManager(MonitorLogEvent_External, getDialogues, getDialogue, m_sipAssetPersistor, getBindingsCount, m_sipTransport, m_outboundProxy, publisher);

            ThreadPool.QueueUserWorkItem(delegate { ProcessSubscribeRequest(NOTIFIER_THREAD_NAME_PREFIX + "1"); });
        }
 public SIPProvisioningWebService(
     SIPAssetPersistor<SIPAccount> sipAccountPersistor,
     SIPAssetPersistor<SIPDialPlan> sipDialPlanPersistor,
     SIPAssetPersistor<SIPProvider> sipProviderPersistor,
     SIPAssetPersistor<SIPProviderBinding> sipProviderBindingsPersistor,
     SIPAssetPersistor<SIPRegistrarBinding> sipRegistrarBindingsPersistor,
     SIPAssetPersistor<SIPDialogueAsset> sipDialoguePersistor,
     SIPAssetPersistor<SIPCDRAsset> sipCDRPersistor,
     CustomerSessionManager crmSessionManager,
     SIPDomainManager sipDomainManager,
     SIPMonitorLogDelegate log,
     int newCustomersAllowedLimit,
     bool inviteCodeRequired) :
     base(crmSessionManager)
 {
     SIPAccountPersistor = sipAccountPersistor;
     DialPlanPersistor = sipDialPlanPersistor;
     SIPProviderPersistor = sipProviderPersistor;
     SIPProviderBindingsPersistor = sipProviderBindingsPersistor;
     SIPRegistrarBindingsPersistor = sipRegistrarBindingsPersistor;
     SIPDialoguePersistor = sipDialoguePersistor;
     SIPCDRPersistor = sipCDRPersistor;
     SIPDomainManager = sipDomainManager;
     LogDelegate_External = log;
     m_newCustomersAllowedLimit = newCustomersAllowedLimit;
     m_inviteCodeRequired = inviteCodeRequired;
    
     if (!String.IsNullOrEmpty(m_providerRegistrationsDisabled))
     {
         Boolean.TryParse(m_providerRegistrationsDisabled, out m_providerRegDisabled);
     }
 }
 public CustomerSessionManager(StorageTypes storageType, string connectionString)
 {
     m_customerPersistor = SIPAssetPersistorFactory<Customer>.CreateSIPAssetPersistor(storageType, connectionString, CUSTOMERS_XML_FILENAME);
     m_customerSessionPersistor = SIPAssetPersistorFactory<CustomerSession>.CreateSIPAssetPersistor(storageType, connectionString, CUSTOMER_SESSIONS_XML_FILENAME);
 }
 public SIPDialogueManager(
     SIPTransport sipTransport,
     SIPEndPoint outboundProxy,
     SIPMonitorLogDelegate logDelegate,
     SIPAssetPersistor<SIPDialogueAsset> sipDialoguePersistor,
     SIPAssetPersistor<SIPCDRAsset> sipCDRPersistor,
     SIPAuthenticateRequestDelegate authenticateRequestDelegate,
     SIPAssetGetDelegate<SIPAccount> getSIPAccount,
     GetCanonicalDomainDelegate getCanonicalDomain)
 {
     m_sipTransport = sipTransport;
     m_outboundProxy = outboundProxy;
     Log_External = logDelegate;
     m_sipDialoguePersistor = sipDialoguePersistor;
     m_sipCDRPersistor = sipCDRPersistor;
     SIPAuthenticateRequest_External = authenticateRequestDelegate;
     GetSIPAccount_External = getSIPAccount;
     GetCanonicalDomain_External = getCanonicalDomain;
 }
 public SIPRegistrationAgentCore(
     SIPMonitorLogDelegate logDelegate,
     SIPTransport sipTransport,
     SIPEndPoint outboundProxy,
     SIPAssetGetByIdDelegate<SIPProvider> getSIPProviderById,
     SIPAssetUpdateDelegate<SIPProvider> updateSIPProvider,
     SIPAssetUpdatePropertyDelegate<SIPProvider> updateSIPProviderProperty,
     SIPAssetPersistor<SIPProviderBinding> bindingPersistor,
     bool disAllowPrivateIPRegistrars)
 {
     StatefulProxyLogEvent_External = logDelegate;
     GetSIPProviderById_External = getSIPProviderById;
     UpdateSIPProvider_External = updateSIPProvider;
     UpdateSIPProviderProperty_External = updateSIPProviderProperty;
     m_bindingPersistor = bindingPersistor;
     m_sipTransport = sipTransport;
     m_outboundProxy = outboundProxy;
     m_disallowPrivateIPRegistrars = disAllowPrivateIPRegistrars;
 }
 public SIPRegistrarBindingsManager(
     SIPMonitorLogDelegate sipMonitorEventLog,
     SIPAssetPersistor<SIPRegistrarBinding> bindingsPersistor,
     SendNATKeepAliveDelegate sendNATKeepAlive,
     int maxBindingsPerAccount,
     SIPUserAgentConfigurationManager userAgentConfigs)
 {
     SIPMonitorEventLog_External = sipMonitorEventLog;
     m_bindingsPersistor = bindingsPersistor;
     SendNATKeepAlive_External = sendNATKeepAlive;
     m_maxBindingsPerAccount = (maxBindingsPerAccount != 0) ? maxBindingsPerAccount : DEFAULT_BINDINGS_PER_USER;
     m_userAgentConfigs = userAgentConfigs;
 }
Exemple #44
0
 public CustomerSessionManager(SIPAssetPersistor <Customer> customerPersistor, SIPAssetPersistor <CustomerSession> customerSessionPersistor)
 {
     m_customerPersistor        = customerPersistor;
     m_customerSessionPersistor = customerSessionPersistor;
 }
 public SIPSorceryAuthorisationService()
 {
     SIPSorceryConfiguration sipSorceryConfig = new SIPSorceryConfiguration();
     CRMSessionManager = new CustomerSessionManager(sipSorceryConfig);
     CRMCustomerPersistor = CRMSessionManager.CustomerPersistor;
 }
        public RegistrarCore(
            SIPTransport sipTransport,
            SIPRegistrarBindingsManager registrarBindingsManager,
            SIPAssetGetDelegate<SIPAccount> getSIPAccount,
            GetCanonicalDomainDelegate getCanonicalDomain,
            bool mangleUACContact,
            bool strictRealmHandling,
            SIPMonitorLogDelegate proxyLogDelegate,
            SIPUserAgentConfigurationManager userAgentConfigs,
            SIPAuthenticateRequestDelegate sipRequestAuthenticator,
            string switchboarduserAgentPrefix,
            SIPAssetPersistor<Customer> customerPersistor)
        {
            m_sipTransport = sipTransport;
            m_registrarBindingsManager = registrarBindingsManager;
            GetSIPAccount_External = getSIPAccount;
            GetCanonicalDomain_External = getCanonicalDomain;
            m_mangleUACContact = mangleUACContact;
            m_strictRealmHandling = strictRealmHandling;
            m_registrarLogEvent = proxyLogDelegate;
            m_userAgentConfigs = userAgentConfigs;
            SIPRequestAuthenticator_External = sipRequestAuthenticator;
            m_switchboarduserAgentPrefix = switchboarduserAgentPrefix;
            CustomerPersistor_External = customerPersistor;

            //try
            //{
            //    if (!switchboardCertificateName.IsNullOrBlank())
            //    {
            //        X509Certificate2 switchboardCertificate = AppState.LoadCertificate(StoreLocation.LocalMachine, switchboardCertificateName, false);
            //        m_switchbboardRSAProvider = (RSACryptoServiceProvider)switchboardCertificate.PrivateKey;
            //        logger.Debug("Switchboard RSA provider successfully loaded from " + switchboardCertificateName + " certificate.");
            //    }
            //}
            //catch (Exception excp)
            //{
            //    logger.Error("Exception loading switchboard certificate using " + switchboardCertificateName + ". " + excp.Message);
            //}
        }
        public DialPlanScriptFacade(
            SIPTransport sipTransport,
            DialPlanExecutingScript executingScript,
            SIPMonitorLogDelegate logDelegate,
            DialogueBridgeCreatedDelegate createBridge,
            SIPRequest sipRequest,
            SIPCallDirection callDirection,
            DialPlanContext dialPlanContext,
            GetCanonicalDomainDelegate getCanonicalDomain,
            ISIPCallManager callManager,
            SIPAssetPersistor<SIPAccount> sipAccountPersistor,
            SIPAssetPersistor<SIPDialPlan> sipDialPlanPersistor,
            SIPAssetPersistor<SIPDialogueAsset> sipDialoguePersistor,
            SIPAssetGetListDelegate<SIPRegistrarBinding> getSIPAccountBindings,
            SIPEndPoint outboundProxySocket
            )
        {
            m_sipTransport = sipTransport;
            m_executingScript = executingScript;
            m_dialPlanLogDelegate = logDelegate;
            CreateBridge_External = createBridge;
            m_sipRequest = sipRequest;
            m_callDirection = callDirection;
            m_dialPlanContext = dialPlanContext;
            m_getCanonicalDomainDelegate = getCanonicalDomain;
            m_callManager = callManager;
            m_sipAccountPersistor = sipAccountPersistor;
            m_sipDialPlanPersistor = sipDialPlanPersistor;
            m_sipDialoguePersistor = sipDialoguePersistor;
            GetSIPAccountBindings_External = getSIPAccountBindings;
            m_outboundProxySocket = outboundProxySocket;

            m_executingScript.Cleanup = CleanupDialPlanScript;

            if (m_dialPlanContext != null)
            {
                m_username = dialPlanContext.Owner;
                m_adminMemberId = dialPlanContext.AdminMemberId;
                m_sipProviders = dialPlanContext.SIPProviders;

                m_dialPlanContext.TraceLog.AppendLine("DialPlan=> Dialplan trace commenced at " + DateTime.Now.ToString("dd MMM yyyy HH:mm:ss:fff") + ".");
                m_dialPlanContext.CallCancelledByClient += ClientCallTerminated;

                SIPAssetGetDelegate<SIPAccount> getSIPAccount = null;
                if (m_sipAccountPersistor != null)
                {
                    getSIPAccount = m_sipAccountPersistor.Get;
                }
                m_dialStringParser = new DialStringParser(m_sipTransport, m_dialPlanContext.Owner, m_dialPlanContext.SIPAccount, m_sipProviders, getSIPAccount, GetSIPAccountBindings_External, m_getCanonicalDomainDelegate, logDelegate, m_dialPlanContext.SIPDialPlan.DialPlanName);
            }
        }
 public SIPProviderBindingSynchroniser(SIPAssetPersistor<SIPProviderBinding> sipProviderBindingsPersistor)
 {
     m_bindingPersistor = sipProviderBindingsPersistor;
 }
        public ProvisioningServiceInstanceProvider(
            SIPAssetPersistor<SIPAccount> sipAccountPersistor,
            SIPAssetPersistor<SIPDialPlan> sipDialPlanPersistor,
            SIPAssetPersistor<SIPProvider> sipProviderPersistor,
            SIPAssetPersistor<SIPProviderBinding> sipProviderBindingsPersistor,
            SIPAssetPersistor<SIPRegistrarBinding> sipRegistrarBindingsPersistor,
            SIPAssetPersistor<SIPDialogueAsset> sipDialoguePersistor,
            SIPAssetPersistor<SIPCDRAsset> sipCDRPersistor,
            CustomerSessionManager crmSessionManager,
            SIPDomainManager sipDomainManager,
            SIPMonitorLogDelegate log,
            int newCustomersAllowedLimit) {

            m_sipAccountPersistor = sipAccountPersistor;
            m_sipDialPlanPersistor = sipDialPlanPersistor;
            m_sipProviderPersistor = sipProviderPersistor;
            m_sipProviderBindingsPersistor = sipProviderBindingsPersistor;
            m_sipRegistrarBindingsPersistor = sipRegistrarBindingsPersistor;
            m_sipDialoguePersistor = sipDialoguePersistor;
            m_sipCDRPersistor = sipCDRPersistor;
            m_crmCustomerPersistor = crmSessionManager.CustomerPersistor;
            m_crmSessionManager = crmSessionManager;
            m_sipDomainManager = sipDomainManager;
            m_logDelegate = log;
            m_newCustomersAllowedLimit = newCustomersAllowedLimit;
        }
        public SIPCallManager(
            SIPTransport sipTransport,
            SIPEndPoint outboundProxy,
            SIPMonitorLogDelegate logDelegate,
            SIPDialogueManager sipDialogueManager,
            SIPAssetPersistor<SIPDialogueAsset> sipDialoguePersistor,
            SIPAssetPersistor<SIPCDRAsset> sipCDRPersistor,
            DialPlanEngine dialPlanEngine,
            SIPAssetGetDelegate<SIPDialPlan> getDialPlan,
            SIPAssetGetDelegate<SIPAccount> getSIPAccount,
            SIPAssetGetListDelegate<SIPRegistrarBinding> getSIPAccountBindings,
            SIPAssetGetListDelegate<SIPProvider> getSIPProviders,
            GetCanonicalDomainDelegate getCanonicalDomain,
            SIPAssetPersistor<Customer> customerPersistor,
            SIPAssetPersistor<SIPDialPlan> dialPlanPersistor,
            string traceDirectory,
            bool monitorCalls,
            int dailyCallLimit)
        {
            m_sipTransport = sipTransport;
            m_outboundProxy = outboundProxy;
            Log_External = logDelegate;
            m_sipDialogueManager = sipDialogueManager;
            m_sipDialoguePersistor = sipDialoguePersistor;
            m_sipCDRPersistor = sipCDRPersistor;
            m_dialPlanEngine = dialPlanEngine;
            GetDialPlan_External = getDialPlan;
            GetSIPAccount_External = getSIPAccount;
            GetSIPAccountBindings_External = getSIPAccountBindings;
            GetSIPProviders_External = getSIPProviders;
            GetCanonicalDomain_External = getCanonicalDomain;
            m_customerPersistor = customerPersistor;
            m_dialPlanPersistor = dialPlanPersistor;
            m_traceDirectory = traceDirectory;
            m_monitorCalls = monitorCalls;
            m_pid = Process.GetCurrentProcess().Id;
            m_dailyCallLimit = dailyCallLimit;

            m_sipDialogueManager.OnCallHungup += OnCallHungup;
        }
 public CustomerSessionManager(SIPAssetPersistor<Customer> customerPersistor, SIPAssetPersistor<CustomerSession> customerSessionPersistor)
 {
     m_customerPersistor = customerPersistor;
     m_customerSessionPersistor = customerSessionPersistor;
 }
        public SIPSorceryPersistor(StorageTypes storageType, string storageConnectionStr)
        {
            if (storageType == StorageTypes.XML)
            {
                if (!storageConnectionStr.Contains(":"))
                {
                    // Relative path.
                    storageConnectionStr = AppDomain.CurrentDomain.BaseDirectory + storageConnectionStr;
                }

                if (!storageConnectionStr.EndsWith(@"\"))
                {
                    storageConnectionStr += @"\";
                }

                if (!Directory.Exists(storageConnectionStr))
                {
                    throw new ApplicationException("Directory " + storageConnectionStr + " does not exist for XML persistor.");
                }
            }

            m_sipAccountsPersistor = SIPAssetPersistorFactory<SIPAccount>.CreateSIPAssetPersistor(storageType, storageConnectionStr, m_sipAccountsXMLFilename);
            m_dialPlanPersistor = SIPAssetPersistorFactory<SIPDialPlan>.CreateSIPAssetPersistor(storageType, storageConnectionStr, m_sipDialplansXMLFilename);
            m_sipProvidersPersistor = SIPAssetPersistorFactory<SIPProvider>.CreateSIPAssetPersistor(storageType, storageConnectionStr, m_sipProvidersXMLFilename);
            m_sipProviderBindingsPersistor = SIPAssetPersistorFactory<SIPProviderBinding>.CreateSIPAssetPersistor(storageType, storageConnectionStr, m_sipProviderBindingsXMLFilename);
            m_sipDomainManager = new SIPDomainManager(storageType, storageConnectionStr);
            m_sipRegistrarBindingPersistor = SIPAssetPersistorFactory<SIPRegistrarBinding>.CreateSIPAssetPersistor(storageType, storageConnectionStr, m_sipRegistrarBindingsXMLFilename);
            m_sipDialoguePersistor = SIPAssetPersistorFactory<SIPDialogueAsset>.CreateSIPAssetPersistor(storageType, storageConnectionStr, m_sipDialoguesXMLFilename);
            m_sipCDRPersistor = SIPAssetPersistorFactory<SIPCDRAsset>.CreateSIPAssetPersistor(storageType, storageConnectionStr, m_sipCDRsXMLFilename);

            if (m_sipCDRPersistor != null)
            {
                ThreadPool.QueueUserWorkItem(delegate { WriteCDRs(); });
            }
        }
 public SIPProviderBindingSynchroniser(SIPAssetPersistor <SIPProviderBinding> sipProviderBindingsPersistor)
 {
     m_bindingPersistor = sipProviderBindingsPersistor;
 }
 public SIPProvisioningWebService(
     SIPAssetPersistor<SIPAccount> sipAccountPersistor,
     SIPAssetPersistor<SIPDialPlan> sipDialPlanPersistor,
     SIPAssetPersistor<SIPProvider> sipProviderPersistor,
     SIPAssetPersistor<SIPProviderBinding> sipProviderBindingsPersistor,
     SIPAssetPersistor<SIPRegistrarBinding> sipRegistrarBindingsPersistor,
     SIPAssetPersistor<SIPDialogueAsset> sipDialoguePersistor,
     SIPAssetPersistor<SIPCDRAsset> sipCDRPersistor,
     CustomerSessionManager crmSessionManager,
     SIPDomainManager sipDomainManager,
     SIPMonitorLogDelegate log,
     int newCustomersAllowedLimit)
 {
     SIPAccountPersistor = sipAccountPersistor;
     DialPlanPersistor = sipDialPlanPersistor;
     SIPProviderPersistor = sipProviderPersistor;
     SIPProviderBindingsPersistor = sipProviderBindingsPersistor;
     SIPRegistrarBindingsPersistor = sipRegistrarBindingsPersistor;
     SIPDialoguePersistor = sipDialoguePersistor;
     SIPCDRPersistor = sipCDRPersistor;
     CRMCustomerPersistor = crmSessionManager.CustomerPersistor;
     CRMSessionManager = crmSessionManager;
     SIPDomainManager = sipDomainManager;
     LogDelegate_External = log;
     m_newCustomersAllowedLimit = newCustomersAllowedLimit;
 }