Hello,
I’m testing LCR and COST Routing Type.
I have on the same RATE GROUP two rates:
57318 with force trunk TRUNKA and cost 0.01
and
5731 with force trunk TRUNKB and cost 0.08
If in the RATE GROUP configuration i use Routing Type LCR, the system select the first rate (57318)
If in the RATE GROUP configuration i use Routing Type COST the system select the same rate (57318)
Maybe a problem with code?
IF LCR and COST routing are from Originations Rates point of view, why the query on MySQL is the same?
LCR
SELECT * FROM routes WHERE (pattern = ‘^573182409064.’ OR pattern = '^57318240906.’ OR pattern = ‘^5731824090.’ OR pattern = '^573182409.’ OR pattern = ‘^57318240.’ OR pattern = '^5731824.’ OR pattern = ‘^573182.’ OR pattern = '^57318.’ OR pattern = ‘^5731.’ OR pattern = '^573.’ OR pattern = ‘^57.’ OR pattern = '^5.’ OR pattern =’–’) AND status = 0 AND (pricelist_id = 8 OR accountid=16) ORDER BY accountid DESC,LENGTH(pattern) DESC,cost DESC LIMIT 1
COST
SELECT * FROM routes WHERE (pattern = ‘^573182409064.’ OR pattern = '^57318240906.’ OR pattern = ‘^5731824090.’ OR pattern = '^573182409.’ OR pattern = ‘^57318240.’ OR pattern = '^5731824.’ OR pattern = ‘^573182.’ OR pattern = '^57318.’ OR pattern = ‘^5731.’ OR pattern = '^573.’ OR pattern = ‘^57.’ OR pattern = '^5.’ OR pattern =’–’) AND status = 0 AND (pricelist_id = 8 OR accountid=16) ORDER BY accountid DESC,LENGTH(pattern) DESC,cost DESC LIMIT 1
So, after some more tests, the solution. LCR and COST is from Termination Rates point of view so the system select the rate with the longer prefix without look at the price is the RATE GROUP Routing is LCR and select more cheaper rate, without look at prefix if RATE GROUP Routing is COST.
This is true only if:
each rate use a different trunk to terminate the call