summaryrefslogtreecommitdiff
path: root/app/controllers/call_routes_controller.rb
diff options
context:
space:
mode:
authorStefan Wintermeyer <stefan.wintermeyer@amooma.de>2013-03-25 10:27:27 +0100
committerStefan Wintermeyer <stefan.wintermeyer@amooma.de>2013-03-25 10:27:27 +0100
commitdf6e17e48995f25e72509986f30700d778b179b6 (patch)
treef432c24b8e4ad81009188650dabfd99194883265 /app/controllers/call_routes_controller.rb
parent11f186a118285fbc87a536af26730780a9ad01f5 (diff)
parentcce94a74aa5c9691f9b37cd9be5a6831f8063812 (diff)
Merge branch 'develop'5.1.2
Diffstat (limited to 'app/controllers/call_routes_controller.rb')
-rw-r--r--app/controllers/call_routes_controller.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/app/controllers/call_routes_controller.rb b/app/controllers/call_routes_controller.rb
index 2dcd648..e5cf56a 100644
--- a/app/controllers/call_routes_controller.rb
+++ b/app/controllers/call_routes_controller.rb
@@ -87,6 +87,28 @@ class CallRoutesController < ApplicationController
end
end
+ def test
+ 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),
+ 'caller.account_type' => account.class.name,
+ 'caller.account_id' => account.id,
+ 'caller.account_uuid' => account.try(:uuid),
+ })
+ end
+ end
+
private
def call_route_parameter_params
params.require(:call_route).permit(:routing_table, :name, :endpoint_type, :endpoint_id, :position)