[Asterisk-Users] How do you deal with subprefixes with LCR?

Jean-Michel Hiver jhiver at ykoz.net
Tue Jan 17 16:55:20 MST 2006


Hi List,


I am working on least cost routing code on the moment, and I am 
stumbling on a problem.

Say you have provider A having:

Prefix XXX            0.10
Prefix XXXYYY     0.20

And provider B having

Prefix  XXX            0.15


You're stuck, because you cannot decide if provider B's "XXX" prefix 
also covers XXXYYY numbers or not. If it doesn't, it would be a waste to 
try and contact it. Or maybe worse, you might be dialing a destination 
which /does/ work but is not displayed in the rates list and could be 
billed a lot more.

At the moment, the way I am dealing with this is by trying the longest 
prefixes first. So in this case, the preference order would be:

Prefix XXXYYY     0.20 (Provider A)
Prefix XXX            0.10 (Provider B)
Prefix  XXX            0.15 (Provider C)


However there is also a problem with this approach. Say a 'provider C' 
comes along with the following price list:

Prefix XXXX         0.30
Prefix XXXX         0.30
Prefix XXXX         0.30


Now some 'XXXX' numbers might be chosen first when potentially provider 
A's 'XXX' prefixes were cheaper!

Any ideas on how to deal with this?

Cheers,
Jean-Michel.




More information about the asterisk-users mailing list