Actions

Adding Label Routing to any Routing Script: Difference between revisions

(Moved the examples of filters in "How to setup filters")
No edit summary
Line 1: Line 1:
Label routing can be implemented in any routing script by following these 3 simple steps:  
=== '''''Applies to version(s): v2.5, v2.6.''''' ===
<pre>Gateway -&gt; Routing Script -&gt; YourScript.rb (Edit)
{{DISPLAYTITLE:Adding Label Routing to a Routing Script}}
</pre>
 
1. Add a the following line on top of your script file:  
'''To implement label routing to any routing script, do the following:'''
 
1- Click '''Routing script''' in the navigation panel.
 
 
[[Image:RoutingScript_0_A.png]]
 
 
2- Select the script that you wish to edit.
 
 
[[Image:RoutingScript_1_A.png]]
 
 
The '''Script Editing''' Window is displayed.
 
 
[[Image:RoutingScript_2_A.png]]
 
 
3- Add the following line at the very beginning of the script file:  
 
<pre>require 'routesets_digit_analyzer'</pre>  
<pre>require 'routesets_digit_analyzer'</pre>  
2. Include the module in your routing class:  
 
4- Include the module in your routing class:  
 
<pre>class MyRoutingClass &lt; BaseRouting</pre>  
<pre>class MyRoutingClass &lt; BaseRouting</pre>  
1.  
1.  


<br> '''include RoutesetsDigitAnalyzer'''  
<br> '''include RoutesetsDigitAnalyzer'''  


1.  
1.  


<br> ...  
<br> ...  


1.  
1.  


<br> end  
<br> end  


2. Add a before_filter with 'routesets_digit_analyzer' method:  
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>  
<pre>before_filter&nbsp;:method =&gt;&nbsp;:routesets_digit_analyzer,&nbsp;:trie_order =&gt;&nbsp;:called</pre>  
=== <br>Complete Example  ===
=== <br>Complete Example  ===
Line 39: Line 63:


</pre>  
</pre>  
<br> Note: Other filter scripts can be added to the standard scripts to add flexibility in the routing. Please check [[How_to_Setup_Filters|How to Setup Filters]].<br>
<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>

Revision as of 13:47, 3 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- Select the script that you wish to edit.



The Script Editing Window is displayed.



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

require 'routesets_digit_analyzer'

4- Include the module in your routing class:

class MyRoutingClass < BaseRouting
1. 


include RoutesetsDigitAnalyzer

1. 


...

1. 


end

5- Add a before_filter with 'routesets_digit_analyzer' method:

before_filter :method => :routesets_digit_analyzer, :trie_order => :called


Complete Example

require 'base_routing'
require 'routesets_digit_analyzer'

class MyRoutingClass < BaseRouting
include RoutesetsDigitAnalyzer

before_filter :method => :routesets_digit_analyzer, :trie_order => :called

route_match :call_field_name => :called
route_match :call_field_name => :calling
route_match :call_field_name => :nap
route_match :method => :match_nap_availability
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


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.