public List<SIPDialplanLookup> GetLookups() { try { var dialplanLookupEntities = new SIPSorceryAppEntities(); return (from lookup in dialplanLookupEntities.SIPDialplanLookups where lookup.owner == m_owner select lookup).ToList(); } catch (Exception excp) { logger.Error("Exception GetLookups. " + excp.Message); return null; } }
static void Main(string[] args) { bool isConsole = false; try { // Get DateTime.ToString() to use a format ot ToString("o") instead of ToString("G"). CultureInfo culture = (CultureInfo)CultureInfo.CurrentCulture.Clone(); culture.DateTimeFormat.ShortDatePattern = "yyyy-MM-dd"; culture.DateTimeFormat.LongTimePattern = "THH:mm:ss.fffffffzzz"; Thread.CurrentThread.CurrentCulture = culture; m_serverStorageType = (AppState.GetConfigSetting(m_storageTypeKey) != null) ? StorageTypesConverter.GetStorageType(AppState.GetConfigSetting(m_storageTypeKey)) : StorageTypes.Unknown; m_serverStorageConnStr = AppState.GetConfigSetting(m_connStrKey); bool monitorCalls = true; if (m_serverStorageType == StorageTypes.Unknown || m_serverStorageConnStr.IsNullOrBlank()) { throw new ApplicationException("The SIP Application Service cannot start with no persistence settings specified."); } // Need to force the System.Data.Entity assembly to load before a dialplan instantiation. The assembly will fail to load if // requested from the Dynamic Language Runtime which is what happens if the first time it's requested is in an IronRuby dialplan. using (SIPSorceryAppEntities appEntities = new SIPSorceryAppEntities()) { logger.Debug("Lookups count=" + (from lookup in appEntities.SIPDialplanLookups select lookup).Count() + ", forcing entity framework assemblies to load."); } //if (args != null && args.Length > 0) //{ isConsole = true; Console.WriteLine("SIP App Server starting"); logger.Debug("SIP App Server Console starting..."); string sipSocket = null; string callManagerSvcAddress = null; foreach (string arg in args) { if (arg.StartsWith("-sip:")) { sipSocket = arg.Substring(5); } else if (arg.StartsWith("-cms:")) { callManagerSvcAddress = arg.Substring(5); } else if (arg.StartsWith("-hangupcalls:")) { monitorCalls = Convert.ToBoolean(arg.Substring(13)); } } SIPAppServerDaemon daemon = null; if (sipSocket.IsNullOrBlank() || callManagerSvcAddress.IsNullOrBlank()) { daemon = new SIPAppServerDaemon(m_serverStorageType, m_serverStorageConnStr); } else { daemon = new SIPAppServerDaemon(m_serverStorageType, m_serverStorageConnStr, SIPEndPoint.ParseSIPEndPoint(sipSocket), callManagerSvcAddress, monitorCalls); } Thread daemonThread = new Thread(new ThreadStart(daemon.Start)); daemonThread.Start(); m_proxyUp.WaitOne(); //} //else //{ // logger.Debug("SIP App Server Windows Service Starting..."); // System.ServiceProcess.ServiceBase[] ServicesToRun; // SIPAppServerDaemon daemon = new SIPAppServerDaemon(m_serverStorageType, m_serverStorageConnStr); // ServicesToRun = new System.ServiceProcess.ServiceBase[] { new Service(daemon) }; // System.ServiceProcess.ServiceBase.Run(ServicesToRun); //} } catch (Exception excp) { Console.WriteLine("Exception SIP App Server Main. " + excp.Message); if (isConsole) { Console.WriteLine("press any key to exit..."); Console.ReadLine(); } } }
public List<SIPDialplanRoute> GetRoutes() { try { var appEntities = new SIPSorceryAppEntities(); var routes = (from route in appEntities.SIPDialplanRoutes where route.owner == m_owner select route).ToList(); if (routes != null && routes.Count > 0) { List<SIPDialplanRoute> routesList = new List<SIPDialplanRoute>(); foreach (SIPDialplanRoute route in routes) { routesList.Add(route); } return routesList; } return null; } catch (Exception excp) { logger.Error("Exception GetRoutes. " + excp.Message); return null; } }
public SIPDialplanOption GetOptions() { try { var appEntities = new SIPSorceryAppEntities(); return (from option in appEntities.SIPDialplanOptions where option.owner == m_owner select option).FirstOrDefault(); } catch (Exception excp) { logger.Error("Exception GetOptions. " + excp.Message); return null; } }
public Dictionary<string, SIPDialplanProvider> GetProviders() { try { var appEntities = new SIPSorceryAppEntities(); var providers = (from provider in appEntities.SIPDialplanProviders where provider.owner == m_owner select provider).ToList(); if (providers != null && providers.Count > 0) { Dictionary<string, SIPDialplanProvider> providersList = new Dictionary<string, SIPDialplanProvider>(); foreach (SIPDialplanProvider provider in providers) { providersList.Add(provider.providername, provider); } return providersList; } return null; } catch (Exception excp) { logger.Error("Exception GetProviders. " + excp.Message); return null; } }