Adding Label Routing to any Routing Script

From TBwiki
(Difference between revisions)
Jump to: navigation, search
(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…')
 
Line 1: Line 1:
== <br> ==
+
Label routing can be implemented in any routing script by following these 3 simple steps:
  
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 'routesets_digit_analyzer'</pre>
 +
2. Include the module in your routing class:  
 +
<pre>class MyRoutingClass &lt; BaseRouting</pre>
 +
1.
  
1. Add a the following line on top of your script file:
+
<br> '''include RoutesetsDigitAnalyzer'''
<pre>require 'routesets_digit_analyzer'</pre>
+
2. Include the module in your routing class:
+
<pre>class MyRoutingClass &lt; BaseRouting</pre>
+
1.
+
  
<br> '''include RoutesetsDigitAnalyzer'''
+
1.
  
1.
+
<br> ...  
  
<br> ...
+
1.  
  
1.
+
<br> end
  
<br> end
+
2. 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>  
2. Add a before_filter with 'routesets_digit_analyzer' method:
+
=== <br>Complete Example ===
<pre>before_filter :method =&gt; :routesets_digit_analyzer, :trie_order =&gt; :called</pre>
+
=== <br>Complete Example ===
+
 
<pre>require 'base_routing'
 
<pre>require 'base_routing'
 
require 'routesets_digit_analyzer'
 
require 'routesets_digit_analyzer'
Line 28: Line 26:
 
include RoutesetsDigitAnalyzer
 
include RoutesetsDigitAnalyzer
  
before_filter :method =&gt; :routesets_digit_analyzer, :trie_order =&gt; :called
+
before_filter&nbsp;:method =&gt;&nbsp;:routesets_digit_analyzer,&nbsp;:trie_order =&gt;&nbsp;:called
  
route_match :call_field_name =&gt; :called
+
route_match&nbsp;:call_field_name =&gt;&nbsp;:called
route_match :call_field_name =&gt; :calling
+
route_match&nbsp;:call_field_name =&gt;&nbsp;:calling
route_match :call_field_name =&gt; :nap
+
route_match&nbsp;:call_field_name =&gt;&nbsp;:nap
route_match :method =&gt; :match_nap_availability
+
route_match&nbsp;:method =&gt;&nbsp;:match_nap_availability
route_remap :call_field_name =&gt; :called, :route_field_name =&gt; :remapped_called
+
route_remap&nbsp;:call_field_name =&gt;&nbsp;:called,&nbsp;:route_field_name =&gt;&nbsp;:remapped_called
route_remap :call_field_name =&gt; :calling, :route_field_name =&gt; :remapped_calling
+
route_remap&nbsp;:call_field_name =&gt;&nbsp;:calling,&nbsp;:route_field_name =&gt;&nbsp;:remapped_calling
route_remap :call_field_name =&gt; :nap, :route_field_name =&gt; :remapped_nap
+
route_remap&nbsp;:call_field_name =&gt;&nbsp;:nap,&nbsp;:route_field_name =&gt;&nbsp;:remapped_nap
 
end
 
end
  
</pre>
+
</pre>  
 
<br>
 
<br>

Revision as of 12:35, 31 March 2011

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:

require 'routesets_digit_analyzer'

2. Include the module in your routing class:

class MyRoutingClass < BaseRouting

1.


include RoutesetsDigitAnalyzer

1.


...

1.


end

2. 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


Personal tools