summaryrefslogtreecommitdiff
path: root/app/models/call_route.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/call_route.rb')
-rw-r--r--app/models/call_route.rb16
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