コード例 #1
0
 public void DeployDomain(sDeployedDomain domain)
 {
     DirectoryInfo di = new DirectoryInfo(Settings.Current[Constants.BASE_PATH_NAME].ToString() + Path.DirectorySeparatorChar + Constants.DEFAULT_CONF_DIR +
         Path.DirectorySeparatorChar + Constants.DEFAULT_EXTENSIONS_DIRECTORY + Path.DirectorySeparatorChar + domain.Name);
     if (!di.Exists)
     {
         Log.Trace("Creating domain directory " + domain.Name + " for extensions");
         di.Create();
     }
     FileInfo fi = new FileInfo(di.FullName + ".xml");
     if (fi.Exists)
         fi.Delete();
     Log.Trace("Deploying domain configuration file for domain " + domain.Name);
     string str = Utility.ReadEmbeddedResource("Org.Reddragonit.FreeSwitchConfig.DataCore.Generators.resources.BaseConfigurations.domain.st");
     Template st = new Template(str);
     st.SetAttribute("domain", domain);
     FileStream fs = fi.OpenWrite();
     st.WriteToStream(fs);
     fs.Close();
 }
コード例 #2
0
 internal DomainDeploymentEvent(sDeployedDomain domain)
 {
     _pars.Add("Domain", domain);
 }
コード例 #3
0
 public void DeployDomain(sDeployedDomain domain)
 {
     lock (_cachedMessageCount)
     {
         string[] keys = new string[_cachedMessageCount.Count];
         _cachedMessageCount.Keys.CopyTo(keys, 0);
         foreach (string str in keys)
         {
             if (str.EndsWith("@" + domain.Name))
                 _cachedMessageCount.Remove(str);
         }
     }
 }
コード例 #4
0
 internal static List<string> GetExtensionNumbersForDomain(sDeployedDomain domain)
 {
     List<string> ret = new List<string>();
     Lock();
     foreach (sDeployedExtension ext in extensions)
     {
         if (ext.DomainName == domain.Name)
             ret.Add(ext.Number);
     }
     foreach (sDeployedIncomingSIPTrunk ist in itrunks)
     {
         if (ist.DomainName == domain.Name)
             ret.Add(ist.Number);
     }
     UnLock();
     return ret;
 }
コード例 #5
0
 public static void RegenerateDomainFile(Domain domain)
 {
     sDeployedDomain dom = new sDeployedDomain(domain);
     Lock();
     List<sDeployedDomain> doms = domains;
     bool add = true;
     for (int x = 0; x < doms.Count; x++)
     {
         if (doms[x].Name == dom.Name)
         {
             doms[x] = dom;
             add = false;
             break;
         }
     }
     if (add)
         doms.Add(dom);
     domains = doms;
     UnLock();
     _deployer.DeployDomain(dom);
     EventController.TriggerEvent(new DomainDeploymentEvent(dom));
 }