Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

Question about RatingProfile Subject/FallbackSubjects iteration

41 views
Skip to first unread message

Salvinder Parhar

unread,
Mar 31, 2025, 5:59:41 PMMar 31
to cgr...@googlegroups.com
Hello CGrateS team,

Can you please help me clarify this confusion about setting up RatingProfiles.

I'm setting up three RatingProfiles below;

1:cx06.cgrates-test.org:call-out:*any
1:cx06.
cgrates-test.org:call-out:tollfree
1:cx06.cgrates-test.org:call-out:international

{
    "id": RP_01,
    "method": "APIerSv1.SetTPRatingProfile",
    "params": [
        {
            "TPid": "TPid-01",
            "LoadId": "1",
            "Tenant": "cx06.cgrates-test.org",
            "Category": "call-out",
            "Subject": "*any",
            "RatingPlanActivations": [
                {
                    "ActivationTime": "{{$timestamp}}", //"2025-03-23T00:00:00Z",
                    "RatingPlanId": "RatingPlan_01",
                    "FallbackSubjects": "tollfree,international"
                }
            ]
        }
    ]
}

{
    "id": RP_02,
    "method": "APIerSv1.SetTPRatingProfile",
    "params": [
        {
            "TPid": "TPid-01",
            "LoadId": "1",
            "Tenant": "cx06.cgrates-test.org",
            "Category": "call-out",
            "Subject": "tollfree",
            "RatingPlanActivations": [
                {
                    "ActivationTime": "{{$timestamp}}", //"2025-03-23T00:00:00Z",
                    "RatingPlanId": "RatingPlan_02",
                    "FallbackSubjects": ""
                }
            ]
        }
    ]
}

{
    "id": RP_03,
    "method": "APIerSv1.SetTPRatingProfile",
    "params": [
        {
            "TPid": "TPid-01",
            "LoadId": "1",
            "Tenant": "cx06.cgrates-test.org",
            "Category": "call-out",
            "Subject": "international",
            "RatingPlanActivations": [
                {
                    "ActivationTime": "{{$timestamp}}", //"2025-03-23T00:00:00Z",
                    "RatingPlanId": "RatingPlan_03",
                    "FallbackSubjects": ""
                }
            ]
        }
    ]
}

In the first RatingProfile RP_01 with subject "*any" I'm using "tollfree,international" as the FallbackSubjects. So does this mean, after these RatingProfiles are loaded into DataDB, any new CDR event coming in with a random subject (let's say "123abc") will automatically match with RP_01 (Subject: *any), and if destination match not found there, will jump to RP_02 (Subject: tollfree) and then to RP_03 (Subject: international) until a destination match is found? OR will it always stop at RP_01 even if no match is found in RP_01, because its subject is a catchall "*any"?

Thanks,
Sal

Armir Veliaj

unread,
Apr 2, 2025, 9:15:17 AMApr 2
to CGRateS
Hi Sal,

Yes, if no match is made, it will check the FallbackSubjects you’ve configured, in the order you’ve set: first to "tollfree," then to "international."

For a better understanding, here’s an example from the RatingProfiles.csv:

RatingProfiles.csv
#Tenant,Category,Subject,ActivationTime,RatingPlanId,RatesFallbackSubject
cgrates.org,call,*any,,RP_MainSubj,RP_Special_Subj1
cgrates.org,call,RP_Special_Subj1,,RP_FBSubj1,`

*Using special naming for RatesFallbackSubject can make it more convenient, helping you clearly define and identify them.

Thanks,
Armir
Reply all
Reply to author
Forward
0 new messages