<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
<tt>Hi Nick,<br>
<br>
if you want to select the routing group based on caller domain,
simply do:<br>
do_translate("1","$fd/$avp(dr_id)");<br>
<br>
So, the input for dialplan is $fd (domain from FROM hdr) and
output is in $avp(dr_id) .<br>
In DB put :<br>
<br>
</tt>
<div class="itemizedlist">
<ul type="disc">
<li>
<p> <tt><span class="emphasis"><em>match-op</em></span> = 1
(regexp) </tt></p>
</li>
<li>
<p> <tt><span class="emphasis"><em>match_exp</em></span> =
"^(.*)\.opensips\.com$" ; regular expresion that will be
used to match with this rule (if the rule should be
applied for the input string) </tt></p>
</li>
<li>
<p> <tt><span class="emphasis"><em>match_len</em></span> = 0
(not used for regexp op) </tt></p>
</li>
<li>
<p> <tt><span class="emphasis"><em>subst_exp</em></span> =
NULL ; when translation is actually a replacement, this
field must be NULL. </tt></p>
</li>
<li>
<p> <tt><span class="emphasis"><em>repl_exp</em></span> = "5"
; static string to replace the input - whenever this rule
will match, it will return this string as output. </tt></p>
</li>
</ul>
</div>
<tt><br>
So, $avp(dr_id) will contain the "5" string, which can be pushed
to do_routing like:<br>
<br>
$var(id) = $(avp(dr_id){s.int}); # make it int<br>
do_routing("$var(id)");<br>
<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 03/06/2013 08:01 PM, Nick Khamis wrote:
<blockquote
cite="mid:CAGWRaZYEhajHVRgZhnRqfmJ=aZtUbiv+tus9VjHoPwHZ7RnHdw@mail.gmail.com"
type="cite">
<pre wrap="">Hello Bogdan,
Thank you so much for your response. When using the dialplan module to:
1) Translate username/domain. Do you mean using the "match_exp" field?
And splitting up the username and domain using script?
2) How do we extract group ID from the dialplan table?
As I have seen in "Building Telephone Systems", dr is based on
"prefix, caller, time, priority, blacklisting" however, most of the
examples I see use hard code "groupid" (i.e., do_routing("0","1").
This does not work for us because we use dynamic routing as added
security, so hard coding the groupid is not a good idea.
Finally, can we not us "*" as a prefix in dr_rules? An example would
be voicemail that uses "*98".
Thanks in Advance,
Nick.
On 3/4/13, Bogdan-Andrei Iancu <a class="moz-txt-link-rfc2396E" href="mailto:bogdan@opensips.org"><bogdan@opensips.org></a> wrote:
</pre>
<blockquote type="cite">
<pre wrap="">Hi Nick,
if you manually detect the group from script, you need to do :
do_routing("$var(dr_group_id)")
The dr_groups table never had RE support. Was simply string matching. If
you want something dynamic, RE based, I suggest to use first the
dialplan module in order to translate from a username/domain to a group
ID and then drouting module to do the check.
Regards,
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>
On 03/01/2013 08:11 PM, Nick Khamis wrote:
</pre>
<blockquote type="cite">
<pre wrap="">Hello Everyone,
When managing incoming calls, or "!do_routing" function is correctly
denying the route. Reason being it's not possible for us to add all
the users that could call into the "dr_groups" table.
To compensate for this we added the following script hard coding the
"group_id", for requests coming from our DID supplier:
# Access for DID
if($fd=="superdid.com") $var(dr_group_id) = 0;
avp_db_load("$ruri/username", "$avp(dr_group_id)");
if (!is_avp_set("$avp(dr_group_id)")) {
$avp(dr_group_id) = $var(dr_group_id);
}
#---- Dynamic Route Handling ----#
if(!do_routing()) {
xlog("Illlegal Route Attempt From: $fu\n");
send_reply("503", "No rules found matching the URI prefix");
exit;
}
The !do_routing() is rejecting the call even with the hard coded
group_id.
Another question is, I understand that regex has been removed from
dr_groups however,
is there a better way to bring the list of possible domains (users
unkown), to the database.
I saw somewhere that we can use "db_aliases" for this, but would
really appreciate an
example.
Thanks in Advance,
Nick.
_______________________________________________
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>
<pre wrap="">
</pre>
</blockquote>
</blockquote>
</body>
</html>