public DialPlanEngine( SIPTransport sipTransport, GetCanonicalDomainDelegate getCanonicalDomain, SIPMonitorLogDelegate logDelegate, SIPSorceryPersistor sipSorceryPersistor, SIPEndPoint outboundProxySocket, string rubyScriptCommonPath, string impersonationUsername, string impersonationPassword, int maxExecutionCount) { m_sipTransport = sipTransport; GetCanonicalDomainDelegate_External = getCanonicalDomain; LogDelegate_External = logDelegate; m_sipSorceryPersistor = sipSorceryPersistor; //m_sipAccountPersistor = sipAssetPersistor; //GetSIPAccountBindings_External = getBindings; //m_dialPlanPersistor = dialPlanPersistor; //m_sipDialoguePersistor = sipDialoguePersistor; m_outboundProxySocket = outboundProxySocket; m_rubyScriptCommonPath = rubyScriptCommonPath; m_impersonationUsername = impersonationUsername; m_impersonationPassword = impersonationPassword; m_maxExecutionCount = (maxExecutionCount > 0) ? maxExecutionCount : MAX_ALLOWED_SCRIPTSCOPES; LoadRubyCommonScript(); Thread monitorScriptsThread = new Thread(new ThreadStart(MonitorScripts)); monitorScriptsThread.Name = MONITOR_THREAD_NAME; monitorScriptsThread.Start(); }
public SIPCallManager( ActivityMessageDelegate logActivityMessage, ActivityProgressDelegate showActivityProgress, SIPSorceryPersistor persistor, string owner) { InitializeComponent(); LogActivityMessage_External = logActivityMessage; ShowActivityProgress_External = showActivityProgress; m_persistor = persistor; m_owner = owner; m_sipCallsPanel.SetTitle("Calls"); m_sipCallsPanel.DisplayCount = SIPCALLS_DISPLAY_COUNT; m_sipCallsPanel.MenuEnableAdd(false); m_sipCallsPanel.MenuEnableFilter(false); m_sipCallsPanel.MenuEnableDelete(false); m_sipCallsPanel.GetAssetList = GetSIPCalls; m_sipCDRsPanel.SetTitle("CDRs"); m_sipCDRsPanel.DisplayCount = SIPCDRS_DISPLAY_COUNT; m_sipCDRsPanel.MenuEnableAdd(false); m_sipCDRsPanel.MenuEnableFilter(false); m_sipCDRsPanel.MenuEnableDelete(false); m_sipCDRsPanel.GetAssetList = GetSIPCDRs; }
public SIPProviderManager( ActivityMessageDelegate logActivityMessage, ActivityProgressDelegate showActivityProgress, SIPSorceryPersistor persistor, string owner) { InitializeComponent(); LogActivityMessage_External = logActivityMessage; ShowActivityProgress_External = showActivityProgress; m_persistor = persistor; m_owner = owner; m_sipProvidersPanel.SetTitle("SIP Providers"); m_sipProvidersPanel.DisplayCount = SIPPROVIDERS_DISPLAY_COUNT; m_sipProvidersPanel.MenuEnableFilter(false); m_sipProvidersPanel.MenuEnableDelete(false); m_sipProvidersPanel.Add += SIPProvidersPanel_Add; m_sipProvidersPanel.GetAssetList = GetSIPProviders; m_sipProviderRegistrationsPanel.SetTitle("SIP Provider Registrations"); m_sipProviderRegistrationsPanel.DisplayCount = SIPPROVIDERBINDINGS_DISPLAY_COUNT; m_sipProviderRegistrationsPanel.MenuEnableAdd(false); m_sipProviderRegistrationsPanel.MenuEnableFilter(false); m_sipProviderRegistrationsPanel.MenuEnableDelete(false); m_sipProviderRegistrationsPanel.GetAssetList = GetSIPProviderBindings; }
public SIPAccountManager( ActivityMessageDelegate logActivityMessage, ActivityProgressDelegate showActivityProgress, SIPSorceryPersistor persistor, GetDialPlanNamesDelegate getDialPlanNames, string owner) { InitializeComponent(); LogActivityMessage_External = logActivityMessage; ShowActivityProgress_External = showActivityProgress; GetDialPlanNames_External = getDialPlanNames; m_persistor = persistor; m_owner = owner; m_sipAccountsPanel.SetTitle("SIP Accounts"); m_sipAccountsPanel.DisplayCount = SIPACCOUNTS_DISPLAY_COUNT; m_sipAccountsPanel.MenuEnableFilter(false); m_sipAccountsPanel.MenuEnableDelete(false); m_sipAccountsPanel.Add += new MenuButtonClickedDelegate(SIPAccountsAssetViewer_Add); m_sipAccountsPanel.GetAssetList = GetSIPAccounts; m_sipBindingsPanel.SetTitle("SIP Bindings"); m_sipBindingsPanel.DisplayCount = SIPBINDINGS_DISPLAY_COUNT; m_sipBindingsPanel.MenuEnableAdd(false); m_sipBindingsPanel.MenuEnableFilter(false); m_sipBindingsPanel.MenuEnableDelete(false); m_sipBindingsPanel.GetAssetList = GetSIPBindings; }
public DialPlanManager( ActivityMessageDelegate logActivityMessage, ActivityProgressDelegate showActivityProgress, SIPSorceryPersistor persistor, string owner) { InitializeComponent(); LogActivityMessage_External = logActivityMessage; ShowActivityProgress_External = showActivityProgress; m_persistor = persistor; m_owner = owner; m_dialPlansPanel.SetTitle("Dial Plans"); m_dialPlansPanel.MenuEnableFilter(false); m_dialPlansPanel.MenuEnableDelete(false); m_dialPlansPanel.Add += new MenuButtonClickedDelegate(DialPlansPanel_Add); m_dialPlansPanel.GetAssetList = GetDialPlans; }
static void Main(string[] args) { try { logger.Debug("RTCC Server starting"); m_rtccStorageType = (AppState.GetConfigSetting(m_storageTypeKey) != null) ? StorageTypesConverter.GetStorageType(AppState.GetConfigSetting(m_storageTypeKey)) : StorageTypes.Unknown;; m_rtccStorageConnStr = AppState.GetConfigSetting(m_connStrKey); if (m_rtccStorageType == StorageTypes.Unknown || m_rtccStorageConnStr.IsNullOrBlank()) { throw new ApplicationException("The RTCC Server cannot start with no persistence settings."); } var sipSorceryPersistor = new SIPSorceryPersistor(m_rtccStorageType, m_rtccStorageConnStr); RTCCDaemon daemon = new RTCCDaemon(sipSorceryPersistor); if (args != null && args.Length == 1 && args[0].StartsWith("-c")) { Thread daemonThread = new Thread(daemon.Start); daemonThread.Start(); m_rtccUp.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); } }
public void Start() { try { logger.Debug("pid=" + Process.GetCurrentProcess().Id + "."); logger.Debug("os=" + System.Environment.OSVersion + "."); logger.Debug("current directory=" + m_currentDirectory + "."); logger.Debug("base directory=" + AppDomain.CurrentDomain.BaseDirectory + "."); SIPDNSManager.SIPMonitorLogEvent = FireSIPMonitorEvent; m_sipSorceryPersistor = new SIPSorceryPersistor(m_storageType, m_connectionString); m_customerSessionManager = new CustomerSessionManager(m_storageType, m_connectionString); m_cdrDataLayer = new Entities.CDRDataLayer(); #region Initialise the SIP Application Server and its logging mechanisms including CDRs. logger.Debug("Initiating SIP Application Server Agent."); // Send events from this process to the monitoring socket. if (m_monitorEventLoopbackPort != 0) { m_monitorEventWriter = new SIPMonitorEventWriter(m_monitorEventLoopbackPort); } if (m_cdrDataLayer != null) { SIPCDR.CDRCreated += m_cdrDataLayer.Add; SIPCDR.CDRAnswered += m_cdrDataLayer.Update; SIPCDR.CDRHungup += m_cdrDataLayer.Update; SIPCDR.CDRUpdated += m_cdrDataLayer.Update; } #region Initialise the SIPTransport layers. m_sipTransport = new SIPTransport(SIPDNSManager.ResolveSIPService, new SIPTransactionEngine(), true); if (m_appServerEndPoint != null) { if (m_appServerEndPoint.Protocol == SIPProtocolsEnum.udp) { logger.Debug("Using single SIP transport socket for App Server " + m_appServerEndPoint.ToString() + "."); m_sipTransport.AddSIPChannel(new SIPUDPChannel(m_appServerEndPoint.GetIPEndPoint())); } else if (m_appServerEndPoint.Protocol == SIPProtocolsEnum.tcp) { logger.Debug("Using single SIP transport socket for App Server " + m_appServerEndPoint.ToString() + "."); m_sipTransport.AddSIPChannel(new SIPTCPChannel(m_appServerEndPoint.GetIPEndPoint())); } else { throw new ApplicationException("The SIP End Point of " + m_appServerEndPoint + " cannot be used with the App Server transport layer."); } } else if (m_sipAppServerSocketsNode != null) { m_sipTransport.AddSIPChannel(SIPTransportConfig.ParseSIPChannelsNode(m_sipAppServerSocketsNode)); } else { throw new ApplicationException("The SIP App Server could not be started, no SIP sockets have been configured."); } m_sipTransport.SIPRequestInTraceEvent += LogSIPRequestIn; m_sipTransport.SIPRequestOutTraceEvent += LogSIPRequestOut; m_sipTransport.SIPResponseInTraceEvent += LogSIPResponseIn; m_sipTransport.SIPResponseOutTraceEvent += LogSIPResponseOut; m_sipTransport.SIPBadRequestInTraceEvent += LogSIPBadRequestIn; m_sipTransport.SIPBadResponseInTraceEvent += LogSIPBadResponseIn; #endregion m_dialPlanEngine = new DialPlanEngine( m_sipTransport, m_sipSorceryPersistor.SIPDomainManager.GetDomain, FireSIPMonitorEvent, m_sipSorceryPersistor, m_outboundProxy, m_rubyScriptCommonPath, m_dialplanImpersonationUsername, m_dialplanImpersonationPassword, m_maxDialPlanExecutionLimit); m_sipDialogueManager = new SIPDialogueManager( m_sipTransport, m_outboundProxy, FireSIPMonitorEvent, m_sipSorceryPersistor.SIPDialoguePersistor, m_sipSorceryPersistor.SIPCDRPersistor, SIPRequestAuthenticator.AuthenticateSIPRequest, m_sipSorceryPersistor.SIPAccountsPersistor.Get, m_sipSorceryPersistor.SIPDomainManager.GetDomain); m_callManager = new SIPCallManager( m_sipTransport, m_outboundProxy, FireSIPMonitorEvent, m_sipDialogueManager, m_sipSorceryPersistor.SIPDialoguePersistor, m_sipSorceryPersistor.SIPCDRPersistor, m_dialPlanEngine, m_sipSorceryPersistor.SIPDialPlanPersistor.Get, m_sipSorceryPersistor.SIPAccountsPersistor.Get, m_sipSorceryPersistor.SIPRegistrarBindingPersistor.Get, m_sipSorceryPersistor.SIPProvidersPersistor.Get, m_sipSorceryPersistor.SIPDomainManager.GetDomain, m_customerSessionManager.CustomerPersistor, m_sipSorceryPersistor.SIPDialPlanPersistor, m_traceDirectory, m_monitorCalls, m_dailyCallLimit); m_callManager.Start(); m_appServerCore = new SIPAppServerCore( m_sipTransport, m_sipSorceryPersistor.SIPDomainManager.GetDomain, m_sipSorceryPersistor.SIPAccountsPersistor.Get, FireSIPMonitorEvent, m_callManager, m_sipDialogueManager, SIPRequestAuthenticator.AuthenticateSIPRequest, m_outboundProxy); #endregion #region Initialise WCF services. try { if (WCFUtility.DoesWCFServiceExist(typeof(CallManagerServices).FullName.ToString())) { CallManagerServiceInstanceProvider callManagerSvcInstanceProvider = new CallManagerServiceInstanceProvider(m_callManager, m_sipDialogueManager); Uri callManagerBaseAddress = null; if (m_callManagerServiceAddress != null) { logger.Debug("Adding service address to Call Manager Service " + m_callManagerServiceAddress + "."); callManagerBaseAddress = new Uri(m_callManagerServiceAddress); } if (callManagerBaseAddress != null) { m_callManagerSvcHost = new ServiceHost(typeof(CallManagerServices), callManagerBaseAddress); } else { m_callManagerSvcHost = new ServiceHost(typeof(CallManagerServices)); } m_callManagerSvcHost.Description.Behaviors.Add(callManagerSvcInstanceProvider); m_callManagerSvcHost.Open(); logger.Debug("CallManager hosted service successfully started on " + m_callManagerSvcHost.BaseAddresses[0].AbsoluteUri + "."); } } catch (Exception excp) { logger.Warn("Exception starting CallManager hosted service. " + excp.Message); } #endregion } catch (Exception excp) { logger.Error("Exception SIPAppServerDaemon Start. " + excp.Message); throw excp; } }
public RTCCDaemon(SIPSorceryPersistor sipSorceryPersistor) { m_sipSorceryPersistor = sipSorceryPersistor; m_cdrDataLayer = new Entities.CDRDataLayer(); }
public UserPage( SIPSorceryPersistor persistor, LogoutDelegate logoutDelegate, string owner, string authId, string notificationsURL) { InitializeComponent(); App.AppUnhandledException += new AppUnhandledExceptionDelegate(AppUnhandledException); m_persistor = persistor; //m_sipEventMonitorClient = sipEventMonitorClient; Logout_External = logoutDelegate; m_owner = owner; m_authId = authId; m_notificationsURL = notificationsURL; //m_monitorHost = monitorHost; //m_monitorPort = monitorPort; m_sessionTimer = new Timer(delegate { UIHelper.SetVisibility(m_extendSessionButton, Visibility.Visible); }, null, INITIAL_DISPLAY_EXTEND_SESSION, Timeout.Infinite); m_expiredTimer = new Timer(delegate { SessionExpired(); }, null, SUBSEQUENT_DISPLAY_EXTEND_SESSION, Timeout.Infinite); this.m_activityPorgressBar.Visibility = Visibility.Collapsed; this.TabNavigation = KeyboardNavigationMode.Cycle; this.m_extendSessionButton.Visibility = Visibility.Collapsed; m_persistor.ExtendSessionComplete += ExtendSessionComplete; m_persistor.IsAliveComplete += PersistorIsAliveComplete; m_sipNotifierClient = new SIPSorceryNotificationClient(LogActivityMessage, m_notificationsURL, m_authId); m_sipNotifierClient.StatusChanged += NotificationsServiceStatusChanged; m_sipNotifierClient.MachineEventReceived += SIPEventMonitorClient_MonitorEventReceived; //if (m_sipEventMonitorClient != null) //{ // m_sipEventMonitorClient.SocketDataReceived += new SocketDataReceivedDelegate(SIPEventMonitorClient_MonitorEventReceived); // m_sipEventMonitorClient.SocketConnectionChange += new SocketConnectionChangeDelegate(SIPEventMonitorClient_MonitorConnectionChange); //} m_dialPlanManager = new DialPlanManager(LogActivityMessage, ShowActivityProgress, m_persistor, m_owner); m_dialPlanManager.Visibility = Visibility.Collapsed; m_mainCanvas.Children.Add(m_dialPlanManager); m_sipAccountManager = new SIPAccountManager(LogActivityMessage, ShowActivityProgress, m_persistor, m_dialPlanManager.GetDialPlanNames, m_owner); m_sipAccountManager.Visibility = Visibility.Collapsed; m_mainCanvas.Children.Add(m_sipAccountManager); m_sipProviderManager = new SIPProviderManager(LogActivityMessage, ShowActivityProgress, m_persistor, m_owner); m_sipProviderManager.Visibility = Visibility.Collapsed; m_mainCanvas.Children.Add(m_sipProviderManager); m_sipCallsManager = new SIPCallManager(LogActivityMessage, ShowActivityProgress, m_persistor, m_owner); m_sipCallsManager.Visibility = Visibility.Collapsed; m_mainCanvas.Children.Add(m_sipCallsManager); m_monitorConsole = new MonitoringConsole(LogActivityMessage, m_sipNotifierClient); m_monitorConsole.Visibility = Visibility.Collapsed; m_mainCanvas.Children.Add(m_monitorConsole); m_customerSettings = new CustomerSettingsControl(LogActivityMessage, Logout_External, m_persistor, m_owner); m_customerSettings.Visibility = Visibility.Collapsed; m_mainCanvas.Children.Add(m_customerSettings); SetActive(m_sipAccountManager); SetSelectedTextBlock(m_sipAccountsLink); m_persistor.IsAliveAsync(); m_sipNotifierClient.Connect(); }
public void Start() { try { logger.Debug("pid=" + Process.GetCurrentProcess().Id + "."); logger.Debug("os=" + System.Environment.OSVersion + "."); logger.Debug("current directory=" + m_currentDirectory + "."); logger.Debug("base directory=" + AppDomain.CurrentDomain.BaseDirectory + "."); SIPDNSManager.SIPMonitorLogEvent = FireSIPMonitorEvent; m_sipSorceryPersistor = new SIPSorceryPersistor(m_storageType, m_connectionString); m_customerSessionManager = new CustomerSessionManager(m_storageType, m_connectionString); m_cdrDataLayer = new Entities.CDRDataLayer(); #region Initialise the SIP Application Server and its logging mechanisms including CDRs. logger.Debug("Initiating SIP Application Server Agent."); // Send events from this process to the monitoring socket. if (m_monitorEventLoopbackPort != 0) { m_monitorEventWriter = new SIPMonitorEventWriter(m_monitorEventLoopbackPort); } if (m_cdrDataLayer != null) { SIPCDR.CDRCreated += m_cdrDataLayer.Add; SIPCDR.CDRAnswered += m_cdrDataLayer.Update; SIPCDR.CDRHungup += m_cdrDataLayer.Update; SIPCDR.CDRUpdated += m_cdrDataLayer.Update; } #region Initialise the SIPTransport layers. m_sipTransport = new SIPTransport(SIPDNSManager.ResolveSIPService, new SIPTransactionEngine(), true); if (m_appServerEndPoint != null) { if (m_appServerEndPoint.Protocol == SIPProtocolsEnum.udp) { logger.Debug("Using single SIP transport socket for App Server " + m_appServerEndPoint.ToString() + "."); m_sipTransport.AddSIPChannel(new SIPUDPChannel(m_appServerEndPoint.GetIPEndPoint())); } else if (m_appServerEndPoint.Protocol == SIPProtocolsEnum.tcp) { logger.Debug("Using single SIP transport socket for App Server " + m_appServerEndPoint.ToString() + "."); m_sipTransport.AddSIPChannel(new SIPTCPChannel(m_appServerEndPoint.GetIPEndPoint())); } else { throw new ApplicationException("The SIP End Point of " + m_appServerEndPoint + " cannot be used with the App Server transport layer."); } } else if (m_sipAppServerSocketsNode != null) { m_sipTransport.AddSIPChannel(SIPTransportConfig.ParseSIPChannelsNode(m_sipAppServerSocketsNode)); } else { throw new ApplicationException("The SIP App Server could not be started, no SIP sockets have been configured."); } m_sipTransport.SIPRequestInTraceEvent += LogSIPRequestIn; m_sipTransport.SIPRequestOutTraceEvent += LogSIPRequestOut; m_sipTransport.SIPResponseInTraceEvent += LogSIPResponseIn; m_sipTransport.SIPResponseOutTraceEvent += LogSIPResponseOut; m_sipTransport.SIPBadRequestInTraceEvent += LogSIPBadRequestIn; m_sipTransport.SIPBadResponseInTraceEvent += LogSIPBadResponseIn; #endregion m_dialPlanEngine = new DialPlanEngine( m_sipTransport, m_sipSorceryPersistor.SIPDomainManager.GetDomain, FireSIPMonitorEvent, m_sipSorceryPersistor, m_outboundProxy, m_rubyScriptCommonPath, m_dialplanImpersonationUsername, m_dialplanImpersonationPassword, m_maxDialPlanExecutionLimit); m_sipDialogueManager = new SIPDialogueManager( m_sipTransport, m_outboundProxy, FireSIPMonitorEvent, m_sipSorceryPersistor.SIPDialoguePersistor, m_sipSorceryPersistor.SIPCDRPersistor, SIPRequestAuthenticator.AuthenticateSIPRequest, m_sipSorceryPersistor.SIPAccountsPersistor.Get, m_sipSorceryPersistor.SIPDomainManager.GetDomain); m_callManager = new SIPCallManager( m_sipTransport, m_outboundProxy, FireSIPMonitorEvent, m_sipDialogueManager, m_sipSorceryPersistor.SIPDialoguePersistor, m_sipSorceryPersistor.SIPCDRPersistor, m_dialPlanEngine, m_sipSorceryPersistor.SIPDialPlanPersistor.Get, m_sipSorceryPersistor.SIPAccountsPersistor.Get, m_sipSorceryPersistor.SIPRegistrarBindingPersistor.Get, m_sipSorceryPersistor.SIPProvidersPersistor.Get, m_sipSorceryPersistor.SIPDomainManager.GetDomain, m_customerSessionManager.CustomerPersistor, m_sipSorceryPersistor.SIPDialPlanPersistor, m_traceDirectory, m_monitorCalls, m_dailyCallLimit); m_callManager.Start(); GetSIPAccountDelegate getSIPAccount = (username, domain) => { return(m_sipSorceryPersistor.SIPAccountsPersistor.Get(x => x.SIPUsername == username && x.SIPDomain == domain).SIPAccount); }; m_appServerCore = new SIPAppServerCore( m_sipTransport, m_sipSorceryPersistor.SIPDomainManager.GetDomain, getSIPAccount, FireSIPMonitorEvent, m_callManager, m_sipDialogueManager, SIPRequestAuthenticator.AuthenticateSIPRequest, m_outboundProxy); #endregion #region Initialise WCF services. try { if (WCFUtility.DoesWCFServiceExist(typeof(CallManagerServices).FullName.ToString())) { CallManagerServiceInstanceProvider callManagerSvcInstanceProvider = new CallManagerServiceInstanceProvider(m_callManager, m_sipDialogueManager); Uri callManagerBaseAddress = null; if (m_callManagerServiceAddress != null) { logger.Debug("Adding service address to Call Manager Service " + m_callManagerServiceAddress + "."); callManagerBaseAddress = new Uri(m_callManagerServiceAddress); } if (callManagerBaseAddress != null) { m_callManagerSvcHost = new ServiceHost(typeof(CallManagerServices), callManagerBaseAddress); } else { m_callManagerSvcHost = new ServiceHost(typeof(CallManagerServices)); } m_callManagerSvcHost.Description.Behaviors.Add(callManagerSvcInstanceProvider); m_callManagerSvcHost.Open(); logger.Debug("CallManager hosted service successfully started on " + m_callManagerSvcHost.BaseAddresses[0].AbsoluteUri + "."); } } catch (Exception excp) { logger.Warn("Exception starting CallManager hosted service. " + excp.Message); } #endregion } catch (Exception excp) { logger.Error("Exception SIPAppServerDaemon Start. " + excp.Message); throw excp; } }
private void Authenticated(string username, string authID) { UIHelper.SetText(m_provisioningStatusMessage, "Initialising..."); UIHelper.SetFill(m_appStatusIcon, Colors.Blue); //m_loginControl.DisableNewAccounts(null); m_owner = username; m_authId = authID; #if !BLEND m_authorisedPersistor = SIPSorceryPersistorFactory.CreateSIPSorceryPersistor(SIPPersistorTypesEnum.WebService, m_provisioningServiceURL, m_authId); #else m_authorisedPersistor = SIPSorceryPersistorFactory.CreateSIPSorceryPersistor(SIPPersistorTypesEnum.GUITest, m_provisioningServiceURL, m_authId); #endif m_authorisedPersistor.SessionExpired += SessionExpired; m_authorisedPersistor.LogoutComplete += LogoutComplete; m_authorisedPersistor.GetTimeZoneOffsetMinutesComplete += GetTimeZoneOffsetMinutesComplete; m_authorisedPersistor.GetTimeZoneOffsetMinutesAsync(); m_loginControl.Clear(); //m_loginControl.DisableNewAccounts(null); m_createAccountControl.Clear(); UIHelper.SetVisibility(m_createAccountControl, Visibility.Collapsed); m_userPage = new UserPage(m_authorisedPersistor, LogoutAsync, m_owner, m_authId, m_notificationsServiceURL); m_mainPageBorder.Content = m_userPage; UpdateAppStatus(); }
private void Initialise() { #if !BLEND m_unauthorisedPersistor = SIPSorceryPersistorFactory.CreateSIPSorceryPersistor(SIPPersistorTypesEnum.WebService, m_provisioningServiceURL, null); EndpointAddress address = new EndpointAddress(m_inviteServiceURL); BasicHttpSecurityMode securitymode = (m_inviteServiceURL.StartsWith("https")) ? BasicHttpSecurityMode.Transport : BasicHttpSecurityMode.None; BasicHttpBinding binding = new BasicHttpBinding(securitymode); m_inviteProxy = new SIPSorceryInvite.SIPSorceryInviteServiceClient(binding, address); #else m_unauthorisedPersistor = SIPSorceryPersistorFactory.CreateSIPSorceryPersistor(SIPPersistorTypesEnum.GUITest, m_provisioningServiceURL, null); //ThreadPool.QueueUserWorkItem(new WaitCallback(m_sipMonitorDisplay.RunHitPointSimulation), null); #endif m_unauthorisedPersistor.TestExceptionComplete += TestExceptionComplete; m_unauthorisedPersistor.IsAliveComplete += PersistorIsAliveComplete; m_unauthorisedPersistor.AreNewAccountsEnabledComplete += AreNewAccountsEnabledComplete; //m_unauthorisedPersistor.CheckInviteCodeComplete +=CheckInviteCodeComplete; m_unauthorisedPersistor.CreateCustomerComplete += CreateCustomerComplete; m_createAccountControl.CreateCustomer_External = m_unauthorisedPersistor.CreateCustomerAsync; m_loginControl.SetProxy(m_unauthorisedPersistor, m_inviteProxy); InitialiseServices(0); }
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, SIPSorceryPersistor sipSorceryPersistor, SIPEndPoint outboundProxySocket, DialPlanEngine dialPlanEngine ) { 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_sipSorceryPersistor = sipSorceryPersistor; 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_sipSorceryPersistor != null && m_sipSorceryPersistor.SIPAccountsPersistor != null) { getSIPAccount = m_sipSorceryPersistor.SIPAccountsPersistor.Get; } m_dialStringParser = new DialStringParser(m_sipTransport, m_dialPlanContext.Owner, m_dialPlanContext.SIPAccount, m_sipProviders, getSIPAccount, m_sipSorceryPersistor.SIPRegistrarBindingPersistor.Get, m_getCanonicalDomainDelegate, logDelegate, m_dialPlanContext.SIPDialPlan.DialPlanName); } }
public void Start() { try { logger.Debug("pid=" + Process.GetCurrentProcess().Id + "."); logger.Debug("os=" + System.Environment.OSVersion + "."); logger.Debug("current directory=" + m_currentDirectory + "."); logger.Debug("base directory=" + AppDomain.CurrentDomain.BaseDirectory + "."); SIPDNSManager.SIPMonitorLogEvent = FireSIPMonitorEvent; m_sipSorceryPersistor = new SIPSorceryPersistor(m_storageType, m_connectionString); m_customerSessionManager = new CustomerSessionManager(m_storageType, m_connectionString); m_cdrDataLayer = new Entities.CDRDataLayer(); if (m_sipProxyEnabled) { m_sipProxyDaemon = new SIPProxyDaemon(); m_sipProxyDaemon.Start(); if (m_sipProxyDaemon.PublicIPAddress != null) { m_publicIPAddress = m_sipProxyDaemon.PublicIPAddress; DialStringParser.PublicIPAddress = m_sipProxyDaemon.PublicIPAddress; DialPlanScriptFacade.PublicIPAddress = m_sipProxyDaemon.PublicIPAddress; SIPDialogueManager.PublicIPAddress = m_sipProxyDaemon.PublicIPAddress; } else { m_sipProxyDaemon.PublicIPAddressUpdated += (ipAddress) => { if (ipAddress != null && (m_publicIPAddress == null || ipAddress.ToString() != m_publicIPAddress.ToString())) { m_publicIPAddress = ipAddress; DialStringParser.PublicIPAddress = ipAddress; DialPlanScriptFacade.PublicIPAddress = ipAddress; SIPDialogueManager.PublicIPAddress = ipAddress; } }; } } if (m_sipMonitorEnabled) { m_sipMonitorPublisher = new SIPMonitorClientManager(null); m_sipMonitorDaemon = new SIPMonitorDaemon(m_sipMonitorPublisher); m_sipMonitorDaemon.Start(); } if (m_sipRegistrarEnabled) { m_sipRegistrarDaemon = new SIPRegistrarDaemon( m_sipSorceryPersistor.SIPDomainManager.GetDomain, m_sipSorceryPersistor.SIPAccountsPersistor.Get, m_sipSorceryPersistor.SIPRegistrarBindingPersistor, SIPRequestAuthenticator.AuthenticateSIPRequest, m_customerSessionManager.CustomerPersistor); m_sipRegistrarDaemon.Start(); } if (m_sipRegAgentEnabled) { m_sipRegAgentDaemon = new SIPRegAgentDaemon( m_sipSorceryPersistor.SIPProvidersPersistor, m_sipSorceryPersistor.SIPProviderBindingsPersistor); m_sipRegAgentDaemon.Start(); } if (m_sipNotifierEnabled) { m_sipNotifierDaemon = new SIPNotifierDaemon( m_customerSessionManager.CustomerPersistor.Get, m_sipSorceryPersistor.SIPDialoguePersistor.Get, m_sipSorceryPersistor.SIPDialoguePersistor.Get, m_sipSorceryPersistor.SIPDomainManager.GetDomain, m_sipSorceryPersistor.SIPAccountsPersistor, m_sipSorceryPersistor.SIPRegistrarBindingPersistor.Get, m_sipSorceryPersistor.SIPAccountsPersistor.Get, m_sipSorceryPersistor.SIPRegistrarBindingPersistor.Count, SIPRequestAuthenticator.AuthenticateSIPRequest, m_sipMonitorPublisher); //new SIPMonitorUDPSink("127.0.0.1:10003")); m_sipNotifierDaemon.Start(); } if (m_sshServerEnabled) { SSHServerDaemon daemon = new SSHServerDaemon(m_customerSessionManager, m_sipMonitorPublisher); // Uses memory to transfer events. //SSHServerDaemon daemon = new SSHServerDaemon(m_customerSessionManager, new SIPMonitorUDPSink("127.0.0.1:10002")); daemon.Start(); } #region Initialise the SIP Application Server and its logging mechanisms including CDRs. logger.Debug("Initiating SIP Application Server Agent."); // Send events from this process to the monitoring socket. if (m_monitorEventLoopbackPort != 0) { m_monitorEventWriter = new SIPMonitorEventWriter(m_monitorEventLoopbackPort); } if (m_cdrDataLayer != null) { SIPCDR.CDRCreated += m_cdrDataLayer.Add; SIPCDR.CDRAnswered += m_cdrDataLayer.Update; SIPCDR.CDRHungup += m_cdrDataLayer.Update; SIPCDR.CDRUpdated += m_cdrDataLayer.Update; } #region Initialise the SIPTransport layers. m_sipTransport = new SIPTransport(SIPDNSManager.ResolveSIPService, new SIPTransactionEngine(), true); if (m_appServerEndPoint != null) { if (m_appServerEndPoint.Protocol == SIPProtocolsEnum.udp) { logger.Debug("Using single SIP transport socket for App Server " + m_appServerEndPoint.ToString() + "."); m_sipTransport.AddSIPChannel(new SIPUDPChannel(m_appServerEndPoint.GetIPEndPoint())); } else if (m_appServerEndPoint.Protocol == SIPProtocolsEnum.tcp) { logger.Debug("Using single SIP transport socket for App Server " + m_appServerEndPoint.ToString() + "."); m_sipTransport.AddSIPChannel(new SIPTCPChannel(m_appServerEndPoint.GetIPEndPoint())); } else { throw new ApplicationException("The SIP End Point of " + m_appServerEndPoint + " cannot be used with the App Server transport layer."); } } else if (m_sipAppServerSocketsNode != null) { m_sipTransport.AddSIPChannel(SIPTransportConfig.ParseSIPChannelsNode(m_sipAppServerSocketsNode)); } else { throw new ApplicationException("The SIP App Server could not be started, no SIP sockets have been configured."); } m_sipTransport.SIPRequestInTraceEvent += LogSIPRequestIn; m_sipTransport.SIPRequestOutTraceEvent += LogSIPRequestOut; m_sipTransport.SIPResponseInTraceEvent += LogSIPResponseIn; m_sipTransport.SIPResponseOutTraceEvent += LogSIPResponseOut; m_sipTransport.SIPBadRequestInTraceEvent += LogSIPBadRequestIn; m_sipTransport.SIPBadResponseInTraceEvent += LogSIPBadResponseIn; #endregion m_dialPlanEngine = new DialPlanEngine( m_sipTransport, m_sipSorceryPersistor.SIPDomainManager.GetDomain, FireSIPMonitorEvent, m_sipSorceryPersistor, //m_sipSorceryPersistor.SIPAccountsPersistor, //m_sipSorceryPersistor.SIPRegistrarBindingPersistor.Get, //m_sipSorceryPersistor.SIPDialPlanPersistor, //m_sipSorceryPersistor.SIPDialoguePersistor, m_outboundProxy, m_rubyScriptCommonPath, m_dialplanImpersonationUsername, m_dialplanImpersonationPassword, m_maxDialPlanExecutionLimit); m_sipDialogueManager = new SIPDialogueManager( m_sipTransport, m_outboundProxy, FireSIPMonitorEvent, m_sipSorceryPersistor.SIPDialoguePersistor, m_sipSorceryPersistor.SIPCDRPersistor, SIPRequestAuthenticator.AuthenticateSIPRequest, m_sipSorceryPersistor.SIPAccountsPersistor.Get, m_sipSorceryPersistor.SIPDomainManager.GetDomain); m_callManager = new SIPCallManager( m_sipTransport, m_outboundProxy, FireSIPMonitorEvent, m_sipDialogueManager, m_sipSorceryPersistor.SIPDialoguePersistor, m_sipSorceryPersistor.SIPCDRPersistor, m_dialPlanEngine, m_sipSorceryPersistor.SIPDialPlanPersistor.Get, m_sipSorceryPersistor.SIPAccountsPersistor.Get, m_sipSorceryPersistor.SIPRegistrarBindingPersistor.Get, m_sipSorceryPersistor.SIPProvidersPersistor.Get, m_sipSorceryPersistor.SIPDomainManager.GetDomain, m_customerSessionManager.CustomerPersistor, m_sipSorceryPersistor.SIPDialPlanPersistor, m_traceDirectory, m_monitorCalls, m_dailyCallLimit); m_callManager.Start(); m_appServerCore = new SIPAppServerCore( m_sipTransport, m_sipSorceryPersistor.SIPDomainManager.GetDomain, m_sipSorceryPersistor.SIPAccountsPersistor.Get, FireSIPMonitorEvent, m_callManager, m_sipDialogueManager, SIPRequestAuthenticator.AuthenticateSIPRequest, m_outboundProxy); m_rtccCore = new RTCCCore( FireSIPMonitorEvent, m_sipDialogueManager, m_sipSorceryPersistor.SIPDialoguePersistor); m_rtccCore.Start(); m_rateUpdater = new RateBulkUpdater(FireSIPMonitorEvent); m_rateUpdater.Start(); #endregion #region Initialise WCF services. try { if (WCFUtility.DoesWCFServiceExist(typeof(SIPProvisioningWebService).FullName.ToString())) { if (m_sipSorceryPersistor == null) { logger.Warn("Provisioning hosted service could not be started as Persistor object was null."); } else { SIPProviderBindingSynchroniser sipProviderBindingSynchroniser = new SIPProviderBindingSynchroniser(m_sipSorceryPersistor.SIPProviderBindingsPersistor); m_sipSorceryPersistor.SIPProvidersPersistor.Added += sipProviderBindingSynchroniser.SIPProviderAdded; m_sipSorceryPersistor.SIPProvidersPersistor.Updated += sipProviderBindingSynchroniser.SIPProviderUpdated; m_sipSorceryPersistor.SIPProvidersPersistor.Deleted += sipProviderBindingSynchroniser.SIPProviderDeleted; ProvisioningServiceInstanceProvider instanceProvider = new ProvisioningServiceInstanceProvider( m_sipSorceryPersistor.SIPAccountsPersistor, m_sipSorceryPersistor.SIPDialPlanPersistor, m_sipSorceryPersistor.SIPProvidersPersistor, m_sipSorceryPersistor.SIPProviderBindingsPersistor, m_sipSorceryPersistor.SIPRegistrarBindingPersistor, m_sipSorceryPersistor.SIPDialoguePersistor, m_sipSorceryPersistor.SIPCDRPersistor, m_customerSessionManager, m_sipSorceryPersistor.SIPDomainManager, FireSIPMonitorEvent, 0, false); m_sipProvisioningHost = new ServiceHost(typeof(SIPProvisioningWebService)); m_sipProvisioningHost.Description.Behaviors.Add(instanceProvider); m_sipProvisioningHost.Open(); if (m_sipRegAgentDaemon == null) { m_sipRegAgentDaemon = new SIPRegAgentDaemon( m_sipSorceryPersistor.SIPProvidersPersistor, m_sipSorceryPersistor.SIPProviderBindingsPersistor); } logger.Debug("Provisioning hosted service successfully started on " + m_sipProvisioningHost.BaseAddresses[0].AbsoluteUri + "."); } } } catch (Exception excp) { logger.Warn("Exception starting Provisioning hosted service. " + excp.Message); } try { if (WCFUtility.DoesWCFServiceExist(typeof(CrossDomainService).FullName.ToString())) { m_accessPolicyHost = new ServiceHost(typeof(CrossDomainService)); m_accessPolicyHost.Open(); logger.Debug("CrossDomain hosted service successfully started on " + m_accessPolicyHost.BaseAddresses[0].AbsoluteUri + "."); } } catch (Exception excp) { logger.Warn("Exception starting CrossDomain hosted service. " + excp.Message); } try { if (WCFUtility.DoesWCFServiceExist(typeof(CallManagerServices).FullName.ToString())) { CallManagerServiceInstanceProvider callManagerSvcInstanceProvider = new CallManagerServiceInstanceProvider(m_callManager, m_sipDialogueManager); Uri callManagerBaseAddress = null; if (m_callManagerServiceAddress != null) { logger.Debug("Adding service address to Call Manager Service " + m_callManagerServiceAddress + "."); callManagerBaseAddress = new Uri(m_callManagerServiceAddress); } if (callManagerBaseAddress != null) { m_callManagerSvcHost = new ServiceHost(typeof(CallManagerServices), callManagerBaseAddress); } else { m_callManagerSvcHost = new ServiceHost(typeof(CallManagerServices)); } m_callManagerSvcHost.Description.Behaviors.Add(callManagerSvcInstanceProvider); m_callManagerSvcHost.Open(); logger.Debug("CallManager hosted service successfully started on " + m_callManagerSvcHost.BaseAddresses[0].AbsoluteUri + "."); } } catch (Exception excp) { logger.Warn("Exception starting CallManager hosted service. " + excp.Message); } if (WCFUtility.DoesWCFServiceExist(typeof(SIPNotifierService).FullName.ToString())) { if (m_sipMonitorPublisher != null) { try { SIPNotifierService notifierService = new SIPNotifierService(m_sipMonitorPublisher, m_customerSessionManager); m_sipNotificationsHost = new ServiceHost(notifierService); m_sipNotificationsHost.Open(); logger.Debug("SIPNotificationsService hosted service successfully started on " + m_sipNotificationsHost.BaseAddresses[0].AbsoluteUri + "."); } catch (Exception excp) { logger.Warn("Exception starting SIPNotificationsService hosted service. " + excp.Message); } } } #endregion } catch (Exception excp) { logger.Error("Exception SIPAppServerDaemon Start. " + excp.Message); throw excp; } }