Hello,
Sorry for the late response!
You can choose between 2 solutions for this.
First solution:
You can define in your RatingProfiles profile all possible CLI location prefixes by putting them in the Category field, with their respective RatingPlan profiles attached to them.
RatingProfile example:
#Tenant,Category,Subject,ActivationTime,RatingPlanId,RatesFallbackSubject
cgrates.org,ORIG_EU,*any,2024-01-14T00:00:00Z,RP_Europe,
cgrates.org,ORIG_GERMANY,*any,2024-01-14T00:00:00Z,RP_Germany,
cgrates.org,ORIG_UK,*any,2024-01-14T00:00:00Z,RP_England,
...
And on Attributes profile, you can add the attributes with conditions to set the Category field's value to the prefix of the subject.
Attributes example:
cgrates.org,ATTR_EUROPE_PREFX,*sessions,*prefix:~*req.Subject:40;41;43,,,,,,false,10
cgrates.org,ATTR_EUROPE_PREFX,,,,,*req.Category,*constant,ORIG_EU,false,10
cgrates.org,ATTR_GERMANY_PREFX,*sessions,*prefix:~*req.Subject:49,,,,,,false,10
cgrates.org,ATTR_GERMANY_PREFX,,,,,*req.Category,*constant,ORIG_GERMANY,false,10
cgrates.org,ATTR_ENGLAND_PREFX,*sessions,*prefix:~*req.Subject:44,,,,,,false,10
cgrates.org,ATTR_ENGLAND_PREFX,,,,,*req.Category,*constant,ORIG_UK,false,10
...
By doing this, taking ORIG_EU as example, all sessions which have a subject that starts with 49, 49 or 41 prefix, will have their category in the event set to ORIG_EU, which will make them able to use the rating profile with rating plan of RP_Europe
Second solution:
You can enable "rp_subject_prefix_matching" from configs
https://github.com/cgrates/cgrates/blob/master/config/config_defaults.go#L334 and again in RatingProfile, put all possible CLI location prefixes in Subject field instead of Category which was previously. Doing this, CGRateS will do multiple queries to try and match the prefix when a single session comes narrowing the subject down to its prefix 1 number at a time.
Feel free to ask if you have further questions!
Kind regards,
Arber!