Migrating
Migrating from CGRateS
Exporting CDRs and rate profiles, and what maps to what.
5 min read
Exporting the CDRs
CGRateS can export rated CDRs to CSV from the CDRe subsystem or straight out of the cdrs table. Either is fine — we re-rate against your plans rather than trusting the amount, so a rated export and a raw one produce the same result.
cgr-console 'cdrs_export Type="csv" ExportPath="/tmp/cdrs" \
Filters=["*gte:~*req.AnswerTime:2024-01-01T00:00:00Z"]'| CGRateS field | Maps to | Notes |
|---|---|---|
| OriginID | Identifier | Stable across exports, which is what makes re-imports safe. |
| AnswerTime | When | Use AnswerTime, not SetupTime — unanswered calls are not billable. |
| Account | Who | Or Subject, if that is what you bill against. |
| Usage | How much | Exports as a duration string; convert to seconds before importing. |
| Destination | To where | What the tariff matches on. |
Rate profiles become plan versions
A CGRateS RatingProfile with an ActivationTime is the same idea as a plan version with an effective_from. Export one plan version per activation time and the historical rating comes out identical.
DestinationRates map to tariff lines: the destination prefix becomes match_key, RateIncrement becomes increment, and ConnectFee is a minimum. Rate groups with more than one tier within a call are the one thing that does not map — split them into separate plan lines, or tell us and we will look at it.