[Freeswitch-users] problem with failover routes for LCR A-Z scenario
Hound Dog
d_hound at ymail.com
Wed Nov 4 23:44:44 PST 2009
I have a general question regrading MOD_LCR and the way it chooses main and failover routes ( backups )
it came out a little long , sorry for that :)
I found that it difficult/impossible to make LCR use only carriers that I choose
scenario is as follows , taking the UK as example for a destination ( prices are not real , just an example )
I have 2 carriers offering routes to the UK , landline and mobile
my buying prices
Destination carrier1 Price carrier2 price
44 (all UK) $0.01 $0.01
447 (UK mobile) $0.15 $0.19
my selling prices
Destination price
44 (all UK) $0.015
447 (UKmobile) $0.17
so for UK landline both carrier 1 and carrier 2 are good for me , so I use them and be profitable
for UK mobile I can ** only ** make a profit if I use carrier 1 ( if I use carrier2 I actually lose money on every calls since I sell the call for 17 cents but buy for 19 cents so I LOSE 2 cents a minute)
translating it to MOD_LCR information
digits rate carrier_id ( other columns ignored )
44 0.01 1
44 0.01 2
447 0.015 1
this looks good :
44 prefix will be shared between carrier 1 and 2
447 prefix will only go to carreir 1
so it fits perfectly - BUT
testing this I get -
API CALL [lcr(447965404547)] output:
| Digit Match | Carrier | Rate | Codec | CID Regexp | Dialstring |
| 447 | carr1 | 0.15 | G711 | | [lcr_carrier=carr1,lcr_rate=1.00000,absolute_codec_string=G729]sofia/external/447965404547 at 10.10.10.1 |
| 44 | carr2 | 0.01 | G711 | | [lcr_carrier=carr2,lcr_rate=1.00000,absolute_codec_string=G729]sofia/external/447965404547 at 10.10.10.2 |
Notice the lcr engine is using carrier2 to route the call as backup for carrier1 , because it has coverage of that range ( 44 covers 447xxxx ) - it all makes sense
** BUT ** carrier2 should not be used for 447 range , I will lose money on each call I send there , and I actually prefer calls to fail
so far I didnt find a solution for that , so if there is one I love bo pointed there
I did think it over a little and came up with 2 options that could be used ,
and I am also planning to code them and propose patch to maintainers ,
I would love to get comments on those ( in case there are no existing solution )
option 1 - setting some routes as last option , add another param to the LCR table called last_route ,
when hitting a route with last_route=1, stop processing additional routes and return your routing decision so far
so in our case the route entry with 44 to carrier1 will have last_route=1 , the other 44 routes will have last_route=0 to allow for failover
option 2 - don't allow shorter prefixes , once a prefix match was found with a N digits length , do not accept less digits prefix matches.
in other words dont failover from a finer route to a wider route.
it will need to be a global option and I will be quite simple to use,
but will require entering mutiple entries of the same length prefix for each carrier you would like to use
its intutive and relatively simple to manage , but requires more lcr entries to get you where you want
More information about the FreeSWITCH-users
mailing list