summaryrefslogtreecommitdiffstats
path: root/config
diff options
context:
space:
mode:
authorZach LeBar <zach@zachlebar.com>2012-06-30 19:20:03 +0000
committerZach LeBar <zach@zachlebar.com>2012-06-30 19:20:03 +0000
commite397a257ba8ad7721195c04242cf41d01a787cb2 (patch)
tree42cc90be9f2f18bd7c7ff0220a9fab135b77e831 /config
parent454e50286e149cc056787173acec49920e632e1e (diff)
downloadacf-provisioning-e397a257ba8ad7721195c04242cf41d01a787cb2.tar.bz2
acf-provisioning-e397a257ba8ad7721195c04242cf41d01a787cb2.tar.xz
Changes to process_put.lua to allow for parsing ringtones passed in from Polycome phones.
Handles single lines as well as multiple lines on a phone, and passes changes made to the 'Default' ringtone on to all of the lines potentially registered to the phone.
Diffstat (limited to 'config')
-rw-r--r--config/process_put.lua13
1 files changed, 11 insertions, 2 deletions
diff --git a/config/process_put.lua b/config/process_put.lua
index 33e918a..662b038 100644
--- a/config/process_put.lua
+++ b/config/process_put.lua
@@ -10,7 +10,7 @@ function process_polycom()
local before, xml, after = string.match(data, "(.*<OVERRIDES)([^/]*)(/>.*)")
if not xml then return end
local attrs = {}
- for str in string.gmatch(xml, "%S+") do
+ for str in string.gmatch(xml, "%S+\".+\"") do
local n,v = string.match(str, "([^=]+)=\"(.*)\"")
if not attrs[n] then
attrs[n] = v
@@ -28,6 +28,15 @@ function process_polycom()
-- and for rest like "fwdStatus"
local num, rest = string.match(n, "reg%.(%d+)%.([%.%a]*)$")
+ -- this parameter controls the default ringtone
+ if n == "np.normal.ringing.calls.tonePattern" then
+ for a,b in pairs(params.value) do
+ if string.match(a, "reg%d") then
+ params.value[a].value.polycomringtone.value = string.match(v, "%d+")
+ end
+ end
+ end
+
-- if rest is defined, then num is defined also
if rest == "fwd.busy.contact" then
params.value["reg"..num].value.forwardbusy.value = v
@@ -48,7 +57,7 @@ function process_polycom()
end
end
- data = before..table.concat(xmlout, " ")..after
+ data = before.."\n"..table.concat(xmlout, " ").."\n"..after
end
-- Determine the template