diff options
author | Peter Kozak <spag@golwen.net> | 2013-03-13 11:55:21 -0400 |
---|---|---|
committer | Peter Kozak <spag@golwen.net> | 2013-03-13 11:55:21 -0400 |
commit | ff991ce3d6c999783b8a5d3cae7b8e4635406a83 (patch) | |
tree | e06fc0248cc4a06f9544a5488b84cc5b9d969d4d /app | |
parent | 6a838ff77d6ddc8139a8dfe9d80455032da8d961 (diff) |
routing test method added
Diffstat (limited to 'app')
-rw-r--r-- | app/models/call_route.rb | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/app/models/call_route.rb b/app/models/call_route.rb index 6c54549..590d49b 100644 --- a/app/models/call_route.rb +++ b/app/models/call_route.rb @@ -253,4 +253,20 @@ class CallRoute < ActiveRecord::Base end end + + def self.test_route(table, caller) + arguments = ["'#{table}' table"] + caller.each do |key, value| + arguments << "'#{value}' '#{key}'" + end + + require 'freeswitch_event' + result = FreeswitchAPI.api_result(FreeswitchAPI.api('lua', 'test_route.lua', arguments.join(' '))) + if result.blank? then + return + end + + return JSON.parse(result) + end + end |