Combined Filters doesn't work

65 views
Skip to first unread message

Eugen Shevchenko

unread,
Mar 26, 2026, 8:24:13 AMMar 26
to CGRateS
Hi All,

I'm struggling with some Attributes and their implementation, any help is appreciated

I have a case where I need to apply two different attributes to the same cdr. 
Initial cdr is also creating second cdr with a Charger mechanism

cdr.csv
# ID,Account,Subject,Destination,SetupTime,AnswerTime,Usage,Tenant,Source,OriginHost
test_1001,SKP_16,GCXS,31805555249,2025-08-07T10:23:24Z,2025-08-07T10:23:26Z,60s,cgrates.org,31153692592,IPRO

Chargers.csv
# Tenant,ID,FilterIDs,ActivationInterval,RunID,AttributeIDs,Weight
cgrates.org,CRG_3849_FROM_SKP,FLTR_PREFIX_SKP;FLTR_SUBJECT_NOT_INTERCONNECT;FLTR_NUMBER,,OutgoingCalls,,1

Filters.csv
#Tenant,ID,Type,Element,Values,ActivationInterval
cgrates.org,FLTR_SUBJECT_NOT_INTERCONNECT,*notstring,~*req.Subject,JONA;JONA_15;SKP;SKP_16;SKP_21415;IPRO,2014-07-29T15:00:00Z
cgrates.org,FLTR_PREFIX_SKP,*prefix,~*req.Account,SKP,2014-07-29T15:00:00Z
cgrates.org,FLTR_NUMBER,*prefix,~*req.Destination,31805555249,2014-07-29T15:00:00Z
cgrates.org,FLTR_OUTGOING_CALL,*string,~*req.RunID,OutgoingCalls,2014-07-29T15:00:00Z

Attributes.csv
# Tenant,ID,Contexts,FilterIDs,ActivationInterval,AttributeFilterIDs,Path,Type,Value,Blocker,Weight
cgrates.org,ATTR_NUMBER,*sessions;*cdrs,FLTR_NUMBER,,,,,,false,10
cgrates.org,ATTR_NUMBER,,,,,*req.Subject,*constant,SNUM_31805555249,,
cgrates.org,ATTR_OUTGOING,*sessions;*cdrs,FLTR_OUTGOING_CALL,,,,,,false,11
cgrates.org,ATTR_OUTGOING,,,,,*req.Category,*constant,OutgoingCall,,
------------------

What is happening, I'm getting 2 cdrs (as expected), one with RunId == OutgoingCalls
But if I use both Attributes, only one ATTR_NUMBER is applied

While if I use each attribute separately - they both work. I have tried to experiment with weights, but nothing changed. Maybe there is some Attributes combination rules, I'm not aware about?

Config file is attached

Thanks for any suggestions in advance

cgrates.localhost.json

Armir Veliaj

unread,
Apr 3, 2026, 11:14:48 AMApr 3
to CGRateS
Hi Eugen,

CGRateS is flexible, and there are different ways to combine filters and attributes depending on each scenario.

Based on your provided configuration, if I’ve understood correctly, you want to apply the ATTR_NUMBER attribute to both charger profiles (when the destination matches), and ATTR_OUTGOING only to the charger profile with RunID OutgoingCalls.

You can combine both attributes into a single profile and add the *chargers context, as shown below:

# Tenant,ID,Contexts,FilterIDs,ActivationInterval,AttributeFilterIDs,Path,Type,Value,Blocker,Weight
cgrates.org,ATTR_COMBINED,*chargers;*cdrs;*sessions,,,,,,,false,10
cgrates.org,ATTR_COMBINED,,,,FLTR_NUMBER,*req.Subject,*constant,SNUM_31805555249,,
cgrates.org,ATTR_COMBINED,,,,FLTR_OUTGOING_CALL,*req.Category,*constant,OutgoingCall,,

Also, in Chargers.csv, update AttributeIDs as here:

#Tenant,ID,FilterIDs,ActivationInterval,RunID,AttributeIDs,Weight
cgrates.org,CRG_DEFAULT,,,*default,,0
cgrates.org,CRG_3849_FROM_SKP,FLTR_PREFIX_SKP;FLTR_SUBJECT_NOT_INTERCONNECT;FLTR_NUMBER,,OutgoingCalls,ATTR_COMBINED,1

Hope this helps.

Thanks,
Armir

Eugen Shevchenko

unread,
Apr 17, 2026, 6:04:45 AM (9 days ago) Apr 17
to CGRateS
Hi Armir,

This is exactly what I needed, I never knew you could use one attributes with two different filters in it. 

Thanks a lot!

Reply all
Reply to author
Forward
0 new messages