diff options
author | Peter Kozak <spag@golwen.net> | 2013-03-15 08:43:29 -0400 |
---|---|---|
committer | Peter Kozak <spag@golwen.net> | 2013-03-15 08:43:29 -0400 |
commit | 5fdcf4e66f1b9d926ace0ab4a78db177b7487ad6 (patch) | |
tree | db113cd87959aaed15751616b06309c7156af744 /app/controllers/call_routes_controller.rb | |
parent | 5f909eb79791c7ab232a8693712cce2583a6ee0b (diff) |
test action
Diffstat (limited to 'app/controllers/call_routes_controller.rb')
-rw-r--r-- | app/controllers/call_routes_controller.rb | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/app/controllers/call_routes_controller.rb b/app/controllers/call_routes_controller.rb index 50e7849..819b593 100644 --- a/app/controllers/call_routes_controller.rb +++ b/app/controllers/call_routes_controller.rb @@ -88,10 +88,17 @@ class CallRoutesController < ApplicationController end def test - sip_account = SipAccount.where(:id => params[:sip_account_id]).first; - destination_number = params[:destination_number] - routing_table = params[:routing_table] - @route_test = CallRoute.test_route(routing_table, {'caller.destination_number' => destination_number, 'caller.auth_account_type' => 'SipAccount', 'caller.auth_account_uuid' => sip_account.uuid}) + if !params[:sip_account_id].blank? + account = SipAccount.where(:id => params[:sip_account_id]).first + elsif !params[:hunt_group_id].blank? + account = HuntGroup.where(:id => params[:hunt_group_id]).first + end + + if account + destination_number = params[:destination_number] + routing_table = params[:routing_table] + @route_test = CallRoute.test_route(routing_table, {'caller.destination_number' => destination_number, 'caller.auth_account_type' => account.class.name, 'caller.auth_account_id' => account.id, 'caller.auth_account_uuid' => account.try(:uuid)}) + end end private |