示例#1
0
        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();
        }
示例#2
0
        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));
        }
示例#3
0
 public void DeploySipProfile(sDeployedProfile profile)
 {
     lock (_cachedDialPlans)
     {
         if (_cachedDialPlans.ContainsKey(profile.Name))
         {
             _cachedDialPlans.Remove(profile.Name);
         }
     }
 }
示例#4
0
        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);
        }
示例#5
0
        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);
        }
示例#6
0
 internal SipProfileDeploymentEvent(sDeployedProfile profile)
 {
     _pars.Add("Profile", profile);
 }