Actions

Adding Label Routing to any Routing Script: Difference between revisions

(Created page with '== <br> == Label routing can be implemented in any routing script by following these 3 simple steps: 1. Add a the following line on top of your script file: <pre>require 'route…')
 
No edit summary
 
(11 intermediate revisions by 3 users not shown)
Line 1: Line 1:
== <br> ==
{{DISPLAYTITLE:Adding Label Routing to a Routing Script}}


Label routing can be implemented in any routing script by following these 3 simple steps:
{| class="wikitable"
|-
|rowspan="3"|This article applies to:
|'''Product'''
|'''Version'''
|-
|Tmedia
|2.5, 2.6
|}


1. Add a the following line on top of your script file:
<pre>require 'routesets_digit_analyzer'</pre>
2. Include the module in your routing class:
<pre>class MyRoutingClass &lt; BaseRouting</pre>
1.


<br> '''include RoutesetsDigitAnalyzer'''
'''To implement label routing for any routing script, do the following:'''


1.
1- Click '''Routing script''' in the navigation panel.


<br> ...


1.
[[Image:RoutingScript_0_A.png]]


<br> end


2. Add a before_filter with 'routesets_digit_analyzer' method:
2- '''Edit''' your main script
<pre>before_filter :method =&gt; :routesets_digit_analyzer, :trie_order =&gt; :called</pre>
=== <br>Complete Example ===
<pre>require 'base_routing'
require 'routesets_digit_analyzer'


class MyRoutingClass &lt; BaseRouting
include RoutesetsDigitAnalyzer


before_filter :method =&gt; :routesets_digit_analyzer, :trie_order =&gt; :called
[[Image:RoutingScript_2_A.png]]


route_match :call_field_name =&gt; :called
 
route_match :call_field_name =&gt; :calling
3- Add the following 3 lines to the script:
route_match :call_field_name =&gt; :nap
 
route_match :method =&gt; :match_nap_availability
'''At the top of the page'''
route_remap :call_field_name =&gt; :called, :route_field_name =&gt; :remapped_called
require 'routesets_digit_analyzer'
route_remap :call_field_name =&gt; :calling, :route_field_name =&gt; :remapped_calling
 
route_remap :call_field_name =&gt; :nap, :route_field_name =&gt; :remapped_nap
 
'''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
end
</pre>


</pre>
== Related Action ==
<br>
[[How_to_Setup_Filters|How to Setup Filters]]

Latest revision as of 10:31, 13 June 2022


This article applies to: Product Version
Tmedia 2.5, 2.6


To implement label routing for any routing script, do the following:

1- Click Routing script in the navigation panel.



2- Edit your main script



3- Add the following 3 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


Related Action

How to Setup Filters