From e1836ec52b5129c321e2adac263922caa7f24aba Mon Sep 17 00:00:00 2001 From: Ted Trask Date: Wed, 19 Oct 2011 14:41:37 +0000 Subject: Updated formatting of polycom template and removed settings not related to provisioning parameters --- config/templates/polycom-template.lua | 212 +++++++++------------------------- 1 file changed, 53 insertions(+), 159 deletions(-) diff --git a/config/templates/polycom-template.lua b/config/templates/polycom-template.lua index 5ed35a3..1e1b775 100644 --- a/config/templates/polycom-template.lua +++ b/config/templates/polycom-template.lua @@ -46,98 +46,22 @@ - -<% --- From features.cfg %> -<% --TODO: Do we want to enable locking? %> -<% --phoneLock.enabled="1" %> -<% --feature.autoLocalHold="1" -- trying default for now%> -feature.callPark.enabled="1" -feature.directedCallPickup.enabled="1" -feature.enhancedFeatureKeys.enabled="1" -feature.groupCallPickup.enabled="1" -feature.messaging.enabled="1" -<% -- Management of buddies, and own status %> -feature.presence.enabled="1" -<% -- Run-time downloading of ringers %> -feature.ringDownload.enabled="1" -<% -- Create DND softkey button except on SPIP650 %> -softkey.1.enable="1" -softkey.1.enable.SPIP650="0" -softkey.1.label="DND" -softkey.1.action="$FDoNotDisturb$" -softkey.1.use.idle="1" -softkey.1.use.active="1" -softkey.1.use.alerting="1" - -<% --- From sip-interop.cfg %> -<% -- Allow user to set Do Not Disturb (DND) per-registration %> -call.donotdisturb.perReg="1" -<% -- When a conference is put on hold, other parties continue to talk %> -call.localConferenceCallHold="1" -<% -- Disallow transfers during the proceeding state of a consultation call %> -voIpProt.SIP.allowTransferOnProceeding="0" -<% -- TODO needed???%> -<% --voIpProt.SIP.CID.sourcePreference="" %> -<% -- Send 486 (SIP Busy Here) when 'Reject' is pressed during a ringing call %> -voIpProt.SIP.use486forReject="1" -<% -- Set phone's requested registration period in seconds %> -voIpProt.server.1.expires="60" -voIpProt.server.2.expires="60" -<% -- Set RFC 2833 payload to 101 instead of 127 for interop. with Linksys ATA %> -tone.dtmf.rfc2833Payload="101" - - -<% --- From site.cfg %> <% -- Allow the use of device.xxx options (Admin Guide A-30) %> device.set="1" -<% -- Override default user password of '123' see Admin Guide 4-103 %> -<% -- only used for phone locking and to protect redundant 'Reboot' option %> -device.auth.localUserPassword="" -device.auth.localUserPassword.set="1" -<% -- Attempt to determine VLAN ID and negotiate power through LLDP %> -device.net.lldpEnabled="1" -<% -- Apply option configured in device.net.lldpEnabled (Admin Guide A-30) %> -device.net.lldpEnabled.set="1" -<% -- Phone should provide reorder tone when dialed digits do not match digit map %> -dialplan.impossibleMatchHandling="1" -<% -- Do not treat a trailing '#' as a 'Send' operation %> -dialplan.removeEndOfDial="0" -<% -- Automatic periodic polling of provisioning server for upgrades %> -prov.polling.enabled="1" -<% -- Polling time of day hh:mm. %> -prov.polling.time="02:00" -<% -- Do not reject RTP packets arriving from a non-SDP-negotiated IP address %> -<% -- Needed for some ATAs that do provide bad SDP in transfers to MOH %> -tcpIpApp.port.rtp.filterByIp="0" -<% -- Reject RTP packets arriving from a non-SDP-negotiated port %> -<% -- To provide some security despite disabling filterByIp above.t %> -tcpIpApp.port.rtp.filterByPort="1" -<% -- Headset preferred over speakerphone after first use, until disabled %> -up.headsetMode="1" -<% -- Intensity of LCD backlight when phone is idle. 0 = off. %> -up.backlight.idleIntensity="0" -<% -- Receive volume of handset remembered between calls %> -voice.volume.persist.handset="1" -<% -- Receive volume of headset remembered between calls %> -voice.volume.persist.headset="1" - - - - <% local values = ... %> <% local function xml_attr (t, v) -if v ~= nil then - -- v could be a string, boolean, or a number - io.write(table.concat(t, '.') .. '="' .. tostring(v) .. '"\n') -end + if v ~= nil then + -- v could be a string, boolean, or a number + io.write(table.concat(t, '.') .. '="' .. tostring(v) .. '"\n') + end end %> <% +-- we can assume that values.device is not nil since values.device.template is this file xml_attr({ 'voIpProt.server.1.address' }, values.device.registrar) xml_attr({ 'mb.main.home' }, values.device.homepage) @@ -158,31 +82,23 @@ if values.device.adminpassword then xml_attr({ 'device.auth.localAdminPassword.set' }, true) end ----[=[ -- Handle SNTP and Time Zone parameters -- See http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap08.html -- TZ variable, with no leading colon -- Syntax: stdoffset[dst[offset][,start[/time],end[/time]]] -- Examples: 'GMT0' 'EST5EDT,M3.2.0,M11.1.0' '5' - --- we can assume that values.device is not nil --- since values.device.template is this file if values.device.sntpserver then xml_attr({ 'tcpIpApp.sntp.address' }, values.device.sntpserver) end - -- Parse time zone variable require('posixtz') local tz = posixtz.parse(values.device.timezone) if tz then - -- convert POSIX sign (W of GMT is '+') to Polycom (E of GMT is '+') xml_attr({'tcpIpApp.sntp.gmtOffset'}, -1 * tz.offset.total) - - local function dstrule ( pos ) local dstprefix = 'tcpIpApp.sntp.daylightSavings' local t = tz.dst[pos] @@ -231,14 +147,8 @@ if tz then end end ---]=] - - -- Check 'services' params -local enable = {} -enable.forwarding = false -enable.hotline = false - +local enable = {forwarding = false, hotline = false} if values.services then -- set variables so that we don't have to test values.services again if not values.services.callhistoryenable then @@ -274,73 +184,57 @@ end -- Loop through Parameter Groups looking for 'reg' params for pg, pg_t in pairs(values) do - --- Is it of the form regX ? -local num = string.match(pg, 'reg(%d+)') -if num then - - - -- set Hotline on all possible registrations if it is configured - if enable.hotline then - local d = values.services.hotlinedestination - if d then - xml_attr({ 'call.autoOffHook', num, 'enabled' }, '1') - xml_attr({ 'call.autoOffHook', num, 'protocol' }, 'SIP') - xml_attr({ 'call.autoOffHook', num, 'contact' }, d) + -- Is it of the form regX ? + local num = string.match(pg, 'reg(%d+)') + if num then + -- set Hotline on all possible registrations if it is configured + if enable.hotline then + local d = values.services.hotlinedestination + if d then + xml_attr({ 'call.autoOffHook', num, 'enabled' }, '1') + xml_attr({ 'call.autoOffHook', num, 'protocol' }, 'SIP') + xml_attr({ 'call.autoOffHook', num, 'contact' }, d) + end end - end - - -- user part of From URI - xml_attr({ 'reg', num, 'address' }, pg_t.extension) - -- SIP authentication parameters - xml_attr({ 'reg', num, 'auth.userId' }, pg_t.extension) - xml_attr({ 'reg', num, 'auth.password' }, pg_t.password) - -- Caller ID string - xml_attr({ 'reg', num, 'displayName' }, pg_t.callerid) - - - -- From Admin_Guide_UCS_v3.3.0: - -- "The phone has a flexible call forward/diversion feature for each registration. In all cases, a call will only be diverted if a non-Null contact has been configured." - if enable.forwarding then - -- Although not documented, - -- Polycom phones send special options for - -- 'forward all calls', namely: - -- reg.x.fwdContact and reg.x.fwdStatus - - -- set forwardall as defined - xml_attr({ 'reg', num, 'fwdStatus' }, pg_t.forwardallenable) - xml_attr({ 'reg', num, 'fwdContact' }, pg_t.forwardall) - - -- set forwardnoanswer as defined - xml_attr({ 'reg', num, 'fwd.noanswer.status' }, pg_t.forwardnoanswerenable) - xml_attr({ 'reg', num, 'fwd.noanswer.contact' }, pg_t.forwardnoanswer) - xml_attr({ 'reg', num, 'fwd.noanswer.ringCount' }, '3') - -- we do not use 'divert.noanswer.x.timeout', - -- because it limits maximum rings *even when* forward-on-noanswer disabled - - -- set forwardbusy on DND and on busy, as defined - xml_attr({ 'reg', num, 'fwd.busy.status' }, pg_t.forwardbusyenable) - xml_attr({ 'divert.dnd', num, 'enabled' }, pg_t.forwardbusyenable) - xml_attr({ 'reg', num, 'fwd.busy.contact' }, pg_t.forwardbusy) - xml_attr({ 'divert.dnd', num, 'contact' }, pg_t.forwardbusy) - else -- forwarding is not enabled - -- disable the soft-key menu for forwarding - xml_attr({ 'divert.fwd', num, 'enabled' }, '0') + -- user part of From URI + xml_attr({ 'reg', num, 'address' }, pg_t.extension) + -- SIP authentication parameters + xml_attr({ 'reg', num, 'auth.userId' }, pg_t.extension) + xml_attr({ 'reg', num, 'auth.password' }, pg_t.password) + -- Caller ID string + xml_attr({ 'reg', num, 'displayName' }, pg_t.callerid) + + -- From Admin_Guide_UCS_v3.3.0: + -- "The phone has a flexible call forward/diversion feature for each registration. In all cases, a call will only be diverted if a non-Null contact has been configured." + if enable.forwarding then + -- Although not documented, + -- Polycom phones send special options for + -- 'forward all calls', namely: + -- reg.x.fwdContact and reg.x.fwdStatus + + -- set forwardall as defined + xml_attr({ 'reg', num, 'fwdStatus' }, pg_t.forwardallenable) + xml_attr({ 'reg', num, 'fwdContact' }, pg_t.forwardall) + + -- set forwardnoanswer as defined + xml_attr({ 'reg', num, 'fwd.noanswer.status' }, pg_t.forwardnoanswerenable) + xml_attr({ 'reg', num, 'fwd.noanswer.contact' }, pg_t.forwardnoanswer) + xml_attr({ 'reg', num, 'fwd.noanswer.ringCount' }, '3') + -- we do not use 'divert.noanswer.x.timeout', + -- because it limits maximum rings *even when* forward-on-noanswer disabled + + -- set forwardbusy on DND and on busy, as defined + xml_attr({ 'reg', num, 'fwd.busy.status' }, pg_t.forwardbusyenable) + xml_attr({ 'divert.dnd', num, 'enabled' }, pg_t.forwardbusyenable) + xml_attr({ 'reg', num, 'fwd.busy.contact' }, pg_t.forwardbusy) + xml_attr({ 'divert.dnd', num, 'contact' }, pg_t.forwardbusy) + else -- forwarding is not enabled + -- disable the soft-key menu for forwarding + xml_attr({ 'divert.fwd', num, 'enabled' }, '0') + end end - - -end - end - %> /> - -<% --- DEBUGGING ---require("session") ---local log, err = io.open("/root/polycom-template.log", "a") ---log:write(session.serialize("values", values)) -%> -- cgit v1.2.3