How to Setup Filters
Filter Scripts are routing scripts that can be added to any other script. It modifies the behavior of the main script. For example, it can do a remapping of the incoming called number to make it uniform (i.e. Remove the international code). It can also make sure there is no loop (do not route the call back to the incoming Network).
Setting up Filter Scripts
To setup a Filter, the main script needs to be modified. The main script can be either simple_routing.rb, or any other script.
First, go to the routing script section of the Web portal
Gateway -> Routing scripts -> Example Scripts -> simple_routing.rb [Edit]
Three things need to be added. At the start of the script:
require '[filter_ruby_filename]'
In the main class:
include [module_name]
and
before_filter :method => :[method_name]
or
after_filter :method => :[method_name]
For example, the nap_group_weight_load_balancer.rb script would require this to be added to the main script:
require 'nap_group_weight_load_balancer' class PercentageRouting < BaseRouting include NapGroupAndWeightLoadBalancer after_filter :method => :filter_by_group_and_weight
To find the module_name and method, you need to look in the routing script itself:
Gateway -> Routing Scripts -> Filters Scripts -> nap_group_weight_load_balancer.rb [Edit]
Then look for the <Module> tag and the <def> tag for the main class
Filter Scripts examples:
- Request-URI routing (ruri.rb): Will route the call on SIP RURI instead of the to: field
- Modify the Nature of Address (noa_npi_remap.rb): We can use this to change the NOA to national or international
- Remove Loop (FilterRemoveLoop.rb): Will prevent calls from being routed back to the sender
- Load Balance on NAP groups or on route groups (nap_group_weight_load_balancer.rb): This is a powerful script that allows to regroup NAPs of the same kind, distribute load among them and prioritize one group versus another. Alternatively, you can do the same on routes. You need to add two columns to the NAPs (or the routes), one called "group" and one called "weight". Groups of lower value will have a higher priority (group=0 has more priority than group=10). The calls will be distributed according to the weight value. To have an equal number of calls on each destination, use the same weight value (weight=10).
- Remove Display IE (RemoveDisplayIE.rb): Removes the DISPLAY Information Element from outgoing ISDN/SS7 calls. Note: This is not needed with release 2.5.116+. There is option "Send display IE" in the profiles to send this or not.
One example is the Label Routing. Check here: Adding Label Routing to any Routing Script
These filters can be merged in the same routing script. Please contact support for more details.