Actions

Adding Label Routing to any Routing Script: Difference between revisions

No edit summary
(re-format article)
Line 10: Line 10:




2- Select the script that you wish to edit.
2- '''Edit''' your main script
 
 
[[Image:RoutingScript_1_A.png]]
 
 
The '''Script Editing''' Window is displayed.




Line 22: Line 16:




3- Add the following line at the very beginning of the script file:  
3- Add the 3 following lines in your script:  


<pre>require 'routesets_digit_analyzer'</pre>  
'''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- Include the module in your routing class:
4- Click 'Save'


<pre>class MyRoutingClass &lt; BaseRouting</pre>
== Example  ==
1.
<pre>
require 'base_routing'
require 'routesets_digit_analyzer'                                                # <- Add this line here


<br> '''include RoutesetsDigitAnalyzer'''
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


1.  
@@routing = my_script.new


<br> ...
def init_routes( routes )
 
  @@routing.init routes
1.  
end
 
<br> end  
 
5- Add a before_filter with 'routesets_digit_analyzer' method: 
 
<pre>before_filter&nbsp;:method =&gt;&nbsp;:routesets_digit_analyzer,&nbsp;:trie_order =&gt;&nbsp;:called</pre>
=== <br>Complete Example  ===
<pre>require 'base_routing'
require 'routesets_digit_analyzer'


class MyRoutingClass &lt; BaseRouting
def route( call, nap_list )
include RoutesetsDigitAnalyzer
  @@routing.route call, nap_list
 
before_filter&nbsp;:method =&gt;&nbsp;:routesets_digit_analyzer,&nbsp;:trie_order =&gt;&nbsp;:called
 
route_match&nbsp;:call_field_name =&gt;&nbsp;:called
route_match&nbsp;:call_field_name =&gt;&nbsp;:calling
route_match&nbsp;:call_field_name =&gt;&nbsp;:nap
route_match&nbsp;:method =&gt;&nbsp;:match_nap_availability
route_remap&nbsp;:call_field_name =&gt;&nbsp;:called,&nbsp;:route_field_name =&gt;&nbsp;:remapped_called
route_remap&nbsp;:call_field_name =&gt;&nbsp;:calling,&nbsp;:route_field_name =&gt;&nbsp;:remapped_calling
route_remap&nbsp;:call_field_name =&gt;&nbsp;:nap,&nbsp;:route_field_name =&gt;&nbsp;:remapped_nap
end
end
</pre>


</pre>
== Related Action ==
<br> Note: Other filter scripts can be added to the standard scripts to add further flexibility to the routing. For furtehr information, consult  [[How_to_Setup_Filters|How to Setup Filters]].<br>
[[How_to_Setup_Filters|How to Setup Filters]]

Revision as of 12:18, 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 in your 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