summaryrefslogtreecommitdiffstats
path: root/config
diff options
context:
space:
mode:
authorSeung Soo Mun <hamletmun@gmail.com>2015-06-07 22:17:42 +0000
committerTed Trask <ttrask01@yahoo.com>2015-06-08 11:17:01 -0400
commitfc2453e74aabeda50f034f3323118d1546e49909 (patch)
tree85893139d77ed56e3bed795aef2cbdc6138c403a /config
parent48a68193bbe71a28fc61dfeab364637c4a1ccf2b (diff)
downloadacf-provisioning-fc2453e74aabeda50f034f3323118d1546e49909.tar.bz2
acf-provisioning-fc2453e74aabeda50f034f3323118d1546e49909.tar.xz
new devices for acf-provisioning: algo, cyberdata, grandstream
Signed-off-by: Ted Trask <ttrask01@yahoo.com>
Diffstat (limited to 'config')
-rw-r--r--config/templates/algo8180-template.lua49
-rw-r--r--config/templates/cyberdata-template.lua37
-rw-r--r--config/templates/grandstream-template.lua39
3 files changed, 125 insertions, 0 deletions
diff --git a/config/templates/algo8180-template.lua b/config/templates/algo8180-template.lua
new file mode 100644
index 0000000..1b32678
--- /dev/null
+++ b/config/templates/algo8180-template.lua
@@ -0,0 +1,49 @@
+<%
+-- Algo 8180 SIP Audio Alerter Configuration File Template
+local values = ...
+
+local function yesno ( bool )
+ if bool then
+ return "Yes"
+ else
+ return "No"
+ end
+end
+
+local function set_elem(elem,value,i)
+ local e = elem
+ if i then e = elem.."_"..tostring(i).."_" end
+ local output = {e.." = "}
+ if type(value) == "boolean" then
+ output[#output+1] = yesno(value)
+ elseif value then
+ output[#output+1] = value
+ end
+ io.write(table.concat(output).."\n")
+end
+%>
+
+<%in /var/www/provisioning/htdocs/Algo/init.cfg %>
+
+<%
+set_elem("admin.pwd", values.device.adminpassword)
+set_elem("net.time", values.device.sntpserver)
+set_elem("sip.proxy", values.device.registrar)
+for pg, pg_t in pairs(values) do
+ -- Is it of the form regX ?
+ local num = string.match(pg, 'reg(%d+)')
+ if tostring(num) < "6" then
+ if pg_t.extension ~= "" then
+ set_elem("sip.alert"..num..".auth", pg_t.extension)
+ set_elem("sip.alert"..num..".pwd", pg_t.password)
+ set_elem("sip.alert"..num..".user", pg_t.extension)
+ end
+ elseif num == "6" then
+ if pg_t.extension ~= "" then
+ set_elem("sip.u1.auth", pg_t.extension)
+ set_elem("sip.u1.pwd", pg_t.password)
+ set_elem("sip.u1.user", pg_t.extension)
+ end
+ end
+end
+%>
diff --git a/config/templates/cyberdata-template.lua b/config/templates/cyberdata-template.lua
new file mode 100644
index 0000000..e05bdd9
--- /dev/null
+++ b/config/templates/cyberdata-template.lua
@@ -0,0 +1,37 @@
+<%
+-- CyberData Intercom Configuration File Template
+local values = ...
+
+require 'LuaXml'
+local init_cfg = xml.load("/var/www/provisioning/htdocs/CyberData/init.cfg")
+
+-- <IPSettings>
+
+-- <SIPSettings>
+
+for pg, pg_t in pairs(values) do
+ -- Is it of the form regX ?
+ local num = string.match(pg, 'reg(%d+)')
+ if num then
+ if pg_t.extension ~= "" then
+ init_cfg[2]:append("SIPServer")[1] = values.device.registrar
+ init_cfg[2]:append("SIPUserID")[1] = pg_t.extension
+ init_cfg[2]:append("SIPAuthID")[1] = pg_t.extension
+ init_cfg[2]:append("SIPAuthPassword")[1] = pg_t.password
+ init_cfg[2]:append("DialoutExtension0")[1] = pg_t.hotlinedestination
+ init_cfg[2]:append("DialoutID0")[1] = pg_t.callerid
+ end
+ end
+end
+
+
+-- <ClockSettings>
+
+init_cfg[3]:append("NTPServer")[1] = values.device.sntpserver
+init_cfg[3]:append("NTPTimezone")[1] = values.device.timezone
+
+-- init_cfg:save("TEST-cyberdata.xml")
+
+print("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n")
+print(init_cfg)
+%>
diff --git a/config/templates/grandstream-template.lua b/config/templates/grandstream-template.lua
new file mode 100644
index 0000000..cf1e95e
--- /dev/null
+++ b/config/templates/grandstream-template.lua
@@ -0,0 +1,39 @@
+<%
+-- Grandstream Configuration File Template
+local values = ...
+
+require 'LuaXml'
+local init_cfg = xml.load("/var/www/provisioning/htdocs/Grandstream/init.cfg")
+
+-- <config>
+init_cfg[1]:append("P2")[1] = values.device.adminpassword
+init_cfg[1]:append("P30")[1] = values.device.sntpserver
+init_cfg[1]:append("P246")[1] = values.device.timezone
+
+for pg, pg_t in pairs(values) do
+ -- Is it of the form regX ?
+ local num = string.match(pg, 'reg(%d+)')
+ if num == "1" then
+ if pg_t.extension ~= "" then
+ init_cfg[1]:append("P47")[1] = values.device.registrar
+ init_cfg[1]:append("P35")[1] = pg_t.extension
+ init_cfg[1]:append("P36")[1] = pg_t.extension
+ init_cfg[1]:append("P34")[1] = pg_t.password
+ init_cfg[1]:append("P3")[1] = pg_t.callerid
+ end
+ elseif num == "2" then
+ if pg_t.extension ~= "" then
+ init_cfg[1]:append("P747")[1] = values.device.registrar
+ init_cfg[1]:append("P735")[1] = pg_t.extension
+ init_cfg[1]:append("P736")[1] = pg_t.extension
+ init_cfg[1]:append("P734")[1] = pg_t.password
+ init_cfg[1]:append("P703")[1] = pg_t.callerid
+ end
+ end
+end
+
+-- init_cfg:save("TEST-grandstream.xml")
+
+print("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n")
+print(init_cfg)
+%>