blob: 78143bcad8cb9162c645fcb82de5b94a04c0d116 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
-- Gemeinschaft 5 module: sip configuration class
-- (c) AMOOMA GmbH 2012
--
module(...,package.seeall)
Sip = {}
-- create sip configuration object
function Sip.new(self, arg)
arg = arg or {}
object = arg.object or {}
setmetatable(object, self);
self.__index = self;
self.log = arg.log;
self.database = arg.database;
self.record = arg.record;
return object;
end
-- find gateway by name
function Sip.find_gateway_by_name(self, name)
require 'common.configuration_file'
return common.configuration_file.get('/opt/freeswitch/scripts/ini/gateways.ini', name);
end
-- list sip domains
function Sip.domains(self)
local sql_query = 'SELECT * FROM `sip_domains`';
local sip_domains = {}
self.database:query(sql_query, function(sip_domain)
table.insert(sip_domains, sip_domain);
end)
return sip_domains;
end
|