[Freeswitch-users] Mod LCR SQL sub-query for better routing

Victor Chukalovskiy victor.chukalovskiy at gmail.com
Wed Jan 14 19:51:20 MSK 2015


Alright, I'm glad it helped someone :)

On 14-11-28 08:05 PM, DP . wrote:
> Victor, I take back my initial response on this old email.
>
> We ran into a couple of cases with some carriers and multiple matching 
> prefixes. After actually trying your sub query (modified for Mysql), 
> it actually does return the true lowest rate from a carrier while 
> importantly respecting the longest match per carrier. Unlike the 
> reorder_by_rate function that does not respect the longest match per 
> carrier. That function simply returns the lowest rate, period.
>
> So thanks!
>
> ------------------------------------------------------------------------
> From: hi-tecc at hotmail.com
> To: freeswitch-users at lists.freeswitch.org
> Subject: RE: [Freeswitch-users] Mod LCR SQL sub-query for better routing
> Date: Mon, 16 Dec 2013 18:36:06 -0500
>
> I agree. This definitely sounds like he simply needed the 
> "reorder_by_rate" param. It will reorder the initial sql results 
> strictly by rate:
>
>   * reorder_by_rate - Forces the LCR module to re-order the query
>     strictly on rate basis. By default this is turned off, but
>     enabling this will always prefer rate over anything else.
>
>
> Beware this may have an adverse effect! I initially had this turned on 
> then quickly realized it would sometimes try to route ALL calls by the 
> lowest rate found.
>
> Ex: flowroute lists all calls for the US with a default NPA of "1" at 
> .0098. Now a user trying to call Jamaica with "1876" at a rate of 0.19 
> (or whatever) will get both flowroute rates returned. The reorder by 
> rate will assume 0.0098 is a valid rate since it will now be the 
> "cheapest" in the list and send the call along its way to flowroute, 
> whom will now bill you at 0.19. Now if you have another carrier in 
> your list with 1876 at 0.15 you can see why this would be a problem.
>
> In this case you will always want the longest matched NPANXX rate.
>
> ------------------------------------------------------------------------
> Date: Fri, 13 Dec 2013 15:58:54 -0500
> From: intralanman at freeswitch.org
> To: freeswitch-users at lists.freeswitch.org
> Subject: Re: [Freeswitch-users] Mod LCR SQL sub-query for better routing
>
> On 12/12/2013 02:42 PM, Victor Chukalovskiy wrote:
>
>     Hello,
>
>     For those interested, I added a piece to mod lcr wiki. It makes sorting
>     / routing logic better than default logic:
>
>     http://wiki.freeswitch.org/wiki/Mod_lcr#Custom_SQL_with_sub-query_-_for_real-life_ratesheet_complexities
>
>     Why it helps:
>
>     Rates rates can often be given both on per-NPA or per-NPANXX level
>     depending on the carrier and on the NPA. Moreover, some carriers may
>     have NPANXX rate lower than the corresponding NPA rate, while others
>     will have it inverse. Neither simple ORDER BY rate, prefix; nor ORDER BY
>     prefix, rate; give the truly cheapest route. The LCR logic should be
>     two-step process to accommodate this.
>
>     Cheers,
>     -Victor
>
> Unless I misunderstand what you're saying, this is what the 
> reorder_by_rate param does.
>
> You'll always want to pick the longest digit match per carrier.  Then 
> you probably want to grab the cheapest overall rate of the matches you 
> got back.
>
> -Ray
>
>
> _________________________________________________________________________ 
> Professional FreeSWITCH Consulting Services: consulting at freeswitch.org 
> http://www.freeswitchsolutions.com FreeSWITCH-powered IP PBX: The 
> CudaTel Communication Server http://www.cudatel.com Official 
> FreeSWITCH Sites http://www.freeswitch.org http://wiki.freeswitch.org 
> http://www.cluecon.com 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
>
>
> _________________________________________________________________________
> Professional FreeSWITCH Consulting Services:
> consulting at freeswitch.org
> http://www.freeswitchsolutions.com
>
> Official FreeSWITCH Sites
> http://www.freeswitch.org
> http://confluence.freeswitch.org
> http://www.cluecon.com
>
> 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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20150114/393c7d49/attachment-0001.html 


Join us at ClueCon 2016 Aug 8-12, 2016
More information about the FreeSWITCH-users mailing list