Adding Label Routing to any Routing Script
From TBwiki
(Difference between revisions)
(Added "other filter scripts" examples) |
(→Applies to version(s): v2.5, v2.6.) |
||
(6 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
− | + | === '''''Applies to version(s): v2.5, v2.6.''''' === | |
− | + | {{DISPLAYTITLE:Adding Label Routing to a Routing Script}} | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | '''To implement label routing to any routing script, do the following:''' | |
− | 1. | + | 1- Click '''Routing script''' in the navigation panel. |
− | |||
− | + | [[Image:RoutingScript_0_A.png]] | |
− | |||
− | 2 | + | 2- '''Edit''' your main script |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | |||
− | |||
− | + | [[Image:RoutingScript_2_A.png]] | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | + | 3- Add the 3 following lines to the script: | |
− | + | ||
− | + | '''At the top of the page''' | |
+ | require 'routesets_digit_analyzer' | ||
+ | '''Following your main class definition''' | ||
+ | include RoutesetsDigitAnalyzer | ||
+ | '''Add before filter in your main class''' | ||
+ | before_filter :method => :routesets_digit_analyzer, :trie_order => :called | ||
− | |||
− | - '' | + | 4- Click 'Save' |
− | + | == Example == | |
+ | <pre> | ||
+ | require 'base_routing' | ||
+ | require 'routesets_digit_analyzer' # <- Add this line here | ||
− | - | + | class my_script < BaseRouting |
+ | include RoutesetsDigitAnalyzer # <- Add this line here | ||
+ | |||
+ | before_filter :method => :routesets_digit_analyzer, :trie_order => :called # <- Add this line here | ||
+ | route_match :call_field_name => :called | ||
+ | route_match :call_field_name => :calling | ||
+ | route_match :call_field_name => :nap | ||
+ | route_remap :call_field_name => :called, :route_field_name => :remapped_called | ||
+ | route_remap :call_field_name => :calling, :route_field_name => :remapped_calling | ||
+ | route_remap :call_field_name => :nap, :route_field_name => :remapped_nap | ||
+ | end | ||
+ | |||
+ | @@routing = my_script.new | ||
+ | |||
+ | def init_routes( routes ) | ||
+ | @@routing.init routes | ||
+ | end | ||
+ | |||
+ | def route( call, nap_list ) | ||
+ | @@routing.route call, nap_list | ||
+ | end | ||
+ | </pre> | ||
− | |||
− | + | == Related Action == | |
+ | [[How_to_Setup_Filters|How to Setup Filters]] |
Latest revision as of 14:48, 5 November 2012
Applies to version(s): v2.5, v2.6.
To implement label routing to any routing script, do the following:
1- Click Routing script in the navigation panel.
2- Edit your main script
3- Add the 3 following lines to the script:
At the top of the page
require 'routesets_digit_analyzer'
Following your main class definition
include RoutesetsDigitAnalyzer
Add before filter in your main class
before_filter :method => :routesets_digit_analyzer, :trie_order => :called
4- Click 'Save'
Example
require 'base_routing' require 'routesets_digit_analyzer' # <- Add this line here class my_script < BaseRouting include RoutesetsDigitAnalyzer # <- Add this line here before_filter :method => :routesets_digit_analyzer, :trie_order => :called # <- Add this line here route_match :call_field_name => :called route_match :call_field_name => :calling route_match :call_field_name => :nap route_remap :call_field_name => :called, :route_field_name => :remapped_called route_remap :call_field_name => :calling, :route_field_name => :remapped_calling route_remap :call_field_name => :nap, :route_field_name => :remapped_nap end @@routing = my_script.new def init_routes( routes ) @@routing.init routes end def route( call, nap_list ) @@routing.route call, nap_list end