4.2. Tariff Plans¶
Major concept within CGRateS architecture, implement mechanisms to load rating as well as account data into CGRateS. For importing the data into CGRateS database(s) we are using csv files. The import process can be started as many times it is desired with one ore more csv files and the existing values are overwritten.
Important
If -flushdb option is used when importing data with cgr-loader, then the database is cleaned before importing.
For more details see the cgr-loader tool from the tutorial chapter.
The rest of this section we will describe the content of every csv file.
4.2.1. Destinations¶
The destinations are binding together various prefixes / caller ids to define a logical destination group. A prefix can appear in multiple destination groups.
"Destinations.csv" - csv
"tp_destinations" - stor_db
#Id | Prefix |
---|---|
DST_1002 | 1002 |
DST_1003 | 1003 |
DST_1007 | 1007 |
DST_FS | 10 |
DST_DE_MOBILE | +49151 |
DST_DE_MOBILE | +49161 |
DST_DE_MOBILE | +49171 |
- [0] - Id:
- Destination Id, a string by which this destination will be referenced in other places by.
- [1] - Prefix:
- Prefix(es) attached to this destination. The prefix or caller id to be added to the specified destination.
4.2.2. Timings¶
Holds time related definitions. Describes the time periods that have different rates attached to them.
"Timings.csv" - csv
"tp_timings" - stor_db
#Tag | Years | Months | MonthDays | WeekDays | Time |
---|---|---|---|---|---|
PEAK | *any | *any | *any | 1;2;3;4;5 | 08:00:00 |
OFFPEAK_MORNING | *any | *any | *any | 1;2;3;4;5 | 00:00:00 |
OFFPEAK_EVENING | *any | *any | *any | 1;2;3;4;5 | 19:00:00 |
OFFPEAK_WEEKEND | *any | *any | *any | 6;7 | 00:00:00 |
- [0] - Tag:
- String by which this timing will be referenced in other places by.
- [1] - Years:
Integers separated by semicolons (;) specifying the years for this time period.
*any in case of always.
- [2] - Months:
Integers from 1=January to 12=December separated by semicolons (;) specifying the months for this time period.
*any in case of always (equivalent to 1;2;3;4;5;6;7;8;9;10;11;12).
- [3] - MonthDays:
Integers from 1 to 31 separated by semicolons (;) specifying the month days for this time period.
*any in case of always.
- [4] - WeekDays:
Integers from 1=Monday to 7=Sunday separated by semicolons (;) specifying the week days for this time period.
*any in case of always.
- [5] - Time:
The start time for this time period.
If you set it to *asap (was *now) it will be replaced with the time of the data importing.
4.2.3. Rates¶
Defines price groups for various destinations which will be associated to various timings.
"Rates.csv" - csv
"tp_rates" - stor_db
#Id | ConnectFee | Rate | RateUnit | RateIncrement | GroupIntervalStart |
---|---|---|---|---|---|
RT_10CNT | 0.2 | 0.1 | 60s | 60s | 0s |
RT_10CNT | 0 | 0.05 | 60s | 1s | 60s |
RT_20CNT | 0.4 | 0.2 | 60s | 60s | 0s |
RT_20CNT | 0 | 0.1 | 60s | 1s | 60s |
RT_40CNT | 0.8 | 0.4 | 60s | 30s | 0s |
RT_40CNT | 0 | 0.2 | 60s | 10s | 60s |
RT_1CNT | 0 | 0.01 | 60s | 60s | 0s |
RT_1CNT_PER_SEC | 0 | 0.01 | 1s | 1s | 0s |
RT_GENERIC_1 | 0 | 1 | 1 | 1 | 0 |
- [0] - Id:
- Rate Id, a string by which this rate will be referenced in other places by.
- [1] - ConnectFee:
- ConnectFee applied once the call is answered. The price to be charged once at the beginning of the call to the specified destination.
- [2] - Rate:
- Number of billing units this rate applies to. The price for the billing unit expressed in cents.
- [3] - RateUnit:
- The billing unit expressed in seconds.
- [4] - RateIncrement:
- This rate will apply in increments of duration. The time gap for the rate
- [5] - GroupIntervalStart:
- When the rate starts
See also
Rateincrement and GroupIntervalStart are when the calls has different rates in the timeframe. For example, the first 30 seconds of the calls has a rate of €0.1 and after that €0.2. The rate for this will the same TAG with two RateIncrements
4.2.4. Destination Rates¶
Attach rates to destinations.
"DestinationRates.csv" - csv
"tp_destination_rates" - stor_db
#Id | DestinationId | RatesTag | RoundingMethod | RoundingDecimals | MaxCost | MaxCostStrategy |
---|---|---|---|---|---|---|
DR_1002_20CNT | DST_1002 | RT_20CNT | *up | 4 | 0 | |
DR_1002_10CNT | DST_1002 | RT_10CNT | *up | 4 | 0 | |
DR_1003_20CNT | DST_1003 | RT_40CNT | *up | 4 | 0 | |
DR_1003_10CNT | DST_1003 | RT_10CNT | *up | 4 | 0 | |
DR_FS_40CNT | DST_FS | RT_40CNT | *up | 4 | 0 | |
DR_FS_10CNT | DST_FS | RT_10CNT | *up | 4 | 0 | |
DR_SPECIAL_1002 | DST_1002 | RT_1CNT | *up | 4 | 0 | |
DR_1007_MAXCOST_DISC | DST_1007 | RT_1CNT_PER_SEC | *up | 4 | 0.62 | *disconnect |
DR_1007_MAXCOST_FREE | DST_1007 | RT_1CNT_PER_SEC | *up | 4 | 0.62 | *free |
DR_GENERIC | *any | RT_GENERIC_1 | *up | 4 | 0 |
- [0] - Id:
- tbd
- [1] - DestinationId:
- tbd
- [2] - RatesTag:
- tbd
- [3] - RoundingMethod:
- tbd
- [4] - RoundingDecimals:
- tbd
- [5] - MaxCost:
- tbd
- [6] - MaxCostStrategy:
- tbd
4.2.5. Rating Plans¶
The rating plan makes the links between Rating Profiles, Timings and Destination Rates so each of them can be described once and various combinations are made possible.
"RatingPlans.csv" - csv
"tp_rating_plans" - stor_db
#Id | DestinationRatesId | TimingTag | Weight |
---|---|---|---|
RP_RETAIL1 | DR_FS_40CNT | PEAK | 10 |
RP_RETAIL1 | DR_FS_10CNT | OFFPEAK_MORNING | 10 |
RP_RETAIL1 | DR_FS_10CNT | OFFPEAK_EVENING | 10 |
RP_RETAIL1 | DR_FS_10CNT | OFFPEAK_WEEKEND | 10 |
RP_RETAIL1 | DR_1007_MAXCOST_DISC | *any | 10 |
RP_RETAIL2 | DR_1002_20CNT | PEAK | 10 |
RP_RETAIL2 | DR_1003_20CNT | PEAK | 10 |
RP_RETAIL2 | DR_FS_40CNT | PEAK | 10 |
RP_RETAIL2 | DR_1002_10CNT | OFFPEAK_MORNING | 10 |
RP_RETAIL2 | DR_1002_10CNT | OFFPEAK_EVENING | 10 |
RP_RETAIL2 | DR_1002_10CNT | OFFPEAK_WEEKEND | 10 |
RP_RETAIL2 | DR_1003_10CNT | OFFPEAK_MORNING | 10 |
RP_RETAIL2 | DR_1003_10CNT | OFFPEAK_EVENING | 10 |
RP_RETAIL2 | DR_1003_10CNT | OFFPEAK_WEEKEND | 10 |
RP_RETAIL2 | DR_FS_10CNT | OFFPEAK_MORNING | 10 |
RP_RETAIL2 | DR_FS_10CNT | OFFPEAK_EVENING | 10 |
RP_RETAIL2 | DR_FS_10CNT | OFFPEAK_WEEKEND | 10 |
RP_RETAIL2 | DR_1007_MAXCOST_FREE | *any | 10 |
RP_SPECIAL_1002 | DR_SPECIAL_1002 | *any | 10 |
RP_GENERIC | DR_GENERIC | *any | 10 |
- [0] - Id:
- A string by which this rating plan will be referenced in other places by.
- [1] - DestinationRatesId:
- The rating id/tag described in the Destination rates file. (DestinationRates.csv - Id)
- [2] - TimingTag:
- The timing tag described in the Timings file. (Timings.csv - Tag)
- [3] - Weight:
- If multiple timings cab be applied to a call the one with the lower weight wins. An example here can be the Christmas day: we can have a special timing for this day but the regular day of the week timing can also be applied to this day. The weight will differentiate between the two timings.
4.2.6. Rating profiles¶
The rating profile describes the prices to be applied for various calls to various destinations in various time frames. When a call is made the CGRateS system will locate the rates to be applied to the call using the rating profiles.
"RatingProfiles.csv" - csv
"tp_rating_profiles" - stor_db
#Direction | Tenant | Category | Subject | ActivationTime | RatingPlanId | RatesFallbackSubject | CdrStatQueueIds |
---|---|---|---|---|---|---|---|
*out | cgrates.org | call | *any | 2014-01-14T00:00:00Z | RP_RETAIL1 | ||
*out | cgrates.org | call | 1001 | 2014-01-14T00:00:00Z | RP_RETAIL2 | ||
*out | cgrates.org | call | SPECIAL_1002 | 2014-01-14T00:00:00Z | RP_SPECIAL_1002 | ||
*out | cgrates.org | lcr_profile1 | suppl1 | 2014-01-14T00:00:00Z | RP_RETAIL1 | STATS_SUPPL1 | |
*out | cgrates.org | lcr_profile1 | suppl2 | 2014-01-14T00:00:00Z | RP_RETAIL2 | STATS_SUPPL2 | |
*out | cgrates.org | lcr_profile2 | suppl1 | 2014-01-14T00:00:00Z | RP_RETAIL2 | STATS_SUPPL1 | |
*out | cgrates.org | lcr_profile2 | suppl2 | 2014-01-14T00:00:00Z | RP_RETAIL1 | STATS_SUPPL2 | |
*out | cgrates.org | lcr_profile2 | suppl3 | 2014-01-14T00:00:00Z | RP_SPECIAL_1002 | ||
*out | cgrates.org | generic | *any | 2014-01-14T00:00:00Z | RP_GENERIC |
- [0] - Direction:
- Can be *in or *out for the INBOUND and OUTBOUND calls.
- [1] - Tenant:
- Used to distinguish between carriers if more than one share the same database in the CGRates system.
- [2] - Category:
- Type of record specifies the kind of transmission this rate profile applies to.
- [3] - Subject:
- The client/user for who this profile is detailing the rates.
- [4] - ActivationTime:
- Multiple rates timings/prices can be created for one profile with different activation times. When a call is made the appropriate profile(s) will be used to rate the call. So future prices can be defined here and the activation time can be set as appropriate.
- [5] - RatingPlanId:
The rating plan id/tag described in the Rating Plans file. (RatingPlans.csv - Id)
This specifies the profile to be used in case the call destination.
- [6] - RatesFallbackSubject:
- This specifies another profile to be used in case the call destination will not be found in the current profile. The same tenant, tor and direction will be used.
- [7] - CdrStatQueueIds:
The cdr stats id described in the Cdr Stats file. (CdrStats.csv - Id)
Stat Queue associated with this account.
4.2.7. Account actions¶
Describes the actions to be applied to the clients/users accounts. There are two kinds of actions: timed and triggered. For the timed actions there is a scheduler application that reads them from the database and executes them at the appropriate timings. The triggered actions are executed when the specified balance counters reach certain thresholds.
The accounts hold the various balances and counters to activate the triggered actions for each the client.
Balance types are: MONETARY, SMS, INTERNET, INTERNET_TIME, MINUTES.
"AccountActions.csv" - csv
"tp_account_actions" - stor_db
#Tenant | Account | ActionPlanId | ActionTriggersId | AllowNegative | Disabled |
---|---|---|---|---|---|
cgrates.org | 1001 | PACKAGE_1001 | STANDARD_TRIGGERS | ||
cgrates.org | 1002 | PACKAGE_10 | STANDARD_TRIGGERS | ||
cgrates.org | 1003 | PACKAGE_10 | STANDARD_TRIGGERS | ||
cgrates.org | 1004 | PACKAGE_10 | STANDARD_TRIGGERS | ||
cgrates.org | 1007 | USE_SHARED_A | STANDARD_TRIGGERS |
- [0] - Tenant:
- Used to distinguish between carriers if more than one share the same database in the CGRates system.
- [1] - Account:
- The identifier for the user’s account.
- [2] - Direction:
- Can be *in or *out for the INBOUND and OUTBOUND calls.
- [3] - ActionPlanId:
The action plan id/tag described in the Action plans file. (ActionPlans.csv - Id)
Forwards to a timed action group that will be used on this account.
- [4] - ActionTriggersId:
The action trigger id/tag described in the Action triggers file. (ActionTriggers.csv - Tag)
Forwards to a triggered action group that will be applied to this account.
- [5] - AllowNegative:
- TBD
- [6] - Disabled:
- TBD
4.2.8 Action triggers¶
For each account there are counters that record the activity on various balances. Action triggers allow when a counter reaches a threshold to activate a group of actions. After the execution the action trigger is marked as used and will no longer be evaluated until the triggers are reset. See actions for action trigger resetting.
"ActionTriggers.csv" - csv
"tp_action_triggers" - stor_db
#Tag[0] | UniqueId[1] | ThresholdType[2] | ThresholdValue[3] | Recurrent[4] | MinSleep[5] | ExpiryTime[6] | ActivationTime[7] | BalanceTag[8] | BalanceType[9] | BalanceDirections[10] | BalanceCategories[11] | BalanceDestinationIds[12] | BalanceRatingSubject[13] | BalanceSharedGroup[14] | BalanceExpiryTime[15] | BalanceTimingIds[16] | BalanceWeight[17] | BalanceBlocker[18] | BalanceDisabled[19] | StatsMinQueuedItems[20] | ActionsId[21] | Weight[22] |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
STANDARD_TRIGGERS | *min_balance | 2 | false | 0 | *monetary | *out | LOG_WARNING | 10 | ||||||||||||||
STANDARD_TRIGGERS | *max_event_counter | 5 | false | 0 | *monetary | *out | FS_USERS | LOG_WARNING | 10 | |||||||||||||
STANDARD_TRIGGERS | *max_balance | 20 | false | 0 | *monetary | *out | LOG_WARNING | 10 | ||||||||||||||
STANDARD_TRIGGERS | *max_balance | 100 | false | 0 | *monetary | *out | DISABLE_AND_LOG | 10 | ||||||||||||||
CDRST1_WARN | *min_asr | 45 | true | 1m | 3 | LOG_WARNING | 10 | |||||||||||||||
CDRST1_WARN | *min_acd | 10 | true | 1m | 5 | LOG_WARNING | 10 | |||||||||||||||
CDRST1_WARN | *max_acc | 10 | true | 1m | 5 | LOG_WARNING | 10 | |||||||||||||||
CDRST1001_WARN | *min_asr | 65 | true | 1m | 3 | LOG_WARNING | 10 | |||||||||||||||
CDRST1001_WARN | *min_acd | 10 | true | 1m | 5 | LOG_WARNING | 10 | |||||||||||||||
CDRST1001_WARN | *max_acc | 5 | true | 1m | 5 | LOG_WARNING | 10 | |||||||||||||||
CDRST3_WARN | *min_acd | 60 | false | 1m | 5 | LOG_WARNING | 10 |
- [0] - Tag:
- A string by which this action trigger will be referenced in other places by.
- [1] - UniqueID:
- Unique id for the trigger in multiple ActionTriggers
- [2] - ThresholdType:
The threshold type. Can have one of the following:
- *min_counter: Fire when counter is less than ThresholdValue
- *max_counter: Fire when counter is greater than ThresholdValue
- *min_balance: Fire when balance is less than ThresholdValue
- *max_balance: Fire when balances is greater than ThresholdValue
- *min_asr: Fire when ASR(Average success Ratio) is less than ThresholdValue
- *max_asr: Fire when ASR is greater than ThresholdValue
- *min_acd: Fire when ACD(Average call Duration) is less than ThresholdValue
- *max_acd: Fire when ACD is greater than ThresholdValue
- *min_acc: Fire when ACC(Average call cost) is less than ThresholdValue
- *max_acc: Fire when ACC is greater than ThresholdValue
- *min_tcc: Fire when TCC(Total call cost) is less than ThresholdValue
- *max_tcc: Fire when TCC is greater than ThresholdValue
- *min_tcd: fire when TCD(total call duration) is less than thresholdvalue
- *max_tcd: fire when TCD is greater than thresholdvalue
- *min_pdd: Fire when PDD(Post Dial Delay) is less than ThresholdValue
- *max_pdd: Fire when PDD is greater than ThresholdValue
- [3] - ThresholdValue:
- The value of the balance counter that will trigger this action.
- [4] - Recurrent(Boolean):
- In case of trigger we can fire recurrent while it’s active, or only the first time.
- [5] - MinSleep:
- When Threshold is triggered we can sleep for the time specified.
- [6] - ExpiryTime
- TBD
- [7] - ActivationTime
- TBD
- [8] - BalanceTag:
Specifies the balance counter by which this action will be triggered. Can be:
- MONETARY
- SMS
- INTERNET
- INTERNET_TIME
- MINUTES
- [9] - BalanceType:
Specifies the balance type for this action:
- *voice: units of call minutes
- *sms: units of SMS
- *data: units of data
- *monetary: units of money
- [10] - BalanceDirections:
- Can be *in or *out for the INBOUND and OUTBOUND calls.
- [11] - BalanceCategories:
- Category of the call/trigger
- [12] - BalanceDestinationIds:
The destination id/tag described in the Destinations file. (Destinations.csv - Id) - rinor: need verification
Destination of the call/trigger
- [13] - BalanceRatingSubject:
- TBD
- [14] - BalanceSharedGroup:
- Shared Group of the call/trigger
- [15] - BalanceExpiryTime:
- TBD
- [16] - BalanceTimingIds:
- TBD
- [17] - BalanceWeight:
- TBD
- [18] - BalanceBlocker
- TBD
- [19] - BalanceDisabled:
- TBD
- [20] - StatsMinQueuedItems:
- Min of items that need to have a queue to reach this Trigger. Trigger actions only if this number is hit (stats only).
- [21] - ActionsId:
The actions id/tag described in the Actions file. (Actions.csv - ActionsId)
Forwards to an action group to be executed when the threshold is reached.
- [22] - Weight:
- Specifies the order for these triggers to be evaluated. If there are multiple triggers are fired in the same time the ones with the lower weight will be executed first.
4.2.9. Action Plans¶
TBD
"ActionPlans.csv" - csv
"tp_account_plans" - stor_db
#Id | ActionsId | TimingId | Weight |
---|---|---|---|
PACKAGE_10 | TOPUP_RST_10 | *asap | 10 |
PACKAGE_10_SHARED_A_5 | TOPUP_RST_5 | *asap | 10 |
PACKAGE_10_SHARED_A_5 | TOPUP_RST_SHARED_5 | *asap | 10 |
USE_SHARED_A | SHARED_A_0 | *asap | 10 |
PACKAGE_1001 | TOPUP_RST_5 | *asap | 10 |
PACKAGE_1001 | TOPUP_RST_SHARED_5 | *asap | 10 |
PACKAGE_1001 | TOPUP_120_DST1003 | *asap | 10 |
PACKAGE_1001 | TOPUP_RST_DATA_100 | *asap | 10 |
- [0] - Id:
- A string by which this action timing will be referenced in other places by.
- [1] - ActionsId:
- Forwards to an action group to be executed when the timing is right.
- [2] - TimingId:
- A timing (one time or recurrent) at which the action group will be executed
- [3] - Weight:
- Specifies the order for these timings to be evaluated. If there are multiple action timings set to be execute on the same time the ones with the lower weight will be executed first.
4.2.10. Actions¶
TBD
"Actions.csv" - csv
"tp_actions" - stor_db
#ActionsId[0] | Action[1] | ExtraParameters[2] | Filter[3] | BalanceId[4] | BalanceType[5] | Directions[6] | Categories[7] | DestinationIds[8] | RatingSubject[9] | SharedGroup[10] | ExpiryTime[11] | TimingIds[12] | Units[13] | BalanceWeight[14] | BalanceBlocker[15] | BalanceDisabled[16] | Weight[17] |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
TOPUP_RST_10 | *topup_reset | *monetary | *out | *any | *unlimited | 10 | 10 | false | false | 10 | |||||||
TOPUP_RST_5 | *topup_reset | *monetary | *out | *any | *unlimited | 5 | 20 | false | false | 10 | |||||||
TOPUP_RST_5 | *topup_reset | *voice | *out | DST_1002 | SPECIAL_1002 | *unlimited | 90 | 20 | false | false | 10 | ||||||
TOPUP_120_DST1003 | *topup_reset | *voice | *out | DST_1003 | *unlimited | 120 | 20 | false | false | 10 | |||||||
TOPUP_RST_SHARED_5 | *topup | *monetary | *out | *any | SHARED_A | *unlimited | 5 | 10 | false | false | 10 | ||||||
SHARED_A_0 | *topup_reset | *monetary | *out | *any | SHARED_A | *unlimited | 0 | 10 | false | false | 10 | ||||||
TOPUP_RST_DATA_100 | *topup_reset | *data | *out | *any | *unlimited | 102400 | 10 | false | false | 10 | |||||||
LOG_WARNING | *log | false | false | 10 | |||||||||||||
DISABLE_AND_LOG | *log | false | false | 10 | |||||||||||||
DISABLE_AND_LOG | *disable_account | false | false | 10 |
- [0] - ActionsId:
- A string by which this action will be referenced in other places by.
- [1] - Action:
The action type. Can have one of the following:
- *allow_negative: Allow to the account to have negative balance
- *call_url: Send a http request to the following url
- *call_url_async: Send a http request to the following url Asynchronous
- *cdrlog: Log the current action in the storeDB
- *debit: Debit account balance.
- *deny_negative: Deny to the account to have negative balance
- *disable_account: Disable account in the platform
- *enable_account: Enable account in the platform
- *log: Logs the other action values (for debugging purposes).
- *mail_async: Send a email to the direction
- *reset_account: Sets all counters to 0
- *reset_counter: Sets the counter for the BalanceTag to 0
- *reset_counters: Sets all the counters for the BalanceTag to 0
- *reset_triggers: reset all the triggers for this account
- *set_recurrent: (pending)
- *topup: Add account balance. If the specific balance is not defined, define it (example: minutes per destination).
- *topup_reset: Add account balance. If previous balance found of the same type, reset it before adding.
- *unset_recurrent: (pending)
- *unlimited: (pending)
- [2] - ExtraParameters:
- In Extra Parameter field you can define an argument for the action. In case of call_url Action, extraParameter will be the url action. In case of mail_async the email that you want to receive.
- [3] - Filter
- TBD
- [4] - BalanceId:
- The balance on which the action will operate
- [5] - BalanceType:
Specifies the balance type for this action:
- *voice: units of call minutes
- *sms: units of SMS
- *data: units of data
- *monetary: units of money
- [6] - Directions:
- Can be *in or *out for the INBOUND and OUTBOUND calls.
- [7] - Categories:
- TBD
- [8] - DestinationIds:
The destination id/tag described in the Destinations file. (Destinations.csv - Id)
This field is used only if the BalanceId is MINUTES. Specifies the destination of the minutes to be operated.
- [9] - RatingSubject:
- The ratingSubject of the Actions
- [10] - SharedGroup:
- In case of the account uses any shared group for the balances.
- [11] - ExpiryTime:
- TBD
- [12] - TimingIds:
- Timming tag when the action can be executed. Default ALL.
- [13] - Units:
- Number of units for decrease the balance. Only use if BalanceType is voice.
- [14] - BalanceWeight:
- TBD
- [15] - BalanceBlocker
- TBD
- [16] - BalanceDisabled:
- TBD
- [17] - Weight:
- If there are multiple actions in a group, they will be executed in the order of their weight (smaller first).
4.2.11. Derived Chargers¶
For each call we can bill more than one time, for that we need to use the following options:
"DerivedChargers.csv" - csv
"tp_derived_chargers" - stor_db
#Direction[0] | Tenant[1] | Category[2] | Account[3] | Subject[4] | DestinationIds[5] | RunId[6] | RunFilter[7] | ReqTypeField[8] | DirectionField[9] | TenantField[10] | CategoryField[11] | AccountField[12] | SubjectField[13] | DestinationField[14] | SetupTimeField[15] | PddField[16] | AnswerTimeField[17] | UsageField[18] | SupplierField[19] | DisconnectCause[20] | RatedField[21] | CostField[22] |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
*out | cgrates.org | call | 1001 | 1001 | derived_run1 | ^*rated | *default | *default | *default | *default | ^1002 | *default | *default | *default | *default | *default | *default | *default | *default | *default |
In derived charges we have 2 different kind of options, FILTERS and ACTIONS :
Filters: With the following fields we filter the calls that need to run a extra billing parameter.
- [0] - Direction:
- TBD
- [1] - Tenant:
- TBD
- [2] - Category:
- TBD
- [3] - Account:
- TBD
- [4] - Subject:
- TBD
- [5] - DestinationIds:
- TBD
Actions: In case of the filter options match, platform creates extra runid with the fields that we want to modify.
- [6] - RunId:
- TBD
- [7] - RunFilter:
- TBD
- [8] - ReqTypeField:
- TBD
- [9] - DirectionField:
- TBD
- [10] - TenantField:
- TBD
- [11] - CategoryField:
- TBD
- [12] - AccountField:
- TBD
- [13] - SubjectField:
- TBD
- [14] - DestinationField:
- TBD
- [15] - SetupTimeField:
- TBD
- [16] - PddField:
- TBD
- [17] - AnswerTimeField:
- TBD
- [18] - UsageField:
- TBD
- [19] - SupplierField:
- TBD
- [20] - DisconnectCause:
- TBD
- [21] - RatedField:
- TBD
- [22] - CostField:
- TBD
In the example, all the calls with direction=out, tenant=cgrates.org, category=”call” and account and subject equal 1001. Will be created a new cdr in the table rated_cdrs with the runID derived_run1, and the subject 1002.
This feature it’s useful in the case that you want to rated the calls 2 times, for example rated for different tenants or resellers.
4.2.12. CDR Stats¶
CDR Stats enables some realtime statistics in your platform for multiple purposes, you can read more, see CDR Stats Server
"CdrStats.csv" - csv
"tp_cdr_stats" - stor_db
#Id[0] | QueueLength[1] | TimeWindow[2] | SaveInerval[3] | Metric[4] | SetupInterval[5] | TOR[6] | CdrHost[7] | CdrSource[8] | ReqType[9] | Direction[10] | Tenant[11] | Category[12] | Account[13] | Subject[14] | DestinationIds[15] | PddInterval[16] | UsageInterval[17] | Supplier[18] | DisconnectCause[19] | RunIds[20] | RatedAccount[21] | RatedSubject[22] | CostInterval[23] | Triggers[24] |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
CDRST1 | 10 | 0 | 10s | ASR | cgrates.org | *default | CDRST1_WARN | |||||||||||||||||
CDRST1 | ACD | |||||||||||||||||||||||
CDRST1 | ACC | |||||||||||||||||||||||
CDRST1 | TCD | |||||||||||||||||||||||
CDRST1 | TCC | |||||||||||||||||||||||
CDRST_1001 | 10 | 10m | 10s | ASR | cgrates.org | 1001 | *default | CDRST1001_WARN | ||||||||||||||||
CDRST_1001 | ACD | |||||||||||||||||||||||
CDRST_1001 | ACC | |||||||||||||||||||||||
CDRST_1002 | 10 | 10m | 10s | ASR | cgrates.org | 1002 | *default | CDRST1001_WARN | ||||||||||||||||
CDRST_1002 | ACD | |||||||||||||||||||||||
CDRST_1002 | ACC | |||||||||||||||||||||||
CDRST_1003 | ASR | cgrates.org | 1003 | *default | CDRST3_WARN | |||||||||||||||||||
CDRST_1003 | ACD | |||||||||||||||||||||||
STATS_SUPPL1 | ACD | suppl1 | ||||||||||||||||||||||
STATS_SUPPL1 | ASR | suppl1 | ||||||||||||||||||||||
STATS_SUPPL1 | ACC | suppl1 | ||||||||||||||||||||||
STATS_SUPPL1 | TCD | suppl1 | ||||||||||||||||||||||
STATS_SUPPL1 | TCC | suppl1 | ||||||||||||||||||||||
STATS_SUPPL2 | ACD | suppl2 | ||||||||||||||||||||||
STATS_SUPPL2 | ASR | suppl2 | ||||||||||||||||||||||
STATS_SUPPL2 | ACC | suppl2 | ||||||||||||||||||||||
STATS_SUPPL2 | TCD | suppl2 | ||||||||||||||||||||||
STATS_SUPPL2 | TCC | suppl2 |
- [0] - Id:
- Tag name for the Queue id
- [1] - QueueLength:
- Maximum number of calls in this queue
- [2] - TimeWindow:
- Window frame to store the calls
- [3] - SaveInterval:
- Each interval queue stats will save in the stordb
- [4] - Metric:
- Type of metric see Metrics Types
- [5] - SetupInterval:
- TBD
- [6] - TOR:
- TBD
- [7] - CdrHost
- TBD
- [8] - CdrSource:
- TBD
- [9] - ReqType:
- Filter by reqtype
- [10] - Direction:
- TBD
- [11] - Tenant:
- Used to distinguish between carriers if more than one share the same database in the CGRates system.
- [12] - Category:
- Type of record specifies the kind of transmission this rate profile applies to.
- [13] - Account:
- The identifier for the user’s account.
- [14] - Subject:
- The client/user for who this profile is detailing the rates.
- [15] - DestinationIds:
- Filter only by destinations prefix. Can be multiple separated with ;
- [16] - PddInterval:
- TBD
- [17] - UsageInterval:
- TBD
- [18] - Supplier:
- TBD
- [19] - DisconnectCause:
- TBD
- [20] - RunIds:
- TBD
- [21] - RatedAccount:
- Filter by rated account
- [22] - RatedSubject:
- Filter by rated subject
- [23] - CostInterval:
- Filter by cost
- [24] - ActionTriggers:
- ActionTriggers associated with this queue
4.2.14. LCR rules¶
TBD
"LcrRules.csv" - csv
"tp_lcr_rules" - stor_db
#Direction | Tenant | Category | Account | Subject | DestinationId | RPCategory | Strategy | StrategyParams | ActivationTime | Weight |
---|---|---|---|---|---|---|---|---|---|---|
*out | cgrates.org | call | 1001 | *any | DST_1002 | lcr_profile1 | *static | suppl2;suppl1 | 2014-01-14T00:00:00Z | 10 |
*out | cgrates.org | call | 1001 | *any | *any | lcr_profile1 | *static | suppl1;suppl2 | 2014-01-14T00:00:00Z | 10 |
*out | cgrates.org | call | 1002 | *any | DST_1002 | lcr_profile1 | *highest_cost | 2014-01-14T00:00:00Z | 10 | |
*out | cgrates.org | call | 1002 | *any | *any | lcr_profile1 | *qos | 2014-01-14T00:00:00Z | 10 | |
*out | cgrates.org | call | 1003 | *any | DST_1002 | lcr_profile1 | *qos_threshold | 20;;;;2m;;;;;;; | 2014-01-14T00:00:00Z | 10 |
*out | cgrates.org | call | 1003 | *any | *any | lcr_profile1 | *qos_threshold | 40;;;;90s;;;;;;; | 2014-01-14T00:00:00Z | 10 |
*out | cgrates.org | call | 1004 | *any | DST_1002 | lcr_profile1 | *load_distribution | supplier1:5;supplier2:3;*default:1 | 2014-01-14T00:00:00Z | 10 |
*out | cgrates.org | call | 1004 | *any | *any | lcr_profile1 | *load_distribution | 2014-01-14T00:00:00Z | 10 | |
*out | cgrates.org | call | *any | *any | DST_1002 | lcr_profile2 | *lowest_cost | 2014-01-14T00:00:00Z | 10 | |
*out | cgrates.org | call | *any | *any | *any | lcr_profile1 | *lowest_cost | 2014-01-14T00:00:00Z | 10 |
- [0] - Direction:
- TBD
- [1] - Tenant:
- TBD
- [2] - Category:
- TBD
- [3] - Account:
- TBD
- [4] - Subject:
- TBD
- [5] - DestinationTag:
- TBD
- [6] - RpCategory:
- TBD
- [7] - Strategy:
- TBD
- [8] - StrategyParams:
- TBD
- [9] - ActivationTime:
- TBD
- [10] - Weight:
- TBD
4.2.15. Users¶
TBD
"Users.csv" - csv
"tp_users" - stor_db
#Tenant[0] | UserName[1] | Masked[2] | AttributeName[3] | AttributeValue[4] | Weight[5] |
---|---|---|---|---|---|
cgrates.org | 1001 | SysUserName | danb | 10 | |
cgrates.org | 1001 | SysPassword | hisPass321 | 10 | |
cgrates.org | 1001 | Cli | +4986517174963 | 10 | |
cgrates.org | 1001 | Account | 1001 | 10 | |
cgrates.org | 1001 | Subject | 1001 | 10 | |
cgrates.org | 1001 | Uuid | 388539dfd4f5cefee8f488b78c6c244b9e19138e | 10 | |
cgrates.org | 1001 | SubscriberId | 1001 | 10 | |
cgrates.org | 1001 | RequestType | *prepaid | 10 | |
cgrates.org | 1002 | SysUserName | rif | 10 | |
cgrates.org | 1002 | RifAttr | RifVal | 10 | |
cgrates.org | 1002 | Account | 1002 | 10 | |
cgrates.org | 1002 | Subject | 1002 | 10 | |
cgrates.org | 1002 | Uuid | 27f37edec0670fa34cf79076b80ef5021e39c5b5 | 10 | |
cgrates.org | 1002 | SubscriberId | 1002 | 10 | |
cgrates.org | 1004 | SysUserName | danb4 | 10 | |
cgrates.org | 1004 | SysPassword | hisPass321 | 10 | |
cgrates.org | 1004 | Cli | +4986517174964 | 10 | |
cgrates.org | 1004 | Account | 1004 | 10 | |
cgrates.org | 1004 | Subject | 1004 | 10 | |
cgrates.org | 1004 | RequestType | *rated | 10 | |
cgrates.org | 1004 | SubscriberId | 1004 | 10 |
- [0] - Tenant:
- TBD
- [1] - UserName:
- TBD
- [2] - Masked:
- TBD
- [3] - AttributeName:
- TBD
- [4] - AttributeValue:
- TBD
- [5] - Weight:
- TBD
4.2.16. Aliases¶
TBD
"Aliases.csv" - csv
"tp_aliases" - stor_db
#Direction | Tenant | Category | Account | Subject | DestinationId | Context | Target | Original | Alias | Weight |
---|---|---|---|---|---|---|---|---|---|---|
*out | cgrates.org | call | 1006 | 1006 | *any | *rating | Subject | 1006 | 1001 | 10 |
*out | cgrates.org | call | 1006 | 1006 | *any | *rating | Account | 1006 | 1002 | 10 |
- [0] - Direction:
- TBD
- [1] - Tenant:
- TBD
- [2] - Category:
- TBD
- [3] - Account:
- TBD
- [4] - Subject:
- TBD
- [5] - DestinationId:
- TBD
- [6] - Context:
- TBD
- [7] - Target:
- TBD
- [8] - Original:
- TBD
- [9] - Alias:
- TBD
- [10] - Weight:
- TBD
4.2.17. Resource Limits¶
TBD
"ResourceLimits.csv" - csv
"tp_resource_limits" - stor_db
#Id | FilterType | FilterFieldName | FilterValues | ActivationTime | Weight | Limit | ActionTriggers |
---|---|---|---|---|---|---|---|
ResGroup1 | *string | Account | 1001;1002 | 2014-07-29T15:00:00Z | 10 | 2 | |
ResGroup1 | *string_prefix | Destination | 10;20 | 2014-07-29T15:00:00Z | 10 | ||
ResGroup1 | *rsr_fields | Subject(~^1.*1$);Destination(1002) | |||||
ResGroup2 | *destinations | Destination | DST_FS | 2014-07-29T15:00:00Z | 10 | 2 | |
ResGroup2 | *cdr_stats | CDRST1:*min_ASR:34;CDRST_1001:*min_ASR:20 |
- [0] - Tag
- TBD
- [1] - FilterType
- TBD
- [2] - FilterFieldName
- TBD
- [3] - FilterValues
- TBD
- [4] - ActivationTime
- TBD
- [5] - Weight
- TBD
- [6] - Limit
- TBD
- [7] - ActionTriggerIds
- TBD