Hi Nick,

if you want to select the routing group based on caller domain, simply do:
        do_translate("1","$fd/$avp(dr_id)");

So, the input for dialplan is $fd (domain from FROM hdr) and output is in $avp(dr_id) .
In DB put :

   *

     /match-op/ = 1 (regexp)

   *

     /match_exp/ = "^(.*)\.opensips\.com$" ; regular expresion that
     will be used to match with this rule (if the rule should be
     applied for the input string)

   *

     /match_len/ = 0 (not used for regexp op)

   *

     /subst_exp/ = NULL ; when translation is actually a replacement,
     this field must be NULL.

   *

     /repl_exp/ = "5" ; static string to replace the input - whenever
     this rule will match, it will return this string as output.


So, $avp(dr_id) will contain the "5" string, which can be pushed to do_routing like:

$var(id) = $(avp(dr_id){s.int}); # make it int
do_routing("$var(id)");


Regards,

Bogdan-Andrei Iancu
OpenSIPS Founder and Developer
http://www.opensips-solutions.com


On 03/06/2013 08:01 PM, Nick Khamis wrote:
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<[email protected]>  wrote:
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
http://www.opensips-solutions.com


On 03/01/2013 08:11 PM, Nick Khamis wrote:
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
[email protected]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users

_______________________________________________
Users mailing list
[email protected]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users

Reply via email to