diff options
author | Stefan Wintermeyer <stefan.wintermeyer@amooma.de> | 2012-12-17 12:01:45 +0100 |
---|---|---|
committer | Stefan Wintermeyer <stefan.wintermeyer@amooma.de> | 2012-12-17 12:01:45 +0100 |
commit | b80bd744ad873f6fc43018bc4bfb90677de167bd (patch) | |
tree | 072c4b0e33d442528555b82c415f5e7a1712b2b0 /misc/freeswitch/scripts/configuration/sip.lua | |
parent | 3e706c2025ecc5523e81ad649639ef2ff75e7bac (diff) |
Start of GS5.
Diffstat (limited to 'misc/freeswitch/scripts/configuration/sip.lua')
-rw-r--r-- | misc/freeswitch/scripts/configuration/sip.lua | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/misc/freeswitch/scripts/configuration/sip.lua b/misc/freeswitch/scripts/configuration/sip.lua new file mode 100644 index 0000000..78143bc --- /dev/null +++ b/misc/freeswitch/scripts/configuration/sip.lua @@ -0,0 +1,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 |