# # Script version 1.1 # # Version history: # 1.1 (start of version history tracking) # require 'base_routing' require 'called_pre_remap_and_ruri' # This script routes calls in the most simple fashion. The behavior is the same as routing without ruby scripts # with the addition of nap availability. # # Routing is in the following order: # # * Matching: BaseRouting.route_match # * :call_field_name => :called - Match the called number of the call to a route. # * :call_field_name => :calling - Match the calling number of the call to a route. # * :call_field_name => :nap - Match the nap of the call to a route. # * :method => :match_nap_availability - Match the call to a route using BaseRouting.match_nap_availability. # * Remapping: BaseRouting.route_remap # * :call_field_name => :called, :route_field_name => :remapped_called - Remap the called # number for the outgoing call. # * :call_field_name => :calling, :route_field_name => :remapped_calling - Remap the calling # number for the outgoing call. # * :call_field_name => :nap, :route_field_name => :remapped_nap - Remap the nap for the outgoing call. # This means setting the destination nap for the route. # class SimpleRouting < BaseRouting include CalledPreRemapAndRuri before_filter :method => :called_pre_remap_and_ruri 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 @@routing = SimpleRouting.new def init_routes( routes ) @@routing.init routes end def route( call, nap_list ) @@routing.route call, nap_list end