<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
<tt>Hi Shaahin,<br>
<br>
Why not simply using the Dynamic Routing module :<br>
<a class="moz-txt-link-freetext" href="http://www.opensips.org/html/docs/modules/1.8.x/drouting.html">http://www.opensips.org/html/docs/modules/1.8.x/drouting.html</a><br>
<br>
Regards,</tt><br>
<pre class="moz-signature" cols="72">Bogdan-Andrei Iancu
OpenSIPS Founder and Developer
<a class="moz-txt-link-freetext" href="http://www.opensips-solutions.com">http://www.opensips-solutions.com</a></pre>
<br>
On 08/30/2012 03:07 PM, Shaahin Madani wrote:
<blockquote
cite="mid:CAGBGK_4hL53y9XO9+Pq65Jpp9JKzVcQnJMY11H_jUBHJU1PCUQ@mail.gmail.com"
type="cite">
<div dir="ltr">
<p class="MsoNormal"><span style="font-family:
"Verdana","sans-serif";" lang="EN-US">Greetings,</span></p>
<p class="MsoNormal"><span style="font-family:
"Verdana","sans-serif";" lang="EN-US"><br>
</span></p>
<p class="MsoNormal"><span style="font-family:
"Verdana","sans-serif";" lang="EN-US">In
my OpenSIPS server, when I receive an INVITE
requests, I need to (1) consult an external database to get
a list of gateways,
and (2) send the request to those gateways, in order,
starting from the first
and trying the next only if the current one fails (e.g.
irresponsive, offline,
busy, etc).</span></p>
<p class="MsoNormal"><span style="font-family:
"Verdana","sans-serif";" lang="EN-US"><br>
</span></p>
<p class="MsoNormal"><span style="font-family:
"Verdana","sans-serif";" lang="EN-US">I
understand that forwarding calls to a certain gateway
can be achieved using the </span><span style="font-family:
"Courier New";" lang="EN-US">rewritehostport(…)</span><span
style="font-family:
"Verdana","sans-serif";" lang="EN-US">
function; and
that prefix-/caller-/group-/time-/priority-based dynamic
routing can be
addressed using the </span><span style="font-family:
"Courier New";" lang="EN-US">DROUTING</span><span
style="font-family:
"Verdana","sans-serif";" lang="EN-US">
module. However, in my system
what actually is “dynamic” is the gateway list itself, which
is therefore not a
subset of the </span><span style="font-family:
"Courier New";" lang="EN-US">dr_gateways</span><span
style="font-family:
"Verdana","sans-serif";" lang="EN-US">
table. In fact, OpenSIPS has
no idea about the list of gateways due to the complex
business-logic involved.
The dynamic gateway list, nevertheless, needs to be treated
identical to an
ordinary one, i.e. prefix, time and priority of gateways
must be considered.</span></p>
<p class="MsoNormal"><span style="font-family:
"Verdana","sans-serif";" lang="EN-US"><br>
</span></p>
<p class="MsoNormal"><span style="font-family:
"Verdana","sans-serif";" lang="EN-US">Solving
this problem, I assume, requires either
writing a whole new </span><span style="font-family:
"Courier New";" lang="EN-US">DROUTING</span><span
style="font-family:
"Verdana","sans-serif";" lang="EN-US">
module, which wraps the
necessary business-logic and consults the external database;
or wrapping the
business-logic in a Perl script that is called from the
routing script (</span><span style="font-family:
"Courier New";" lang="EN-US">opensips.cfg</span><span
style="font-family:
"Verdana","sans-serif";" lang="EN-US">).
Now, there are two issues that I would like to know your
expert opinion about:</span></p>
<p class="MsoNormal"><span style="font-family:
"Verdana","sans-serif";" lang="EN-US"><br>
</span></p>
<p class="MsoNormal"><span style="font-family:
"Verdana","sans-serif";" lang="EN-US">1.
Is my solution, i.e. using the Perl script to wrap the
business logic and queries to the external database, the
best possible way to do this?</span></p>
<p class="MsoNormal"><span style="font-family:
"Verdana","sans-serif";" lang="EN-US"><br>
</span></p>
<p class="MsoNormal"><span style="font-family:
"Verdana","sans-serif";" lang="EN-US">2.
As the list of gateways is dynamic, is there any
way to leverage the facilities offered by the </span><span
style="font-family: "Courier New";" lang="EN-US">DROUTING</span><span
style="font-family:
"Verdana","sans-serif";" lang="EN-US">
module? Specifically, can I somehow get the list of gateways
from the Perl
script and pass it to the </span><span style="font-family:
"Courier New";" lang="EN-US">DROUTING</span><span
style="font-family:
"Verdana","sans-serif";" lang="EN-US">
module for
prefix-/time-/priority-based routing, or probing, purposes?</span></p>
<p class="MsoNormal"><span style="font-family:
"Verdana","sans-serif";" lang="EN-US"><br>
</span></p>
<p class="MsoNormal"><span style="font-family:
"Verdana","sans-serif";" lang="EN-US">Regards,</span></p>
<p class="MsoNormal"><font face="Verdana, sans-serif">Shaahin
Madani</font></p>
</div>
<pre wrap="">
<fieldset class="mimeAttachmentHeader"></fieldset>
_______________________________________________
Users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a>
<a class="moz-txt-link-freetext" href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a>
</pre>
</blockquote>
</body>
</html>