Scriptable Routing Engine

Toolpack v2.3 introduces a scriptable routing engine that complements the existing approach to building call routes. This new approach is based on the Ruby programming language, which offers a high-level, natural language-like approach to programming known as scripting. With Ruby, no code compilation is required to use routing scripts; in fact, you write scripts within your web browser. A high-level overview of how to write scripts is available upon request by contacting the TelcoBridges support team.

As part of the initial release, TelcoBridges is providing a number of ready-to-use scripts such as percentage routing, round-robin routing, least-cost routing, SIP trunking, PRI reselling with over-subscription, and others. Additional scripts will be made available as we go forward. This new approach is meant to supplement the current approach to building routes. It should also make it possible for your service provider customers, once properly trained by you, to modify routing tables on their own.


There is no additional software required to use the scriptable routing engine. All necessary software is installed by the Toolpack installer application. While the Ruby language is natural language-like and easily approachable, some understanding of programming or Ruby is required in order to modify existing scripts. The Ruby scripts provided with Toolpack essentially consist of a series of mini scripts or sub-scripts (akin to classes in C++); therefore creating a script from scratch does require more experience. Please see the Ruby site for additional information on Ruby. That site features a helpful tutorial called “Ruby in 20 minutes”. There is also a section called “Ruby from Other Languages” which will help you understand Ruby if your frame of reference is C++, Java, or a scripting language such as Perl, PHP, or Python.

The Toolpack scriptable routing engine is based on the 1.8.x branch of Ruby.

Routing Scripts overview

The Scriptable Routing Engine, for every incoming call leg, takes a routing decision thatindicates how the outgoing call leg will be created. The script will match one or multiple routes based on information from the incoming call leg

  • calling number
  • called number
  • NAP (Networks Access Point)
  • Other incoming parameters as described here: Script parameters

Each route determines NAP to use to make outgoing call, and may modify some of the call parameters:

  • calling number
  • called number
  • nature of address
  • numbering plan
  • calling presentation
  • etc.

Multiple routes can match a given incoming call, in which case routes can be sorted using various criteria:

  • round robin
  • least cost
  • availability percent
  • etc.

An outgoing call is made based on the first matching route. If this call fails with that route (maximum capacity reached, network or protocol error), another outgoing call attempt is made using the next matching route. Note: This Route retry feature is available only in Toolpack version 2.5 and up.

Routing script Examples

TelcoBridges provide a wide variety of routing script examples which customers can apply directly in their web configuration according to their needs by following just a few simple steps.

Tutorial guide

To learn how to use the Scriptable Routing Engine, click the following link to go to the Routing Script Tutorial.

Mini development guide

To learn about the parameters available in for each object go read the Routing Script Mini Development Guide.

Testing this feature

To test this feature, you will want to modify some of the provided scripts by changing variables such as route costing or NAP targets.

Known limitations

The following are known limitations with the Scriptable Routing Engine as of version 2.5:

  • Scripts (including script sub-components provided by TelcoBridges) are not modified when Toolpack is upgraded to new version (for example, to the release version of v2.3.0, v2.3.1, etc.). This means that if there is an update of the basic script, you will need to manually update any existing scripts.
  • If you are using dynamic fields (using the Creating New Route Column or the Create New Nap Column option) with routing scripts and you plan to use NAP names, those NAP names need to be all capital letters (i.e.: not just the first letter needs to be capitalized.)

Updating routing scripts

  • Re-create a new set of default routing script:
    • Click "Routing scripts" tab on the left menu of the web portal
    • Click "list" link near the top of the page
    • Click "Create new script" link near the top of the page
    • Assign a new meaningful name (like "scripts_2013_05_22")
    • Make sure "Create default script files" is selected
  • Import your own script files into that new routing script
    • Making the default "simple_routing.rb" not loading on startup
    • Using "Create New Script File" to re-create all your script files
    • Editing example or filter scripts to which you had made modifications
  • Activate your new script
    • Click "Gateway" configuration tab on the left menu
    • Select your new script in the "Use script" popup menu of that page

Useful links