From 0236ddcd35479936b3bb24f74826f0001eee2828 Mon Sep 17 00:00:00 2001 From: spag Date: Fri, 25 Jan 2013 17:22:08 +0100 Subject: call_url method added --- misc/freeswitch/scripts/common/gateway.lua | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'misc/freeswitch/scripts/common') diff --git a/misc/freeswitch/scripts/common/gateway.lua b/misc/freeswitch/scripts/common/gateway.lua index e50c763..1b3b832 100644 --- a/misc/freeswitch/scripts/common/gateway.lua +++ b/misc/freeswitch/scripts/common/gateway.lua @@ -38,10 +38,14 @@ function Gateway.find_by_id(self, id) local gateway = nil; self.database:query(sql_query, function(entry) + require 'common.str'; gateway = Gateway:new(self); gateway.record = entry; gateway.id = tonumber(entry.id); gateway.name = entry.name; + gateway.technology = entry.technology; + gateway.outbound = common.str.to_b(entry.outbound); + gateway.inbound = common.str.to_b(entry.inbound); end) if gateway then @@ -59,10 +63,14 @@ function Gateway.find_by_name(self, name) local gateway = nil; self.database:query(sql_query, function(entry) + require 'common.str'; gateway = Gateway:new(self); gateway.record = entry; gateway.id = tonumber(entry.id); gateway.name = entry.name; + gateway.technology = entry.technology; + gateway.outbound = common.str.to_b(entry.outbound); + gateway.inbound = common.str.to_b(entry.inbound); end) if gateway then @@ -73,6 +81,15 @@ function Gateway.find_by_name(self, name) end +function Gateway.call_url(self, destination_number) + if self.technology == 'sip' then + return 'sofia/gateway/' .. self.GATEWAY_PREFIX .. self.id .. '/' .. tostring(destination_number); + end + + return ''; +end + + function Gateway.authenticate(self, technology, caller) local sql_query = 'SELECT `c`.`name`, `c`.`id`, `a`.`value` `auth_source`, `b`.`value` `auth_pattern` \ FROM `gateway_settings` `a` \ -- cgit v1.2.3