CDR Rating¶
See also
- Traffic Classes Specifications
- Charge Logs
- Price Specifications
CDR rating includes the following steps:
- Defining providers of the initiator and the receiver according to the routes specified in the CDR (the search continues for correspondence with the provider'sTermination string). If no match is found for at least one of providers, the CDR rating status changes to Could not find a match for at least one of providers.
- Defining the organization according to telephony network service specified in the CDR. The organization should match one of the providers.
- Finding the traffic classes specification in force at the time of the call for the provider that matches the organization. If no specification is matched, the CDR rating status changes to No matching traffic classes specification.
- Matching closest (i.e. having most coinciding) area codes in the found traffic classes specification for the initiator's and the receiver's phone numbers. If at least one code is not matched, the CDR rating status changes to No matching address.
- Searching for the equipment for the initiator and the receiver firstly by phone numbers, then, if impossible, by the area codes. If no equipment is matched, the CDR rating status changes to No matching equipment.
- Defining the basic and detailed voice services by traffic classes according to the chosen specification. If services are not defined, the CDR rating status changes to No matching service. See the service matching process below.
Further rating is carried out for the party, whose equipment has been defined. If equipment is defined for both parties (i.e. both the initiator and the receiver of the call are customers of the current provider), then the call is rated for both.
- Defining the customer as the equipment owner.
- Matching the charge log by the customer, CPE, and the detailed service. The charge log must be In force, Prepared, or Being processed; the start of the call must fall into its period, and it should be issued according to the price plan, including this detailed service. If it is impossible to match the invoice, the CDR rating status changes to No matching charge log row.
- Defining the customer account by the customer's role in the charge log (Receiver). If there is no account found, the CDR rating status changes to No matching customer account.
- Call rating. After rating is done, there is a row added to the charge log (or rows, if there are quotas in the price specification), which contain information about the cost of the session. After that, CDR status becomes Successfully charged.
Defining Service by the Traffic Classes Specification Contents¶
Registers are formed on the basis of traffic classes specification contents. Registers are special tables representing traffic classes in a more convenient way for rating purposes. Particularly, if there are groups of area codes in the traffic classes description, then in registers they are converted into multiple areas. For example, if there are two groups of area codes in the traffic classes specification:

and the following traffic classes are specified:

Then in the register the contents are shown in the expanded way:

The row of the specification contents and the corresponding register rows are outlined in red. The example shows that using groups of area codes definitely simplifies the description of traffic classes.
After area codes are found by the initiator's and the receiver's phone numbers (step 4), the system needs to define the corresponding basic phone service, i.e. to choose the matching row from the traffic classes register.
The row selection is done using ancestor codes, which are situated in the same branches of the code tree, as the initiator's and the receiver's codes (source codes). Each of the codes is valued depending on its proximity to the source code. So the closest codes receive the value of 1; their parent codes — 2, etc. For example, the initiator's address 13615550101 belongs to the Internal area 1 code and the receiver's address 13155551234 belongs to the New York code. Then ancestor codes have the following values:

Further, the multiple rows of the traffic classes register are searched for those meeting the following criteria:
-
contain a service which is one of the services bound to the telephony network service;
-
have one of the ancestor codes for the initiator's code or the initiator's code itself, in Address A; and an ancestor code for the receiver's code or the receiver's code itself, in Address B. Or, contrariwise, with an ancestor code for the receiver's one — in Address A, and an ancestor code for the initiator's code — in Address B.
Each of the rows has a value calculated as a total of values of the Address A and Address B codes. After that, a row with the smallest value is chosen:

For the initiator, a detailed service is rated as Out, and for the receiver — as In. As in the example above, the initiator is to pay for the National Call Out, and the receiver — for the National Call In.
Session Rating¶
- The price specification and the its row with the corresponding price plan are defined according to the chosen charge log. The price plan contents are searched for the rows with the required detailed service.
-
In the contents, the row of the Session specification type is searched according to the following criteria: the call duration should not exceed the quota specified in the row; the code, specified in Area, should be as close as possible to the CDR code in the codes tree; the row should have the smallest number in the price specification. The following situations are possible:
-
The row chosen from all rows of the Billing period specification type should be the closest to the CDR code in the codes tree, and have the smallest number in the price specification contents. If it uses a quota, rating is done only for the part of the call, and the record about it appears in the charge log. Further, a row with the next quota is chosen, and so on, until the whole call is rated. So the quantity of rows in the charge log for the corresponding session depends on the number of quotas used for its rating.
Let us define the National Call Out service price for a 14-minute session from the example above. The rows from the price specification contents are chosen, which correspond to this service:

As the call duration is more than 5 seconds, at the first step the second row is chosen from the two of the Session specification type (1.1 and 1.2). According to the parameters stated in the row, the rating is per minute.
Row 1.4 of the Billing period specification type shows that the price plan includes 100 minutes of free outbound regional calls. If in the current billing period the total duration of such calls has not exceeded 100 minutes, the next session rating starts with this row. For example, If a customer has already used 96 minutes, the 4 minutes are rated according to the row 1.4 (i.e. free), and the other 10 minutes — according to the row 1.5. As a result, the final price for the call is 15 rubles, and two records are added to the charge log.