From fc2453e74aabeda50f034f3323118d1546e49909 Mon Sep 17 00:00:00 2001 From: Seung Soo Mun Date: Sun, 7 Jun 2015 22:17:42 +0000 Subject: new devices for acf-provisioning: algo, cyberdata, grandstream Signed-off-by: Ted Trask --- config/templates/grandstream-template.lua | 39 +++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 config/templates/grandstream-template.lua (limited to 'config/templates/grandstream-template.lua') 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") + +-- +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("\n") +print(init_cfg) +%> -- cgit v1.2.3