summaryrefslogtreecommitdiff
path: root/misc/freeswitch/scripts/configuration/sip.lua
blob: 6f5b204884697e607bf8ba1f0ef21fca4874f7b7 (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
-- Gemeinschaft 5 module: sip configuration class
-- (c) AMOOMA GmbH 2012-2013
-- 

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

-- 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