Adding Label Routing to any Routing Script

From TBwiki
(Difference between revisions)
Jump to: navigation, search
(Added filter ruby filenames)
(Applies to version(s): v2.5, v2.6.)
 
(5 intermediate revisions by 3 users not shown)
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:  
+
<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 to 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&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
 
include RoutesetsDigitAnalyzer
 
  
before_filter&nbsp;:method =&gt;&nbsp;:routesets_digit_analyzer,&nbsp;:trie_order =&gt;&nbsp;:called
+
[[Image:RoutingScript_2_A.png]]
  
route_match&nbsp;:call_field_name =&gt;&nbsp;:called
+
 
route_match&nbsp;:call_field_name =&gt;&nbsp;:calling
+
3- Add the 3 following lines to the script:  
route_match&nbsp;:call_field_name =&gt;&nbsp;:nap
+
 
route_match&nbsp;:method =&gt;&nbsp;:match_nap_availability
+
'''At the top of the page'''
route_remap&nbsp;:call_field_name =&gt;&nbsp;:called,&nbsp;:route_field_name =&gt;&nbsp;:remapped_called
+
require 'routesets_digit_analyzer'
route_remap&nbsp;:call_field_name =&gt;&nbsp;:calling,&nbsp;:route_field_name =&gt;&nbsp;:remapped_calling
+
'''Following your main class definition'''
route_remap&nbsp;:call_field_name =&gt;&nbsp;:nap,&nbsp;:route_field_name =&gt;&nbsp;:remapped_nap
+
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
 
end
  
</pre>
+
@@routing = my_script.new
<br> Note: Other filter scripts can be added to the standard scripts to add flexibility in the routing. <br>
+
  
For example:<br>  
+
def init_routes( routes )
 +
  @@routing.init routes
 +
end
 +
 
 +
def route( call, nap_list )
 +
  @@routing.route call, nap_list
 +
end
 +
</pre>  
  
*'''Request-URI routing (ruri.rb):''' Will route the call on SIP RURI instead of the to: field<br>
 
*'''Modify the Nature of Address (noa_npi_remap.rb):''' We can use this to change the NOA to national or international<br>
 
*'''Remove Loop (FilterRemoveLoop.rb): '''Will prevent calls from being routed back to the sender<br>
 
*'''Remove Display IE (RemoveDisplayIE.rb): '''Removes the DISPLAY Information Element from outgoing ISDN/SS7 calls. ''Note: This is not needed with release 2.5.116+. There is option "Send display IE" in the profiles to send this or not.''<br>
 
  
These filters can be merged in the same routing script. Please contact support for more details
+
== 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.


RoutingScript 0 A.png


2- Edit your main script


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

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

Personal tools