[Freeswitch-users] problem with failover routes for LCR A-Z scenario

Rupa Schomaker rupa at rupa.com
Thu Nov 5 07:59:49 PST 2009


On Thu, Nov 5, 2009 at 9:46 AM, Hound Dog <d_hound at ymail.com> wrote:
> thanks Rupa ,
>
> its very creative
>
> I saw the new feature of user rates on the trunk , but havent worked with it as im using 1.0.4
> will have a look and see if it can be used

Cool, if you have issues let me know.  We can work through 'em.

> BTW - I already implemented anti-loop on the LCR with custom-sql , adding the incoming carrier-id to a variable on the incoming dial plan and filtering the LCR carriers not to include same carrier , solved some issues for me when carriers send me traffic that they actually supply
>
> will document and send it to you soon

custom sql really is a powerful feature.  It does require a bit of
thinking, but since it can use any channel variable it is very
flexible.

>
>
> thank you v much
> Ori
>
>
>
>
> ----- Original Message ----
> From: Rupa Schomaker <rupa at rupa.com>
> To: freeswitch-users at lists.freeswitch.org
> Sent: Thu, November 5, 2009 1:31:00 PM
> Subject: Re: [Freeswitch-users] problem with failover routes for LCR A-Z scenario
>
> Actually, using custom sql, you can implement the filter yourself in
> the where clause.  No need for code changes.
>
> On Thu, Nov 5, 2009 at 7:17 AM, Rupa Schomaker <rupa at rupa.com> wrote:
>> Now that user rates are supported in mod_lcr, how about an option that
>> says to drop the route if the user_rate is < rate ?
>>
>> This 1) requires you to use custom sql and 2) be able to represent
>> your user rates in that sql (join to user rate table perhaps?)
>>
>> On Thu, Nov 5, 2009 at 1:44 AM, Hound Dog <d_hound at ymail.com> wrote:
>>> 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
>>>
>>>
>>>
>>>
>>>
>>> _______________________________________________
>>> FreeSWITCH-users mailing list
>>> FreeSWITCH-users at lists.freeswitch.org
>>> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
>>> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
>>> http://www.freeswitch.org
>>>
>>
>>
>>
>> --
>> -Rupa
>>
>
>
>
> --
> -Rupa
>
> _______________________________________________
> FreeSWITCH-users mailing list
> FreeSWITCH-users at lists.freeswitch.org
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
> http://www.freeswitch.org
>
>
>
>
>
>
> _______________________________________________
> FreeSWITCH-users mailing list
> FreeSWITCH-users at lists.freeswitch.org
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
> http://www.freeswitch.org
>



-- 
-Rupa




More information about the FreeSWITCH-users mailing list