summaryrefslogtreecommitdiff
path: root/misc
diff options
context:
space:
mode:
authorspag <spag@golwen.net>2013-01-25 17:22:08 +0100
committerspag <spag@golwen.net>2013-01-25 17:22:08 +0100
commit0236ddcd35479936b3bb24f74826f0001eee2828 (patch)
treea556ccf9e5571546192d243803ab18183a2221fe /misc
parent25c8fd5f00df857c24ce61b0290f67fb5006ffb2 (diff)
call_url method added
Diffstat (limited to 'misc')
-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` \