public void DialplanDeployed(ADialPlan plan, int index) { lock (_files) { _plans.Insert(index, plan.Name); foreach (sCallContext cont in plan.CallContexts) { if (!_files.ContainsKey(cont.Name)) { _files.Add(cont.Name, new List <XmlContextFile>()); } List <XmlContextFile> tfiles = _files[cont.Name]; XmlContextFile file = new XmlContextFile(plan.Name); for (int x = 0; x < tfiles.Count; x++) { if (_plans.IndexOf(tfiles[x].FileName) > _plans.IndexOf(plan.Name)) { tfiles.Insert(x, file); break; } } _files.Remove(cont.Name); _files.Add(cont.Name, tfiles); foreach (sCallExtension ext in cont.Extensions) { WriteCallExtension(ext, file); } } } }
public void DialplanUpdated(ADialPlan plan) { lock (_files) { string[] keys = new string[_files.Count]; _files.Keys.CopyTo(keys, 0); foreach (string key in keys) { List <XmlContextFile> files = _files[key]; for (int x = 0; x < files.Count; x++) { if (files[x].FileName == plan.Name) { files.RemoveAt(x); break; } } _files.Remove(key); _files.Add(key, files); } foreach (sCallContext cont in plan.CallContexts) { if (!_files.ContainsKey(cont.Name)) { _files.Add(cont.Name, new List <XmlContextFile>()); } List <XmlContextFile> tfiles = _files[cont.Name]; XmlContextFile file = new XmlContextFile(plan.Name); for (int x = 0; x < tfiles.Count; x++) { if (_plans.IndexOf(tfiles[x].FileName) > _plans.IndexOf(plan.Name)) { tfiles.Insert(x, file); break; } } _files.Remove(cont.Name); _files.Add(cont.Name, tfiles); foreach (sCallExtension ext in cont.Extensions) { WriteCallExtension(ext, file); } } } }
public void Start(ADialPlan[] plans) { _files = new Dictionary<string, List<XmlContextFile>>(); _plans = new List<string>(); foreach (ADialPlan plan in plans) { _plans.Add(plan.Name); foreach (sCallContext cont in plan.CallContexts) { if (!_files.ContainsKey(cont.Name)) _files.Add(cont.Name, new List<XmlContextFile>()); List<XmlContextFile> tfiles = _files[cont.Name]; XmlContextFile file = new XmlContextFile(plan.Name); tfiles.Add(file); _files.Remove(cont.Name); _files.Add(cont.Name, tfiles); foreach (sCallExtension ext in cont.Extensions) WriteCallExtension(ext, file); } } }
public void DialplanUnDeployed(ADialPlan plan) { lock (_files) { string[] keys = new string[_files.Count]; _files.Keys.CopyTo(keys, 0); foreach (string key in keys) { List <XmlContextFile> files = _files[key]; for (int x = 0; x < files.Count; x++) { if (files[x].FileName == plan.Name) { files.RemoveAt(x); break; } } _files.Remove(key); _files.Add(key, files); } } }
public static void Initialize() { if (!Initialized) { mut.WaitOne(); if (!Initialized) { Initialized = true; InitBaseData(); //Org.Reddragonit.FreeSwitchConfig.DataCore.DB.Users.User.Initialize(); ModuleController.Current.LoadModulesFromDirectory(Utility.LocateDirectory("LoadedModules")); foreach (Type t in typeof(Initializer).Assembly.GetTypes()) { if (t.FullName.StartsWith("Org.Reddragonit.FreeSwitchConfig.Site.BaseComponents.DialPlans") && t.IsSubclassOf(typeof(ADialPlan))) { ADialPlan adp = (ADialPlan)t.GetConstructor(Type.EmptyTypes).Invoke(new object[] { }); CallControlManager.DeployDialPlan(adp); } } } Log.Trace("Releasing initializer mutex..."); mut.ReleaseMutex(); } }
public void DialplanUnDeployed(ADialPlan plan) { lock (_files) { string[] keys = new string[_files.Count]; _files.Keys.CopyTo(keys, 0); foreach (string key in keys) { List<XmlContextFile> files = _files[key]; for (int x = 0; x < files.Count; x++) { if (files[x].FileName == plan.Name) { files.RemoveAt(x); break; } } _files.Remove(key); _files.Add(key, files); } } }
public void DialplanDeployed(ADialPlan plan, int index) { lock (_files) { _plans.Insert(index, plan.Name); foreach (sCallContext cont in plan.CallContexts) { if (!_files.ContainsKey(cont.Name)) _files.Add(cont.Name, new List<XmlContextFile>()); List<XmlContextFile> tfiles = _files[cont.Name]; XmlContextFile file = new XmlContextFile(plan.Name); for (int x = 0; x < tfiles.Count; x++) { if (_plans.IndexOf(tfiles[x].FileName) > _plans.IndexOf(plan.Name)) { tfiles.Insert(x, file); break; } } _files.Remove(cont.Name); _files.Add(cont.Name, tfiles); foreach (sCallExtension ext in cont.Extensions) WriteCallExtension(ext, file); } } }
public void DialplanUpdated(ADialPlan plan) { lock (_files) { string[] keys = new string[_files.Count]; _files.Keys.CopyTo(keys, 0); foreach (string key in keys) { List<XmlContextFile> files = _files[key]; for (int x = 0; x < files.Count; x++) { if (files[x].FileName == plan.Name) { files.RemoveAt(x); break; } } _files.Remove(key); _files.Add(key, files); } foreach (sCallContext cont in plan.CallContexts) { if (!_files.ContainsKey(cont.Name)) _files.Add(cont.Name, new List<XmlContextFile>()); List<XmlContextFile> tfiles = _files[cont.Name]; XmlContextFile file = new XmlContextFile(plan.Name); for (int x = 0; x < tfiles.Count; x++) { if (_plans.IndexOf(tfiles[x].FileName) > _plans.IndexOf(plan.Name)) { tfiles.Insert(x, file); break; } } _files.Remove(cont.Name); _files.Add(cont.Name, tfiles); foreach (sCallExtension ext in cont.Extensions) WriteCallExtension(ext, file); } } }