From 7d4cc698a4703624d8fb0d16825f403c1aa2e3a8 Mon Sep 17 00:00:00 2001 From: Joao Arruda Date: Tue, 2 Jun 2015 16:45:51 -0300 Subject: Update process_put.lua to send language, 24HourClock and tonePattern values to DB Signed-off-by: Ted Trask --- config/process_put.lua | 58 ++++++++++++++++++++++++++++++++------------------ 1 file changed, 37 insertions(+), 21 deletions(-) diff --git a/config/process_put.lua b/config/process_put.lua index 8497746..1fed1ae 100644 --- a/config/process_put.lua +++ b/config/process_put.lua @@ -23,32 +23,48 @@ function process_polycom() -- Read attributes from attrs and generate paramaters for ACF local xmlout = {} - for n,v in pairs(attrs) do - -- search attribute name for reg_name like "reg.1." - -- and for rest like "fwdStatus" - local num, rest = string.match(n, "reg%.(%d+)%.([%.%a]*)$") - - -- if rest is defined, then num is defined also - if rest == "fwd.busy.contact" then - params.value["reg"..num].value.forwardbusy.value = v - elseif rest == "fwd.noanswer.contact" then - params.value["reg"..num].value.forwardnoanswer.value = v - elseif rest == "fwdContact" then - params.value["reg"..num].value.forwardall.value = v - elseif rest == "fwd.busy.status" then - params.value["reg"..num].value.forwardbusyenable.value = (v == "1") - elseif rest == "fwd.noanswer.status" then - params.value["reg"..num].value.forwardnoanswerenable.value = (v == "1") - elseif rest == "fwdStatus" then - params.value["reg"..num].value.forwardallenable.value = (v == "1") - elseif rest == "ringType" then - params.value["reg"..num].value.polycomringtone.value = string.match(v, "%d+") + for n,v in pairs(attrs) do + + -- this attribute controls the default ringtone, when the phone have only one reg + if n == "np.normal.ringing.calls.tonePattern" then + params.value.reg1.value.polycomringtone.value = string.match(v, "%d+") + + -- this attribute controls the display language + elseif n == "lcl.ml.lang" then + params.value.device.value.displaylang.value = v + + -- found any attribute related with 24HourClock + elseif string.find(n, "24HourClock") then + params.value.device.value.militarytimeenable.value = (v == "1") + else - xmlout[#xmlout+1] = n.."=\""..v.."\"" + -- search attribute name for reg_name like "reg.1." + -- and for rest like "fwdStatus" + local num, rest = string.match(n, "reg%.(%d+)%.([%.%a]*)$") + + -- if rest is defined, then num is defined also + if rest == "fwd.busy.contact" then + params.value["reg"..num].value.forwardbusy.value = v + elseif rest == "fwd.noanswer.contact" then + params.value["reg"..num].value.forwardnoanswer.value = v + elseif rest == "fwdContact" then + params.value["reg"..num].value.forwardall.value = v + elseif rest == "fwd.busy.status" then + params.value["reg"..num].value.forwardbusyenable.value = (v == "1") + elseif rest == "fwd.noanswer.status" then + params.value["reg"..num].value.forwardnoanswerenable.value = (v == "1") + elseif rest == "fwdStatus" then + params.value["reg"..num].value.forwardallenable.value = (v == "1") + elseif rest == "ringType" then + params.value["reg"..num].value.polycomringtone.value = string.match(v, "%d+") + else + xmlout[#xmlout+1] = n.."=\""..v.."\"" + end end end data = before.." "..table.concat(xmlout, " ").." "..after + end -- Determine the template -- cgit v1.2.3