summaryrefslogtreecommitdiff
path: root/misc/freeswitch/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'misc/freeswitch/scripts')
-rw-r--r--misc/freeswitch/scripts/common/gateway.lua17
1 files changed, 17 insertions, 0 deletions
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` \