public void MutliRangeNoMatchDialPlanTest()
        {
            Console.WriteLine("--> " + System.Reflection.MethodBase.GetCurrentMethod().Name);

            string testDialPlan = "exten => _3[2-57-9]X[1-3].,1,Switch(anon, password, [email protected])";

            var             dialPlanContext = GetDummyDialPlanContext(testDialPlan, "sip:[email protected]");
            DialPlanCommand commandMatch    = dialPlanContext.GetDialPlanMatch("3807");

            Assert.IsNull(commandMatch, "The dial plan should not have returned a match.");

            Console.WriteLine("---------------------------------");
        }
        public void SingleRangeNoMatchDialPlanTest()
        {
            Console.WriteLine("--> " + System.Reflection.MethodBase.GetCurrentMethod().Name);

            string testDialPlan = "exten => _3[2-57-9].,1,Switch(anon, password, [email protected])";

            SIPDialPlan         dialPlan        = new SIPDialPlan(null, null, null, testDialPlan, SIPDialPlanScriptTypesEnum.Asterisk);
            SIPRequest          request         = new SIPRequest(SIPMethodsEnum.INVITE, SIPURI.ParseSIPURI("sip:[email protected]"));
            DialPlanLineContext dialPlanContext = new DialPlanLineContext(null, null, null, null, null, dialPlan, null, null, null, null);
            DialPlanCommand     commandMatch    = dialPlanContext.GetDialPlanMatch(request.URI.User);

            Assert.IsNull(commandMatch, "The dial plan should not have returned a match.");

            Console.WriteLine("---------------------------------");
        }
        public void RegexWithNoCommaMatchDialPlanTest()
        {
            Console.WriteLine("--> " + System.Reflection.MethodBase.GetCurrentMethod().Name);

            string testDialPlan =
                @"exten =~ \d{3},1,Switch(anon,,${dst}@sip.blueface.ie, ""sip switch"" <sip:[email protected]>, 194.213.29.100)";

            SIPDialPlan         dialPlan        = new SIPDialPlan(null, null, null, testDialPlan, SIPDialPlanScriptTypesEnum.Asterisk);
            SIPRequest          request         = new SIPRequest(SIPMethodsEnum.INVITE, SIPURI.ParseSIPURI("sip:[email protected]"));
            DialPlanLineContext dialPlanContext = new DialPlanLineContext(null, null, null, null, null, dialPlan, null, null, null, null);
            DialPlanCommand     commandMatch    = dialPlanContext.GetDialPlanMatch(request.URI.User);

            Assert.IsNotNull(commandMatch, "The dial plan should have returned a match.");

            Console.WriteLine("---------------------------------");
        }
        public void ZMatchDialPlanTest()
        {
            Console.WriteLine("--> " + System.Reflection.MethodBase.GetCurrentMethod().Name);

            string testDialPlan = @"
					exten => _3000,1,Switch(anon, password, [email protected])
					exten => _3001,1,Switch(anon, password, [email protected])
					exten => _3Z00,1,Switch(anon, password, [email protected])
				"                ;

            var             dialPlanContext = GetDummyDialPlanContext(testDialPlan, "sip:[email protected]");
            DialPlanCommand commandMatch    = dialPlanContext.GetDialPlanMatch("3100");

            Assert.IsTrue(dialPlanContext.m_commands.Count == 3, "The dial plan was not correctly parsed.");
            Assert.IsTrue(commandMatch.Data == "anon, password, [email protected]", "The dial plan command match was not correct.");

            Console.WriteLine("---------------------------------");
        }
        public void NoMatchDialPlanTest()
        {
            Console.WriteLine("--> " + System.Reflection.MethodBase.GetCurrentMethod().Name);

            string testDialPlan = @"
					exten => _3100,1,Switch(anon, password, [email protected])
					exten => _3300,1,Switch(anon, password, [email protected])
					exten => _3000,1,Switch(anon, password, [email protected])
				"                ;

            var             dialPlanContext = GetDummyDialPlanContext(testDialPlan, "sip:[email protected]");
            DialPlanCommand commandMatch    = dialPlanContext.GetDialPlanMatch("3200");

            Assert.IsTrue(dialPlanContext.m_commands.Count == 3, "The dial plan was not correctly parsed.");
            Assert.IsNull(commandMatch, "The dial plan produced a match when it should not have.");

            Console.WriteLine("---------------------------------");
        }