For AI agents: this documentation is indexed for you in llms.txt, and all of it in /llms.txt. Every page is also available as markdown: append .md to its address.

You are reading Travelping Open Subscriber Server 6.15, an older release. The newest release is 6.20. Read this page in 6.20

Charging configuration

This document describes how you can configure charging in TPOSS, which includes tariffs, charging rules, and Charging Data Records (CDRs) configuration.

Tariffs configuration

TPOSS provisions a set of tariffs during the start-up. For each tariff, configure a tenant using this configuration option:

yaml

It is possible to configure tariffs for multiple tenants:

yaml

With this configuration, a whole set of tariffs is provisioned for every specified tenant. For the example above, two online tariffs will be provisioned: online@tposs.cennso.net and online@additional.tenant.com.

Available tariffs

These are the tariffs that TPOSS provisions during the start-up:

To provision tariffs with a new tenant manually, use the following API:

elixir

Tip

For more information on how to run TPOSS commands, see the Troubleshooting guide.

Charging rules configuration

TPOSS specifies the list of PCC rules and rating groups to allocate them and execute the charging procedures. Each rule has a name and a number with a rating group identifier associated with it. To specify the list of rating groups with respective names to allocate charging rules and handle charging reports, use these configuration options:

yaml

In the example above the rating group with ID 1000 is associated with the Online PCC rule. You can use any name instead of online, however, it must be consistent within the whole configuration file. Each rating group has validity time - the period of time in seconds after which TPOSS expects to receive the charging report for the given rating group. The scg.rating_groups_exclude_rules specifies the list of PCC rules that are excluded if the given rule was allocated by TPOSS. The names listed in the scg.rating_groups_exclude_rules must be valid PCC rules defined in the scg.adc_rules configuration.

To allocate a PCC rule for a subscriber, TPOSS must know what conditions must be met. For this purpose, the scg.rating_groups_selectors configuration option exists. The rule selector is a string in key = value [and|or key = value] format. The possible keys are:

  • handler - a regular expression that will be matched against Called-Station-Id within a network session
  • called_station_id - a handler name that will check if it is possible to allocate a given rating group for the given session

Note

The handler key must be always the first condition in the expression.

The following handlers are supported:

  • b2binternet - a rule is allocated if a user is in the B2BInternet tariff
  • online - a rule is allocated if a user has a valid balance
  • unlimited_streaming - a rule is allocated if the session has the unlimited streaming tariff option
  • whitelist - a rule is allocated if the session has unknown IMEISV

If the selector is not specified for the given PCC rule, define a quota for such rule:

yaml

Rules without a selector are always allocated for a subscriber except it was not specified in the scg.rating_groups_exclude_rules for already allocated rules.

Here is the example of the default TPOSS configuration with the description of all defined PCC rules, rating groups, and their behaviour:

yaml

You can disable the unlimited_streaming and unlimited_streaming_pd charging rules. To do so, use this configuration option:

yaml

To configure the traffic quota that is allocated for the sessions with the B2BInternet charging rule, use this configuration option:

yaml

Note

The scg.b2b_internet_quota configuration option is deprecated and will be removed in the next releases. Instead, specify the scg.rating_groups_quotas.b2binternet = {QUOTA} option with the scg.rating_groups_selector.b2binternet = handler = b2binternet selector.

Charging Data Records configuration

When the service session is terminated or a balance is exhausted by validity time or by quota, TPOSS creates a Charging Data Record (CDR). TPOSS may write CDRs to multiple destinations, usually to the file-based backend and the database backend.

Database backend

You can configure TPOSS to generate CDRs to the MySQL database backend using these configuration options:

yaml

The configuration option cdr.controller.database.enabled enables storing the generated charging data records in the MySQL database.

The configuration option cdr.controller.database.ignore contains a list of selectors that specify criteria for which CDRs should not be generated. If a selector is matched for the given session, the charging data records are not generated. The selectors are in the form of key:value. The currently supported key is only Called-Station-Id. The value can be any regular expression. In the example above, the CDRs are not created for the sessions from APNs, such as apn1.example-2.com, apn2.example-3.com, and so on.

