If you can sum up the logic in an SQL query I&#39;d recommend doing that. If you can cache the results in memcache, even better. Just keep in mind that any complicated logic can serve as a significant bottleneck. Depending on your traffic load, that may or may not be an issue. <div>

<br></div><div>I know there are a few recommendations for the perl module here, but I&#39;m not sure of the status of the module and if it&#39;s actively maintained. I&#39;d love to hear from others about their own experiences using it. I haven&#39;t used it myself in maybe 6 years or so.<br>

<div>-Brett</div><div><br><br><div class="gmail_quote">On Thu, Aug 30, 2012 at 9:09 AM, Shaahin Madani <span dir="ltr">&lt;<a href="mailto:shaahin.madani@gmail.com" target="_blank">shaahin.madani@gmail.com</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><font><font face="verdana,sans-serif">Hi Bogdan and Brett,</font></font><div><font><font face="verdana,sans-serif"><br>

</font></font></div><div><font><font face="verdana,sans-serif">Thanks for your replies. The issue here is that my OpenSIPS simply does not have the list of gateways, that is the gateways are *not* available in the </font><font face="courier new, monospace">dr_gateways</font><font face="verdana,sans-serif"> table. For every INVITE request, the list of gateways must be dynamically built, and only afterwards the actual dynamic routing can take place. The logic behind building the list of gateways relies on a totally separate database</font><font face="Verdana, sans-serif">.</font></font></div>


<div><font><font face="Verdana, sans-serif">To sum it up, I would say the desired scenario would resemble the steps below:</font></font></div><div><font><font face="Verdana, sans-serif"><br></font></font></div><div><font><font face="Verdana, sans-serif">1) OpenSIPS receives an INVITE</font></font></div>


<div><font face="Verdana, sans-serif">2) OpenSIPS asks an external system (e.g. the Perl script) for the gateways available for this specific INVITE request</font></div><div><font face="Verdana, sans-serif">3) A list of gateways is returned to OpenSIPS (based on some black-box logic)</font></div>


<div><font face="Verdana, sans-serif">4) OpenSIPS dynamically routes the INVITE to the specified gateways, prioritising based on cost, time, or ...</font></div><div><br></div></div></blockquote></div></div></div>