Multiple filters per attribute

107 views
Skip to first unread message

poj...@gmail.com

unread,
Jul 22, 2021, 10:09:30 PM7/22/21
to CGRateS
Hi there,

I'm trying to match multiple filters under a single attribute in order to match 1 or more destination gateways (by destination domain extra field) to find the identify of a supplier.

# cgr-console 'attributes Tenant="cgrates" ID="ATTR_CARRIER_GOOGLE"'
{
 "Tenant": "cgrates",
 "ID": "ATTR_CARRIER_GOOGLE",
 "Contexts": [
  "*chargers"
 ],
 "FilterIDs": [
  "*string:~*req.DST_Domain:8.8.8.8",
  "*string:~*req.DST_Domain:8.8.4.4"
 ],
 "ActivationInterval": null,
 "Attributes": [
  {
   "FilterIDs": [],
   "Path": "*req.Subject",
   "Type": "*constant",
   "Value": [
    {
     "Rules": "Google",
     "AllFiltersMatch": true
    }
   ]
  },
  {
   "FilterIDs": [],
   "Path": "*req.Subject",
   "Type": "*constant",
   "Value": [
    {
     "Rules": "Google",
     "AllFiltersMatch": true
    }
   ]
  }
 ],
 "Blocker": false,
 "Weight": 10
}

It works fine with a single filter, but getting "NOT_FOUND" from ChargerS if >=2 rules.

I assume it has something to do with "AllFiltersMatch": true, but I can't find where this parameter is defined in AttributeS.

CGR...@v0.10.0

Much obliged,
--Sergiu

Ionut Boangiu

unread,
Jul 26, 2021, 9:16:11 AM7/26/21
to CGRateS
Hi Sergiu,

Your destination domain must be both 8.8.8.8 and 8.8.4.4 at the same time for your current attribute to match, which seems unlikely.  Instead, in cases like this when you want to have multiple values as options in your filter rule, you should separate the values inline using "|" like this:  "*string:~*req.DST_Domain:8.8.8.8|8.8.4.4".

Thanks,
Ionuț
Reply all
Reply to author
Forward
0 new messages