SIPSorcery.AppServer.DialPlan.DialPlanSettings.GetENUMServers C# (CSharp) 메소드

GetENUMServers() 공개 메소드

Gets a list of any ENUM servers the user has specified in their dialplan options. The ENUM servers will be stored in the database as a CRLF separated list of strings.
public GetENUMServers ( ) : List
리턴 List
        public List<string> GetENUMServers()
        {
            if (Options != null && !Options.ENUMServers.IsNullOrBlank())
            {
                string[] enumServers = Regex.Split(Options.ENUMServers, @"\r\n", RegexOptions.Multiline);
                return enumServers.Where(x => !x.Trim().IsNullOrBlank()).Select(x => x.Trim()).ToList();
            }

            return null;
        }

Usage Example

        public void ExtractENUMServersTest()
        {
            SIPDialplanOption options = new SIPDialplanOption()
            {
                ENUMServers = "e164.org\r\n\r\ne164.info\r\n\r\ne164.arpa\r\n\r\ne164.televolution.net\r\n\r\nenum.org\r\n\r\n"
            };

            DialPlanSettings settings = new DialPlanSettings(null, null, null, options);

            List<string> enumServersList = settings.GetENUMServers();

            Assert.AreEqual(5, enumServersList.Count, "The number of ENUM servers extracted from the list was incorrect.");
            Assert.AreEqual("e164.org", enumServersList[0], "The ENUM server at index 0 was not extracted correctly.");
            Assert.AreEqual("enum.org", enumServersList[4], "The ENUM server at index 4 was not extracted correctly.");
        }