public void DeploySipProfile(sDeployedProfile profile) { string str = Utility.ReadEmbeddedResource("Org.Reddragonit.FreeSwitchConfig.DataCore.Generators.resources.BaseConfigurations.sip_profile.st"); Template st = new Template(str); st.SetAttribute("profile", profile); DirectoryInfo di = new DirectoryInfo(Settings.Current[Constants.BASE_PATH_NAME].ToString() + Path.DirectorySeparatorChar + Constants.DEFAULT_CONF_DIR + Path.DirectorySeparatorChar + Constants.DEFAULT_SIP_PROFILES_PATH + Path.DirectorySeparatorChar + profile.Name); if (!di.Exists) { Log.Trace("Creating SIP profile directory " + profile.Name + " for gateways"); di.Create(); } FileInfo fi = new FileInfo(di.FullName + ".xml"); if (fi.Exists) fi.Delete(); Log.Trace("Deploying SIP profile configuration file for sip_profile " + profile.Name); FileStream fs = fi.OpenWrite(); st.WriteToStream(fs); fs.Close(); }
internal SipProfileDeploymentEvent(sDeployedProfile profile) { _pars.Add("Profile", profile); }
public void DeploySipProfile(sDeployedProfile profile) { lock (_cachedDialPlans) { if (_cachedDialPlans.ContainsKey(profile.Name)) _cachedDialPlans.Remove(profile.Name); } }
internal static List<sDeployedOutgoingSipTrunk> GetOutgoingTrunksForProfile(sDeployedProfile profile) { List<sDeployedOutgoingSipTrunk> ret = new List<sDeployedOutgoingSipTrunk>(); Lock(); foreach (sDeployedOutgoingSipTrunk trk in trunks) { if (trk.ProfileName == profile.Name) ret.Add(trk); } UnLock(); return ret; }
public static void RegenerateSIPProfile(SipProfile profile) { sDeployedProfile prof = new sDeployedProfile(profile); Lock(); List<sDeployedProfile> profs = profiles; bool add = true; for (int x = 0; x < profs.Count; x++) { if (profs[x].Name == prof.Name) { profs[x] = prof; add = false; break; } } if (add) profs.Add(prof); profiles = profs; UnLock(); _deployer.DeploySipProfile(prof); EventController.TriggerEvent(new SipProfileDeploymentEvent(prof)); }
internal static List<sDeployedDomain> GetDomainsForProfile(sDeployedProfile profile) { List<sDeployedDomain> ret = new List<sDeployedDomain>(); Lock(); foreach (sDeployedDomain dom in domains) { if ((dom.InternalProfile == profile.Name) || (dom.ExternalProfile == profile.Name)) ret.Add(dom); } UnLock(); return ret; }