Label Routing
Label Routing is an algorithm that combines Digit Analyzer and the concept of RouteSet. It is implemented as a RoutingScript in Toolpack Gateway. This algorithm allows complex routing rules, as normally available with RoutingScript, but on a very large number of destination numbers.
Concept
The concept behind label routing is quite simple.
- A list of numbers (NPA-NXX) for a specific destination is assigned a RouteSet name. This list can be very large
- i.e., 514201,514202,514203, ... -> "Montreal, Qc"
- The list of routes for the destination is assigned the same RouteSet name. This list usually is limited to the number of network access points (NAP) in the system.
- i.e., Bell, Rogers, Videotron -> "Montreal, Qc"
Note: No matter how many destination numbers lead to a given destination, only a limited list of routes are selected. At this point, complex, yet efficient, routing rules can take place.
Implementation
As previously mentioned, routeset (label) routing is implemented as a RoutingScript. It was written as an optional filter, and can be used in any existing scripts. This filter is a before_filter, and reduces the amount of routes the routing script will work with.
Provisioning
Provisioning of large amounts of Routeset definition and digitmaps is accomplished by importing CSV files using the WebPortal. Those files are being saved in the HA Database.
Routeset Definition
Each NAP in the system must be assigned a routesets_definition CSV file. A routesets_definition file gives the association between NAP and RouteSet names. The association between a NAP and a RouteSet name is in fact a route! ie: Rogers->"Montreal, Qc" Thus, for each RouteSet name<->NAP association, a dynamic route entry gets created.
The routesets_definition file defines a list of RouteSet names, with optional attributes.
- One mandatory column: routeset_name (label)
- Supplementary columns are used to provide optional and custom attributes to dynamically created routes
routeset_name, cost, custom_1 "Montreal, Qc", "0.24", "custom_val"
In the above example, routes are created with custom attributes found in the second and third columns. Each custom attribute must be defined by adding a custom column in the gateway Route table.
The NAP <-> Routeset Definition association is done by setting the NAP dynamic columns named 'routesets_definition'. More than one NAP can point to the same 'routesets_definition' file. This file must be imported in the database using the File Db view in the Toolpack Web Portal.
Digitmap
Each NAP in the system can be assigned a routesets_digitmap CSV file. It is usual that all NAP uses the same routesets_digitmap file. A routesets_digitmap file gives the association between numbers and RouteSet names.
- Three mandatory columns: route_set_name, called and calling
called,calling,routeset_name 403200, ,"Calgary, AB" 514201, ,"Montreal, Qc" 514202, ,"Montreal, Qc" 514203, ,"Montreal, Qc"
The NAP <-> Routeset Digitmap association is done by setting the NAP dynamic columns named 'routesets_digitmap'. This file must be imported in the database using the File Db view in the Toolpack Web Portal.
This implementation was tested with 1 million digitmap entries and the file can be gzipped to reduce size before importing it in the File Db.
Dynamic Routes
When provisioning is complete, dynamic routes can be generated by going in the Routetsets menu item, under Gateway menu Item.
How to setup Label Routing to create dynamic routes
Setting up label routing is simple, since it is using pre-defined scripts, all available from the web portal. It is done in 8 steps:
- Create default routing scripts and activate routeset script
- Create a new file repository (FileDb) for storing the Digitmap and Routeset definition files
- Enable Label Routing script and File Db in Gateway configuration
- Create Digitmap file and add it to the system
- Create Routeset definition file and add it to the system
- Associate NAPs with the Digitmap and Routeset definition files
- Generate Dynamic Routing table
- Activate Configuration
1. Create default routing scripts and activate routeset script
From the Web portal go to
Gateway -> Routing Script -> Create New Script
- Name: Label_Routing
- Select "Create default script files"
- Create
To activate the routeset script:
- Click on "Examples Scripts"
- Edit "routesets_routing.rb"
- Select "Load on Startup"
- Save
You must also deactivate the simple_routing script:
- Click on "Examples Scripts"
- Edit "simple_routing.rb"
- Unselect "Load on Startup"
- Save
It is also possible to add the Label routing to any Routing Scripts this way:
Adding Label Routing to any Script
2. Create a new file repository (FileDb) for storing the Digitmap and Routeset definition files
Gateway -> FileDb -> Create New File Db
- Name: Route_file
- Create
3. Enable Label Routing script and File Db in Gateway configuration
Gateway -> Configurations Use Script -> Label_Routing FileDb -> Route_file
4. Create Digitmap file and add it to the system
The Digitmap file is using CSV format. Create a file with the desired numbers (DIDs) for your system. For example:
called,calling,routeset_name 403200, ,"Calgary, AB" 514201, ,"Montreal, Qc" 514202, ,"Montreal, Qc" 514203, ,"Montreal, Qc"
To add it to the system:
Gateway -> FileDb -> Import New Digitmap
Browse for your file and Import
5. Create Routeset definition file and add it to the system
The Routeset definition file is also using CSV format. Create a file with the desired Labels and optional custom parameters:
routeset_name, prio "Montreal, Qc","2" "Calgary, AB", "3"
To add it to the system:
Gateway -> FileDb -> Import New Digitmap
Browse for your file and Import
6. Associate NAPs with the Digitmap and Routeset definition files
Add the routesets digitmap and Routeset definition NAP dynamic columns
Gateway->Configurations->Naps menu
- Click the 'Create New Nap Column' link
- Name = routesets_digitmap
- Type attributes = dbfile
- Create
- Click the 'Create New Nap Column' link again
- Name = routesets_definition
- Type attributes = dbfile
- Create
Associate the NAPs with the definition files:
- Edit the NAP that will have the association
- Routesets_definition -> Select routeset_definition
- Routesets_digitmap -> Select Digitmap
- Save
7. Generate Dynamic Routing table
Gateway -> Configurations -> Routesets
- Routing Database -> Click on Generate
8. Activate Configuration
Systems -> System_1 (Edit) -> Activate Configuration
Increasing MySql limits
In order to store big digitmap files, the configuration of the MySql server needs to be changed. Edit the following file: On windows:
c:\Program Files\MySQL\MySQL Server 5.1\my.ini
On linux:
/etc/my.cnf
Add the following variable under the [mysqld] section:
max_allowed_packet = 200MB
Also add the following variable under the [mysqldump] section:
max_allowed_packet = 200MB
Then shutdown and restart the MySql service.