diff --git a/config/rsrparser.go b/config/rsrparser.go index 1e73e534f..70209a2cc 100644 --- a/config/rsrparser.go +++ b/config/rsrparser.go @@ -119,7 +119,7 @@ func NewRSRParser(parserRules string, allFiltersMatch bool) (rsrParser *RSRParse } rsrParser = &RSRParser{Rules: parserRules, AllFiltersMatch: allFiltersMatch} if strings.HasSuffix(parserRules, utils.FILTER_VAL_END) { // Has filter, populate the var - fltrStart := strings.LastIndex(parserRules, utils.FILTER_VAL_START) + fltrStart := strings.Index(parserRules, utils.FILTER_VAL_START) if fltrStart < 1 { return nil, fmt.Errorf("invalid RSRFilter start rule in string: <%s>", parserRules) } diff --git a/config/rsrparser_test.go b/config/rsrparser_test.go index dff8136dd..ae3a2eb3d 100644 --- a/config/rsrparser_test.go +++ b/config/rsrparser_test.go @@ -153,19 +153,15 @@ func TestRSRParsersParseEvent3(t *testing.T) { } } -/* -// Need to review RSRParser to accept () -func TestRSRParsersParseWrong(t *testing.T) { +// TestRSRParsersParseInnerBraces makes sure the inner braces are allowed in a filter rule +func TestRSRParsersParseInnerBracket(t *testing.T) { rule := "~*req.Service-Information.IN-Information.CalledPartyAddress(~^(00)*(33|0)890240004$)" prsr, err := NewRSRParser(rule, true) if err != nil { t.Error(err) } expAttrName := "*req.Service-Information.IN-Information.CalledPartyAddress" - // we expected to get *req.Service-Information.IN-Information.CalledPartyAddress as attrName - // and the rest go in filters if prsr.AttrName() != expAttrName { t.Errorf("expecting: %s, received: %s", expAttrName, prsr.AttrName()) } } -*/