This project implements a call rating engine for processing CSV formatted files from Asterisk PBX. The engine supports a number of features to help with complex billing scenarios.
$ ./src/matcher rates.tsv rates1.tsv < Master.csv > MasterRated.tsv
Rate tables are comprised of a specially formatted space-separated file. The first line is global information about the table, while the next lines are actual routing table entries.
The format of the first line is:
[Start Hour] [End Hour] [Day of the week or any]
As an example, to cover the entire day for all days in a week, specify:
0 23 any
Following the table's header are the routes and their associated pricing, which are the following fields all separated by a space.
- Destination Prefix (eg: 1 for all of the USA)
- Retail Amount (amount charged per billing interval)
- Vendor Amount (amount costed per billing interval)
- Billing Interval (interval to round calls to. eg: 6 for six second billing or 60 for minute interval billing.)
- Connect Charge (fixed amount to charge at start of call. Used for rating calls to 411, as an example.)
Asterisk CSV-CDR format
The output format is a tab-delimited file containing all of the original Asterisk CSV-CDR fields, followed by the retail price of the call. A future version may alter this output, so vendor price becomes available.
The rating engine implemented herein could be used as the rating engine for AgileVoice billing software. All that is required is appropriate database exporting and importing.