<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div><blockquote type="cite"><div dir="ltr"><a href="https://github.com/dimitri/prefixIt" rel="noreferrer" target="_blank" style="background-color: rgba(255, 255, 255, 0);"><font color="#000000">https://github.com/dimitri/pre<wbr>fix</font></a></div></blockquote><div id="AppleMailSignature"><br></div>Regardless of how many routes you have, you don't want to do it the way you're doing it. Trust me.<br><br>-- Alex</div><div><br>On Sep 5, 2017, at 7:54 PM, Patrick Wakano <<a href="mailto:pwakano@gmail.com">pwakano@gmail.com</a>> wrote:<br><br></div><blockquote type="cite"><div><div dir="ltr"><div><div>Thanks for the response guys!<br></div>The link  <a href="https://github.com/dimitri/prefixIt" rel="noreferrer" target="_blank">https://github.com/dimitri/pre<wbr>fixIt</a> is returning 404....</div><div>Regarding the performance itself I am not worried since this select it is just for management and I don't expect having millions of rules.</div><div>The idea is just to have an easy way to have a picture of how the LCR will order and select the gateways based on a given prefix. The three LCR tables are not so easy to handle and manage from command line so my idea was to have a single SELECT or VIEW to return me all I need at once!</div><div>From what I could check, I think the select I sent pretty much translates what LCR module does internally, I am just trying to verify if it has some flaw, which could mislead me in the rules management.<br></div><div><br></div><div>Cheers,</div><div>Patrick Wakano<br></div><div><br></div><div class="gmail_extra"><br><div class="gmail_quote">On 6 September 2017 at 00:32, Dmitry Sinina <span dir="ltr"><<a href="mailto:dmitry.sinina@onat.edu.ua" target="_blank">dmitry.sinina@onat.edu.ua</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><a href="https://yeti-switch.org/demo.html" rel="noreferrer" target="_blank">https://yeti-switch.org/demo.h<wbr>tml</a><div class="HOEnZb"><div class="h5"><br>
<br>
On 9/5/17 5:29 PM, Dmitry Sinina wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
And you can try our opensource LCR engine. We use kamailio as load balancer and SEMS as SBC.<br>
<br>
On 9/5/17 3:02 AM, Patrick Wakano wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hello list,<br>
<br>
Hope you all doing well!<br>
I am trying to ease the management of LCR routing rules, since once we begin to have multiple prefixes, multiple GWs and so on, the visualization and management of the rules priorities becomes exponentially hard to do.<br>
So first thing I am trying to achieve is an easy way of retrieving the rules in an ordered manner. I couldn't find any tool to do such thing and source code was not very friendly.... so I've come up with this Postgresql query that I think retrieves all rules in the same order I expect LCR to select the GWs.<br>
<br>
SELECT lr.lcr_id, lr.prefix, lrt.priority, lg.gw_name, lg.ip_addr<br>
FROM lcr_rule lr<br>
JOIN lcr_rule_target lrt ON lrt.lcr_id = lr.lcr_id AND lrt.rule_id = <a href="http://lr.id" rel="noreferrer" target="_blank">lr.id</a> <<a href="http://lr.id" rel="noreferrer" target="_blank">http://lr.id</a>><br>
JOIN lcr_gw lg ON lg.lcr_id = lr.lcr_id AND <a href="http://lg.id" rel="noreferrer" target="_blank">lg.id</a> <<a href="http://lg.id" rel="noreferrer" target="_blank">http://lg.id</a>> = lrt.gw_id<br>
WHERE lr.enabled = 1 AND lg.defunct = 0 AND lr.lcr_id = ID AND lr.prefix SIMILAR TO '(|PREFIX%)'<br>
ORDER BY lr.lcr_id, LENGTH(lr.prefix) DESC, lrt.priority;<br>
<br>
It is missing the weights calculation, but it is rather complex and I am not using it anyway.... Other than that does anyone did something similar to check if my query really matches what LCR engine does?<br>
<br>
Thanks,<br>
Patrick Wakano<br>
<br>
______________________________<wbr>_________________<br>
Kamailio (SER) - Users Mailing List<br>
<a href="mailto:sr-users@lists.kamailio.org" target="_blank">sr-users@lists.kamailio.org</a><br>
<a href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users" rel="noreferrer" target="_blank">https://lists.kamailio.org/cgi<wbr>-bin/mailman/listinfo/sr-users</a><br>
<br>
</blockquote>
<br>
</blockquote>
<br>
</div></div></blockquote></div><br></div></div>
</div></blockquote><blockquote type="cite"><div><span>_______________________________________________</span><br><span>Kamailio (SER) - Users Mailing List</span><br><span><a href="mailto:sr-users@lists.kamailio.org">sr-users@lists.kamailio.org</a></span><br><span><a href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users">https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users</a></span><br></div></blockquote></body></html>