internal ExtensionDeploymentEvent(sDeployedExtension extension)
 {
     _pars.Add("Extension", extension);
 }
 public void DeployExtension(sDeployedExtension extension)
 {
     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 + extension.DomainName);
     string str = Utility.ReadEmbeddedResource("Org.Reddragonit.FreeSwitchConfig.DataCore.Generators.resources.Extension.st");
     Log.Trace("Generating config file for extension " + extension.Number);
     Template st = new Template(str);
     st.SetAttribute("ext", extension);
     FileStream fs = new FileStream(di.FullName + Path.DirectorySeparatorChar + extension.Number + ".xml", FileMode.Create, FileAccess.Write, FileShare.None);
     st.WriteToStream(fs);
     fs.Close();
 }
 public void DeployExtension(sDeployedExtension ext)
 {
     lock (_cachedMessageCount)
     {
         _cachedMessageCount.Remove(ext.Number + "@" + ext.DomainName);
     }
 }
예제 #4
0
 public static void RegenerateExtensionFiles(string extensionNumber, Domain domain)
 {
     if (!IsDomainDeployed(domain.Name))
     {
         Log.Trace("Creating domain " + domain.Name + " to produce an extension");
         RegenerateDomainFile(domain);
     }
     Extension ext = Extension.Load(extensionNumber, domain);
     if (ext == null)
     {
         Lock();
         List<sDeployedExtension> exts = extensions;
         for (int x = 0; x < exts.Count; x++)
         {
             if ((exts[x].Number == extensionNumber) || (exts[x].DomainName == domain.Name))
             {
                 exts.RemoveAt(x);
                 break;
             }
         }
         extensions = exts;
         UnLock();
         _deployer.DestroyExtension(domain.Name, extensionNumber);
         EventController.TriggerEvent(new ExtensionDestroyedEvent(extensionNumber,domain.Name));
     }
     else
     {
         sDeployedExtension sext = new sDeployedExtension(ext);
         Lock();
         List<sDeployedExtension> exts = extensions;
         bool add = true;
         for (int x = 0; x < exts.Count; x++)
         {
             if ((exts[x].Number == extensionNumber) && (exts[x].DomainName == domain.Name))
             {
                 exts[x] = sext;
                 add = false;
                 break;
             }
         }
         if (add)
             exts.Add(sext);
         extensions = exts;
         UnLock();
         _deployer.DeployExtension(sext);
         EventController.TriggerEvent(new ExtensionDeploymentEvent(sext));
         Log.Trace("Config file for extension " + extensionNumber + " has been successfully created");
         Extension ex = Extension.Load(extensionNumber, domain);
         VoiceMail vm = VoiceMail.Load(ex.Number,ex.Context);
         if ((vm != null) && vm.ResetVMPassword)
         {
             vm.ResetVMPassword = false;
             vm.Update();
         }
     }
 }