Tip

Partitioning is an effective way to manage big write-only tables with historic data. That's why it is recommended to enable CDR table partitioning using the cdr.controller.database.partitions_enabled option.

If the partitioning is enabled, TPOSS provisions special stored proceduresOpens in a new tab to maintain active partitions and delete the old ones. In a new TPOSS deployment, the configuration option cdr.controller.database.initial_partitions_amount specifies the initial number of partitions to create.

The cdr.controller.database.partitions_duration configuration option specifies how long the given partition should be considered active and may be used to insert the new charging data records. The cdr.controller.database.cdr_cleanup_period configuration option specifies a time unit after which all partitions are dropped. The definitions of the time periods specified in the cdr.controller.database.partitions_duration and cdr.controller.database.cdr_cleanup_period options consist of a positive integer and a time unit, for example: 14-days,month, 2-minutes. The supported time units are:

  • second(s)
  • minute(s)
  • hour(s)
  • day(s)
  • week(s)
  • month(s)
  • year(s)

As soon as there is only a single active partition remaining, the database triggers the storage procedure to create new partitions for rotation. The cdr.controller.database.new_partitions_amount configuration option specifies the number of new partitions to create.

The clean_up_partitions_at parameter is an optional configuration option that may contain a string value in the "HH:MM" format. If the configuration value is not empty, TPOSS provisions an event for deletion of the outdated CDR partitions that should be triggered once per-day in the given time. You should run the partitions deletion in less busy time to not impact other database queries. If this configuration option is set to an empty string (""), the event to delete the outdated partitions is triggered every 7 minutes. The time zone of the given time depends on the time zone configured at the database server.

If the deletion of partitions that is triggered once per-day failed, or if you want to trigger it during maintenance time, you can do it manually with the MySQL client by calling this procedure:

sql
  • The first argument specifies the number of units after which a partition is considered as outdated.
  • The second argument specifies the time unit.

If partitioning is disabled, the special process watches for a CDR table and deleted CDRs that are outdated. The following options control the behaviour of this process:

  • cdr.controller.database.cdr_cleanup_limit - limit of CDRs to remove at once. The supported values are any positive integer values or the string all.
  • cdr.controller.database.cdr_cleanup_query_timeout - timeout in milliseconds that specifies the max time of the query to delete outdated CDRs.
  • cdr.controller.database.watcher_timeout - timeout in milliseconds that specifies how often to check a CDR table

File backend

You can configure TPOSS to generate CDRs to the file backend using these configuration options:

yaml

The configuration option cdr.controller.file.enabled enables storing the generated charging data records in CSV files.

The cdr.controller.file.ignore configuration option contains a list of selectors that specify criteria for which CDRs should not be generated. It works the same as the cdr.controller.database.ignore option in the database controller.

The other configuration options specify where to store CSV files on a disk and how to rotate them. The cdr.controller.file.dir configuration option specifies the path to the directory where CDRs are written. The cdr.controller.file.time_window specifies time in seconds for the charging data record files rotation. The cdr.controller.file.max_count configuration option specifies the maximum number of charging data records in one file. The cdr.controller.file.file_name_format configuration option specifies the format of the CSV file names.

To write CDRs on a disk, provide a persistent volumeOpens in a new tab:

yaml

Note

To have access to the file-based CDRs, TPOSS provides an SFTP service that you must configure. Read the next section to learn more.

SFTP settings

You can enable an SFTP container so that CDRs can be fetched from an external system for further CDR processing:

yaml

For more information about the sftp service, see the Kubernetes serviceOpens in a new tab documentation.

The sftpConfig parameter must contain a password hashed with a crypt algorithm. For example, the value of the key-value pair sftpConfig.password = "$1$RsBlW1hk$/ISHFEK0yrEX8M7x9.lbB1" from the example above was obtained by running this command:

console

Note

The username of the SFTP user is sftp and it can not be changed.