Billing based on CLI

119 views
Skip to first unread message

g Singh

unread,
Jun 20, 2024, 4:23:16 PM6/20/24
to CGRateS
Hello,

How to accomplish  Inbound and outbound billing of Destinations based on CLI in Cgrates.

A-number/CLI billing/pricing and as we understand is required for Terminating Calls in  Europe. All  outbound Calls to Destinations in Europe are charged on basis of Country//CLI  from which calls are originating ( CLI).

Similarly for Incoming Calls on Toll Free, Charges are different when Calls arrive from Fixed line and Different charges for calls from Mobiles.

Thanks

Arber Katellari

unread,
Jun 25, 2024, 10:08:13 AM6/25/24
to CGRateS
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!
Reply all
Reply to author
Forward
0 new messages