… automate CDR upload to xDR mediator?
To automate the CDR delivery from your vendor to the xDR mediator, create the entry point to the xDR mediator for file transfer via the FTP /SFTP protocol.
To make this happen, perform the following steps:
Create a user for file transfer
For your vendor to upload source CDR files, create a special user for file transfer. Your vendor uses this user’s credentials to access the xDR mediator and upload the CDR source files to the specified folder.
- On the Configuration server web interface, click the Users tab.
- Click Create.
- Fill in the user details:
- Login – specify the login for the user.
- Email – specify the user’s email address.
- Password – specify the password for the user.
- Define the time when this user is active using the Activation/Expiration Date calendars.
- Role – select the FileTransfer role from the list.
- Click Save.
Configure the FTP server for the CDR extraction instance
- Go to the Configurations tab on the Configuration server.
- Clone the existing configuration.
- From the Configuration tree, select Auxiliaries ->CDR Mediation -> CDR Extraction -> <cdr-extraction_instance>.
- In the CDRSourceFTPServer
group, specify the following:
- enable – select Yes.
- login – select the user you just created for the file transfer.
- upload_directory – specify to which directory the source CDR files will be uploaded. You can leave the default $ (name), value or additionally, define an upload directory for it (e.g., $(name)/upload).
- Click Save to save the configuration.
- Click Verify.
- Click Check/Apply to apply this configuration.
…import CDRs with charged amounts?
Though more often than not you will calculate and apply charges to your PortaBilling customers, it is possible that some vendors might send you CDRs that already contain charged amounts.
For example, a source CDR file might look like this:
In this case, you need to pass these charges over to PortaBilling and to also reproduce the xDR records on your customer invoices correctly (e.g., differentiate them per services used, match xDRs against individual destinations, etc.) and also on your statistics reports.
PortaBilling grants you additional flexibility in handling the CDRs that have charged amounts: you can treat the price provided as final and import it as is or apply an additional surcharge on top of it according to the tariff rates.
Please refer to the xDR import configuration handbook for the basic configuration of the xDR Mediation utility.
To import CDRs with charged amounts, perform the following steps:
Configure xDR mediator instances on the Configuration server
- Add and configure the CDR Extraction instance as described in the xDR import configuration handbook.
- In the CDRSource group, add the following columns to the column_list option:
Attribute Name
Type
Description
Override-Rate-Price
int (1 or 0)
- 1 means that the total charge should be exactly equal to the provided amount.
- 0 (default) means that the rate charge will be calculated according to the applicable tariff and then this calculated amount and the one provided via the Amount parameter will be added up.
Amount
Decimal
Amount to be charged to the end-user.
VendorAmount
Decimal
Amount to be applied to the vendor. It is defined if vendor charges are provided.
ResellerAmount
Decimal
Amount to be charged to the reseller. It is defined if vendor charges are provided in the source file.
Since the Override-Rate-Price attribute reflects your decision about how to charge customers, it is optional in the column_list. Hardcode this attribute and its value for the CDR Extraction instance configuration. Please refer to the Declare rules for data transformation section for details.
Thus, for example, your column list for voice call CDRs might look like this:
User-Name,Calling-Station-Id,Called-Station-Id,Acct-Session-Time,h323-connect-time,h323-disconnect-time,PortaOne-Service-Type,h323-remote-address,Amount
- Perform the Add the CDR rating instance step from the xDR import configuration handbook to complete the xDR mediation utility configuration.
- Click Save to save the configuration.
Enable the import charge on the Configuration server
- From the Configuration tree, select BillingEngine->FeatureModules-> ImportCharge_Enabled option and set its value as Yes.
- Click the Save button and then the Verify button.
- Verify the new configuration and click the Check/Apply button.
Declare rules for data transformation
To instruct PortaBilling on how to deal with charged amounts in source CDRs, utilize the data transformation tool – the built-in function on the xDR Mediation utility. It enables you to define the additional fields and their values that are not present in source files and then modify the original .csv data.
We recommend that you use custom modules for the data transformation rules declaration. However, in case you only make slight modifications, you can create a local configuration file and declare the data transformation rules within it. Please refer to the Virtual fields for xDR import handbook for additional information.
At this step, declare the following rules:
- Add the value for the “Overwrite-Rate-Price” field;
- Modify the “Amount” field values (e.g., if your vendor provides you with the charges in cents).
- Log in to the server with the xDR mediator configured (e.g., the web server) using ssh.
- Create a local configuration
file in one of the available text editors (e.g., Vim):
sudo vim /home/porta-cdrmediator/etc/cdr_export.<cdr-extraction_instance_name>.local.conf
where the <cdr-extraction_instance_name> is the name of the corresponding cdr-extraction instance.
- Define the data transformation
rules within.
Make sure it has the [DataTransformation] section header before the rules definition.
So then, your configuration file might look like this:
[DataTransformation] Init=<<PERL use Porta::CDR_Import::Utils; use Porta::CDR_Import::CUCM; PERL Amount=$data{'Amount'} ? ($data{'Amount'}/100.) : 0 Overrite-Rate-Price= return '1'
- Save the configuration file.
After you have defined the data transformation rules in the file, you need to add the file to Deposit Files via the configuration server web interface in order to maintain it throughout future system upgrades.
- Restart the CDR-extraction
service in order to apply changes. Use the following command:
sudo systemctl restart cdr-extd@<cdr-extraction_instance_name>
Consider restarting the service during an off-peak time or after all the files in the queue have been processed.
Configure services in PortaBilling
Configure services in PortaBilling as described in the xDR import configuration handbook. If you do not apply additional charges on top of the ones from the source file, define a zero price for rates in the customer tariff.
Test the xDR import
- Upload the source CDR file as described in the xDR import configuration handbook.
- Select xDR Mediation on the Dashboard.
- Search for the processed xDR collection and click the collection name to view detailed information about the imported xDRs.
- Click the Details icon to see detailed information about an individual xDR.
- Click the Log icon to check log files for a particular xDR record with the Log Viewer.
… merge several CDRs into a single xDR record?
Sometimes a vendor may provide several CDRs that apply to the same session (e.g., if a call passes several gateways before being delivered to the callee and each gateway creates its own CDR). Or, you may wish to aggregate multiple records for the same service (e.g., charges for DID usage from some third-party) into a single record and subtract a single charge from a customer’s balance.
To differentiate CDRs that apply to the same session from others, they have the same identification parameter – the so-called aggregation key. Using this key, PortaBilling identifies CDRs and merges them into a single xDR record.
Let’s say you receive CDRs marked with an aggregation key. To import them into PortaBilling, do the following:
- Add the “aggregation_key” column header to the column_list option for the CDR Extraction instance.
- Configure the xDR import service as described in the xDR import configuration handbook.
- Upload the source file to PortaBilling.
- Click the Details icon to verify the import results.
… import CDRs in TAP3 format?
When a mobile subscriber travels abroad, they use your services from a foreign network. In order to bill the subscriber correctly, the information on service usage must be passed to the home network.
Transferred Account Procedure (TAP) is the mechanism by which wireless operators exchange roaming billing information. It is also the standard, and defines which information on roaming usage must be passed among operators. PortaBilling supports all TAP3 versions from TAP3.1 up to TAP3.12 versions
PortaBilling has a built-in set of demo modules for TAP3 file transformation and processing for voice calls and data transfer services. These modules can handle CDR files that include up to 100,00 rows. Thus, if you operate as an MVNO, you receive the source CDR files in TAP3 format and must import them into PortaBilling to bill your mobile subscribers.
This section describes a sample configuration of the TAP3 CDR import using demo modules.
Add the CDR extraction instance
- Go to the Configurations tab on the Configuration server.
- Clone the existing configuration.
- From the Configuration tree, select Auxiliaries ->CDR Mediation -> CDR Extraction and click the Instance Create icon.
- Fill in the Instance create form:
- Server – select one of your servers. The one recommended is the web server;
- Service IP – select one of the web server’s IP addresses. You may utilize a private IP address for better security (e.g., to avoid possible brute force attacks). Please note that the CDR Extraction instance cannot have the same IP address as the RADIUS instance.
- Click Save.
- In the CDRSource group specify the following parameters:
- type – select the TAP3 CDR source file type from the list.
- file_pattern – specify the file name pattern. It may contain the wildcard (e.g., abc*.tap). The xDR mediator will import only those files with names that fit this pattern.
- files_input_directory – specify the path to the folder from which the xDR mediator will extract the source files (e.g., /porta_var/upload).
- time_zone – select the time zone in which the xDRs will be imported. However, if a particular time zone is specified in the source file, it will override the selected time zone.
- In the Data Transformation group specify the following parameters:
- In the Global group specify how many parallel processes will convert source CDRs and send CDR collections to interim data storage. Leave the default value here for now.
- In the Output group
specify the following:
- min_freq – the time interval during which the data is exported from the input folder if processing a large data source. Default value is 3600 sec.
- separate_collections – defines how the output CDR collections are separated.
- Click Save.
Add the CDR rating instance
Refer to the xDR import configuration handbook for guidelines on how to add the CDR Rating instance.
Configure services in PortaBilling
Configure services in PortaBilling as described in the xDR import configuration handbook.
… import CDRs in chronological order
Import in chronological order requires the use of one Extraction instance and one Rating instance. The number of simultaneous flows depends on the performance of your system.
To configure an xDR import in chronological order, perform the following configuration on the Configuration server:
- Configure the CDR Extraction instance as described in the Add the CDR extraction instance section in the xDR Import Configuration handbook.
- Configure the CDR Rating instance as described in the Add the CDR rating instance section in the xDR Import Configuration handbook.
- In the Global group:
- enable the import in chronological order (chronological import = Yes). The Rating instance then chronologically sorts CDRs within a collection, based on their time stamp (e.g., the connect time for a voice call) before importing them sequentially.
- enable CDR distribution among simultaneous flows (force_same_worker_for_username = Yes). The Rating instance then splits the CDRs based on their username amongst the workers. This ensures that CDRs for each specific username are imported sequentially in chronological order.
- set the number of simultaneous flows (parallel process = 2). Each worker will then import CDRs for a specific username.
For example, if your source file has CDRs for only two usernames (e.g., 16045550101, 16045550202), set 2 parallel processes. The rating instance then simultaneously imports the CDRs for both users.
When processing a source file with CDRs for multiple usernames, the rating instance processes the CDRs sequentially in chronological order and splits the CDRs among available workers (2 by default). The rating instance ensures that each worker processes CDRs with the same username.