private void DeployCurlFile(sFreeSwitchModuleFile file) { string confSection = file.ConfigurationSectionString; string ip = (string)Settings.Current[Constants.SERVER_IP_SETTING_NAME]; int port = (int)Settings.Current[Constants.SERVER_PORT_SETTING_NAME]; ip = (ip == null ? "127.0.0.1" : (ip == "0.0.0.0" ? "127.0.0.1" : ip)); confSection = confSection.Replace("<bindings>", "<bindings>" + String.Format(CONFIGURATION_BINDING_TEMPLATE, new object[]{ "configuration", ip, port, EmbeddedHandlerFactory.BASE_PATH+ConfigurationWebHandler.BASE_PATH+ConfigurationWebHandler.CONFIGURATION_PATH }) + String.Format(CONFIGURATION_BINDING_TEMPLATE, new object[]{ "directory", ip, port, EmbeddedHandlerFactory.BASE_PATH+ConfigurationWebHandler.BASE_PATH+ConfigurationWebHandler.DIRECTORY_PATH }) + String.Format(CONFIGURATION_BINDING_TEMPLATE, new object[]{ "dialplan", ip, port, EmbeddedHandlerFactory.BASE_PATH+ConfigurationWebHandler.BASE_PATH+ConfigurationWebHandler.DIALPLAN_PATH })); DirectoryInfo di = new DirectoryInfo(Settings.Current[Constants.BASE_PATH_NAME].ToString() + Path.DirectorySeparatorChar + Constants.DEFAULT_CONF_DIR + Path.DirectorySeparatorChar + Constants.DEFAULT_AUTOLOAD_CONF_DIR); if (!di.Exists) di.Create(); FileInfo fi = new FileInfo(di.FullName + Path.DirectorySeparatorChar + file.Name + ".xml"); StreamWriter sw = fi.CreateText(); sw.Write(confSection); sw.Flush(); sw.Close(); }
internal static sFreeSwitchModuleFile FixSofiaFile(sFreeSwitchModuleFile file) { string confSection = file.ConfigurationSectionString; if (confSection.Contains("<profiles>")){ string pre = confSection.Substring(0,confSection.IndexOf("<profiles>")); confSection = pre + confSection.Substring(confSection.IndexOf("</profiles>") + "</profiles>".Length); } Template st = new Template(Utility.ReadEmbeddedResource("Org.Reddragonit.FreeSwitchConfig.UserModules.XmlCurl.resources.sip_profile.st")); CoreGenerator.Lock(); st.SetAttribute("profiles",CoreGenerator.Profiles); confSection = confSection.Replace("</configuration>",st.ToString()+"</configuration>"); CoreGenerator.UnLock(); return new sFreeSwitchModuleFile(file.Name,file.Description,confSection); }
private void DeployModulesFile(sFreeSwitchModuleFile file) { string confSection = file.ConfigurationSectionString; confSection = confSection.Replace("<load module=\"mod_xml_curl\"/>", ""); confSection = confSection.Replace("<modules>", "<modules><load module=\"mod_xml_curl\"/>"); DirectoryInfo di = new DirectoryInfo(Settings.Current[Constants.BASE_PATH_NAME].ToString() + Path.DirectorySeparatorChar + Constants.DEFAULT_CONF_DIR + Path.DirectorySeparatorChar + Constants.DEFAULT_AUTOLOAD_CONF_DIR); if (!di.Exists) di.Create(); FileInfo fi = new FileInfo(di.FullName + Path.DirectorySeparatorChar + file.Name + ".xml"); StreamWriter sw = fi.CreateText(); sw.Write(confSection); sw.Flush(); sw.Close(); }
public void DeployModuleFile(string fileName, sFreeSwitchModuleFile file) { CoreGenerator.Lock(); if (fileName == "modules.conf.xml") DeployModulesFile(file); else if (fileName == "xml_curl.conf.xml") DeployCurlFile(file); CoreGenerator.UnLock(); }
public void DeployModuleFile(string fileName, sFreeSwitchModuleFile file) { DirectoryInfo di = new DirectoryInfo(Settings.Current[Constants.BASE_PATH_NAME].ToString() + Path.DirectorySeparatorChar + Constants.DEFAULT_CONF_DIR + Path.DirectorySeparatorChar + Constants.DEFAULT_AUTOLOAD_CONF_DIR); FileInfo fi = new FileInfo(di.FullName + Path.DirectorySeparatorChar + fileName); if (fi.Exists) fi.Delete(); if (file != null) { StreamWriter sw = new StreamWriter(fi.OpenWrite()); sw.Write(file.ConfigurationSectionString); sw.Flush(); sw.Close(); } }
public void LoadFromElement(XmlElement element) { _fileName = element.Attributes["filename"].Value; _file = new sFreeSwitchModuleFile((XmlElement)element.ChildNodes[0]); }
public sDeployedModule(string fileName, sFreeSwitchModuleFile file) { _fileName = fileName; _file = file; }