-
Notifications
You must be signed in to change notification settings - Fork 2
LCR
- first unit len: First fraction in seconds.
- first unit cost: Cost per minute used to tariff if the call lasts less or equal to first unit len.
- next unit len: After first unit len seconds, the call will be fractioned in this amount of seconds.
- next unit cost: Cost per minute, to charge per every next unit len seconds.
Additionally, for intra-state calls, each route has:
- intra_first unit len
- intra_first unit cost
- intra_next unit len
- intra_next unit cost
These are optional, and can be null. If they are not null, and both the destination and caller are in the US (i.e: their e164 number starts with 1), the db table intra_state_codes will be looked up for, trying to match the first 4 digits of the numbers to a state name, and comparing them. If the call begins and ends in the same state, the call is considered an intra state call, and the intra_* family of costs are used to calculate LCR and route costs.
Given:
- first unit len = 15
- first unit cost = 0.015
- next unit len = 15
- next unit cost = 0.017
For a call of 45 seconds, the first 15 seconds are charge with a rate of 0.015/min, the rest of the call is fractioned in 15 seconds also, but at 0.017/min. The resulting cost is
1 unit of 15s at 0.015/min = 0.00375
+ 2 units of 15s at 0.017/min = 0.00425 * 2 = 0.0085
---------------------------------------------------
Total cost: 0.01225
An average call length (See Configuration Options) is used to calculate the cost (using the variables above), and this is the LCR cost used to sort the routes.