summaryrefslogtreecommitdiffstats
path: root/config
diff options
context:
space:
mode:
authorTed Trask <ttrask01@yahoo.com>2011-10-10 19:34:59 +0000
committerTed Trask <ttrask01@yahoo.com>2011-10-10 19:34:59 +0000
commit1d895ace660869053830ed33302e0708efb6065e (patch)
tree0ed844a6a408042ec0c6f4a11726db7a7915881b /config
parentb802504e41cccda64b8f903973d01897bbec7451 (diff)
downloadacf-provisioning-1d895ace660869053830ed33302e0708efb6065e.tar.bz2
acf-provisioning-1d895ace660869053830ed33302e0708efb6065e.tar.xz
Added in configuration files / scripts and cgi-bin scripts.
Diffstat (limited to 'config')
-rw-r--r--config/acl.conf2
-rw-r--r--config/delete_device.lua44
-rw-r--r--config/determine_class.lua21
-rw-r--r--config/lighttpd.sample.conf338
-rwxr-xr-xconfig/notify_device30
-rw-r--r--config/templates/linksysata-template.lua839
-rw-r--r--config/templates/polycom-template.lua346
-rw-r--r--config/templates/snom-template.lua95
-rw-r--r--config/update_device.lua14
-rw-r--r--config/update_device_params.lua41
10 files changed, 1770 insertions, 0 deletions
diff --git a/config/acl.conf b/config/acl.conf
new file mode 100644
index 0000000..9469c42
--- /dev/null
+++ b/config/acl.conf
@@ -0,0 +1,2 @@
+Linksys
+Polycom
diff --git a/config/delete_device.lua b/config/delete_device.lua
new file mode 100644
index 0000000..ad908ed
--- /dev/null
+++ b/config/delete_device.lua
@@ -0,0 +1,44 @@
+-- This is the script run after deleting a device (and all of its params)
+local functions, olddevice, oldparams = ...
+
+local path = "PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin "
+
+APP.logevent("got to delete_device script")
+
+-- We'll handle the deleting of the device by handling the resulting changing of the params
+-- First, have to create a new set of params (with blank extensions)
+local duplicatestructure
+duplicatestructure = function(value, saved)
+ saved = saved or {}
+ if type(value) == "table" then
+ if saved[value] then
+ return saved[value]
+ else
+ local output = {}
+ saved[value] = output
+ for k,v in pairs(value) do
+ output[k] = duplicatestructure(v, saved)
+ end
+ return output
+ end
+ else
+ return value
+ end
+end
+
+local params = duplicatestructure(oldparams)
+for name,val in pairs(params.value) do
+ if string.match(name, "^reg") then
+ params.value[name].value.extension.value = ""
+ end
+end
+
+-- Then call the other script
+local env = {}
+setmetatable (env, {__index = _G})
+-- loadfile loads into the global environment
+-- so we set env 0, not env 1
+setfenv (0, env)
+local f = loadfile("/etc/provisioning/update_device_params.lua")
+if (f) then f(functions, params, oldparams) end
+setfenv (0, _G)
diff --git a/config/determine_class.lua b/config/determine_class.lua
new file mode 100644
index 0000000..df8f5c2
--- /dev/null
+++ b/config/determine_class.lua
@@ -0,0 +1,21 @@
+-- This is the script run to determine the device class from the HTTP user agent
+local functions, agent, classes = ...
+
+APP.logevent("got to determine_class script")
+
+local manufacture, model
+
+if string.match(agent, "Polycom") then
+ manufacture = "Polycom"
+ model = string.match(agent, "Polycom[^%s%d]+(%d+)")
+end
+
+APP.logevent("Found "..(manufacture or "").." model "..(model or ""))
+
+if manufacture and model then
+ for i,c in ipairs(classes.value) do
+ if string.match(c.label, manufacture) and string.match(c.label, model) then
+ return c.class_id
+ end
+ end
+end
diff --git a/config/lighttpd.sample.conf b/config/lighttpd.sample.conf
new file mode 100644
index 0000000..23dbe0d
--- /dev/null
+++ b/config/lighttpd.sample.conf
@@ -0,0 +1,338 @@
+###############################################################################
+# Default lighttpd.conf for Gentoo.
+# $Header: /var/cvsroot/gentoo-x86/www-servers/lighttpd/files/conf/lighttpd.conf,v 1.3 2005/09/01 14:22:35 ka0ttic Exp $
+###############################################################################
+
+server.reject-expect-100-with-417 = "disable"
+debug.log-request-handling = "enable"
+debug.log-file-not-found = "enable"
+debug.log-request-header-on-error = "enable"
+
+# {{{ variables
+var.basedir = "/var/www/provisioning"
+var.logdir = "/var/log/lighttpd"
+var.statedir = "/var/lib/lighttpd"
+# }}}
+
+# {{{ modules
+# At the very least, mod_access and mod_accesslog should be enabled.
+# All other modules should only be loaded if necessary.
+# NOTE: the order of modules is important.
+server.modules = (
+ "mod_rewrite",
+# "mod_redirect",
+# "mod_alias",
+ "mod_access",
+# "mod_cml",
+# "mod_trigger_b4_dl",
+# "mod_auth",
+# "mod_status",
+# "mod_setenv",
+# "mod_proxy",
+# "mod_simple_vhost",
+# "mod_evhost",
+# "mod_userdir",
+# "mod_compress",
+# "mod_ssi",
+# "mod_usertrack",
+# "mod_expire",
+# "mod_secdownload",
+# "mod_rrdtool",
+# "mod_webdav",
+ "mod_accesslog"
+)
+# }}}
+
+# {{{ includes
+include "mime-types.conf"
+# uncomment for cgi support
+include "mod_cgi.conf"
+# uncomment for php/fastcgi support
+# include "mod_fastcgi.conf"
+# }}}
+
+# {{{ server settings
+server.username = "lighttpd"
+server.groupname = "lighttpd"
+
+server.document-root = var.basedir + "/htdocs"
+server.pid-file = "/var/run/lighttpd.pid"
+
+server.errorlog = var.logdir + "/error.log"
+# log errors to syslog instead
+# server.errorlog-use-syslog = "enable"
+
+server.indexfiles = ("index.php", "index.html",
+ "index.htm", "default.htm")
+
+# server.tag = "lighttpd"
+
+server.follow-symlink = "enable"
+
+# event handler (defaults to "poll")
+# see performance.txt
+#
+# for >= linux-2.4
+# server.event-handler = "linux-rtsig"
+# for >= linux-2.6
+# server.event-handler = "linux-sysepoll"
+# for FreeBSD
+# server.event-handler = "freebsd-kqueue"
+
+# chroot to directory (defaults to no chroot)
+# server.chroot = "/"
+
+# bind to port (defaults to 80)
+# server.port = 81
+
+# bind to name (defaults to all interfaces)
+# server.bind = "grisu.home.kneschke.de"
+
+# error-handler for status 404
+# server.error-handler-404 = "/error-handler.html"
+# server.error-handler-404 = "/error-handler.php"
+server.error-handler-404 = "/cgi-bin/provisioning.cgi"
+
+# Format: <errorfile-prefix><status-code>.html
+# -> ..../status-404.html for 'File not found'
+# server.errorfile-prefix = var.basedir + "/error/status-"
+
+# FAM support for caching stat() calls
+# requires that lighttpd be built with USE=fam
+# server.stat-cache-engine = "fam"
+# }}}
+
+# {{{ mod_staticfile
+
+# which extensions should not be handled via static-file transfer
+# (extensions that are usually handled by mod_cgi, mod_fastcgi, etc).
+static-file.exclude-extensions = (".php", ".pl", ".cgi", ".fcgi")
+# }}}
+
+# {{{ mod_accesslog
+accesslog.filename = var.logdir + "/access.log"
+# }}}
+
+# {{{ mod_dirlisting
+# enable directory listings
+# dir-listing.activate = "enable"
+#
+# don't list hidden files/directories
+# dir-listing.hide-dotfiles = "enable"
+#
+# use a different css for directory listings
+# dir-listing.external-css = "/path/to/dir-listing.css"
+#
+# list of regular expressions. files that match any of the
+# specified regular expressions will be excluded from directory
+# listings.
+# dir-listing.exclude = ("^\.", "~$")
+# }}}
+
+# {{{ mod_access
+# see access.txt
+
+url.access-deny = ("~", ".inc")
+# }}}
+
+# {{{ mod_userdir
+# see userdir.txt
+#
+# userdir.path = "public_html"
+# userdir.exclude-user = ("root")
+# }}}
+
+# {{{ mod_ssi
+# see ssi.txt
+#
+# ssi.extension = (".shtml")
+# }}}
+
+# {{{ mod_ssl
+# see ssl.txt
+#
+# ssl.engine = "enable"
+# ssl.pemfile = "server.pem"
+# }}}
+
+# {{{ mod_status
+# see status.txt
+#
+# status.status-url = "/server-status"
+# status.config-url = "/server-config"
+# }}}
+
+# {{{ mod_simple_vhost
+# see simple-vhost.txt
+#
+# If you want name-based virtual hosting add the next three settings and load
+# mod_simple_vhost
+#
+# document-root =
+# virtual-server-root + virtual-server-default-host + virtual-server-docroot
+# or
+# virtual-server-root + http-host + virtual-server-docroot
+#
+# simple-vhost.server-root = "/home/weigon/wwwroot/servers/"
+# simple-vhost.default-host = "grisu.home.kneschke.de"
+# simple-vhost.document-root = "/pages/"
+# }}}
+
+# {{{ mod_compress
+# see compress.txt
+#
+# compress.cache-dir = var.statedir + "/cache/compress"
+# compress.filetype = ("text/plain", "text/html")
+# }}}
+
+# {{{ mod_proxy
+# see proxy.txt
+#
+# proxy.server = ( ".php" =>
+# ( "localhost" =>
+# (
+# "host" => "192.168.0.101",
+# "port" => 80
+# )
+# )
+# )
+# }}}
+
+# {{{ mod_auth
+# see authentication.txt
+#
+# auth.backend = "plain"
+# auth.backend.plain.userfile = "lighttpd.user"
+# auth.backend.plain.groupfile = "lighttpd.group"
+
+# auth.backend.ldap.hostname = "localhost"
+# auth.backend.ldap.base-dn = "dc=my-domain,dc=com"
+# auth.backend.ldap.filter = "(uid=$)"
+
+# auth.require = ( "/server-status" =>
+# (
+# "method" => "digest",
+# "realm" => "download archiv",
+# "require" => "user=jan"
+# ),
+# "/server-info" =>
+# (
+# "method" => "digest",
+# "realm" => "download archiv",
+# "require" => "valid-user"
+# )
+# )
+# }}}
+
+# {{{ mod_rewrite
+# see rewrite.txt
+#
+# url.rewrite = (
+# "^/$" => "/server-status"
+# )
+# }}}
+
+# {{{ mod_redirect
+# see redirect.txt
+#
+# url.redirect = (
+# "^/wishlist/(.+)" => "http://www.123.org/$1"
+# )
+# }}}
+
+# {{{ mod_evhost
+# define a pattern for the host url finding
+# %% => % sign
+# %0 => domain name + tld
+# %1 => tld
+# %2 => domain name without tld
+# %3 => subdomain 1 name
+# %4 => subdomain 2 name
+#
+# evhost.path-pattern = "/home/storage/dev/www/%3/htdocs/"
+# }}}
+
+# {{{ mod_expire
+# expire.url = (
+# "/buggy/" => "access 2 hours",
+# "/asdhas/" => "access plus 1 seconds 2 minutes"
+# )
+# }}}
+
+# {{{ mod_rrdtool
+# see rrdtool.txt
+#
+# rrdtool.binary = "/usr/bin/rrdtool"
+# rrdtool.db-name = var.statedir + "/lighttpd.rrd"
+# }}}
+
+# {{{ mod_setenv
+# see setenv.txt
+#
+# setenv.add-request-header = ( "TRAV_ENV" => "mysql://user@host/db" )
+# setenv.add-response-header = ( "X-Secret-Message" => "42" )
+# }}}
+
+# {{{ mod_trigger_b4_dl
+# see trigger_b4_dl.txt
+#
+# trigger-before-download.gdbm-filename = "/home/weigon/testbase/trigger.db"
+# trigger-before-download.memcache-hosts = ( "127.0.0.1:11211" )
+# trigger-before-download.trigger-url = "^/trigger/"
+# trigger-before-download.download-url = "^/download/"
+# trigger-before-download.deny-url = "http://127.0.0.1/index.html"
+# trigger-before-download.trigger-timeout = 10
+# }}}
+
+# {{{ mod_cml
+# see cml.txt
+#
+# don't forget to add index.cml to server.indexfiles
+# cml.extension = ".cml"
+# cml.memcache-hosts = ( "127.0.0.1:11211" )
+# }}}
+
+# {{{ mod_webdav
+# see webdav.txt
+#
+# $HTTP["url"] =~ "^/dav($|/)" {
+# webdav.activate = "enable"
+# webdav.is-readonly = "enable"
+# }
+# }}}
+
+# {{{ extra rules
+#
+# set Content-Encoding and reset Content-Type for browsers that
+# support decompressing on-thy-fly (requires mod_setenv)
+# $HTTP["url"] =~ "\.gz$" {
+# setenv.add-response-header = ("Content-Encoding" => "x-gzip")
+# mimetype.assign = (".gz" => "text/plain")
+# }
+
+# $HTTP["url"] =~ "\.bz2$" {
+# setenv.add-response-header = ("Content-Encoding" => "x-bzip2")
+# mimetype.assign = (".bz2" => "text/plain")
+# }
+#
+# }}}
+
+# {{{ debug
+# debug.log-request-header = "enable"
+# debug.log-response-header = "enable"
+# debug.log-request-handling = "enable"
+# debug.log-file-not-found = "enable"
+# }}}
+
+# vim: set ft=conf foldmethod=marker et :
+
+url.rewrite = (
+ "^/?$" => "/cgi-bin/redirect.cgi",
+)
+
+$HTTP["request-method"] =~ "^(PUT|DELETE)$" {
+url.rewrite = (
+ "^(.*)$" => "/cgi-bin/provisioning.cgi/$1"
+)
+}
+
diff --git a/config/notify_device b/config/notify_device
new file mode 100755
index 0000000..7d5ff2a
--- /dev/null
+++ b/config/notify_device
@@ -0,0 +1,30 @@
+#!/usr/bin/lua
+require("socket")
+require("validator")
+
+if not arg or #arg == 0 then
+ print("Error - IP Address must be specified")
+ return 1
+end
+
+local address = arg[1]
+local user = arg[2] or ""
+if not validator.is_ipv4(address) then
+ print("Error - Invalid IP Address")
+ return 1
+end
+
+local msg = "NOTIFY sip:"..user.."@"..address..":5060 SIP/2.0\n"..
+"Via: SIP/2.0/UDP 127.0.0.1\n"..
+"From: <sip:provisioning@127.0.0.1>\n"..
+"To: <sip:"..user.."@"..address..">\n"..
+"Event: check-sync\n"..
+"Date: "..os.date().."\n"..
+"Call-ID: "..os.time().."msgto0@"..address.."\n"..
+"CSeq: 102 NOTIFY\n"..
+"Contact: <sip:provisioning@127.0.0.1>\n"..
+"Content-Length: 0\n\n"
+
+local s = assert(socket.udp())
+assert(s:sendto(msg, address, 5060))
+s:close()
diff --git a/config/templates/linksysata-template.lua b/config/templates/linksysata-template.lua
new file mode 100644
index 0000000..ba71657
--- /dev/null
+++ b/config/templates/linksysata-template.lua
@@ -0,0 +1,839 @@
+<%
+-- Linksys ATA Configuration File Template
+local values = ...
+server=values.device.registrar
+web_server=string.gsub(ENV['HTTP_HOST'], ":[0-9]*$", "")
+moh=values.device.musiconhold
+dialpattern="( " .. values.device.digitmap .. " )"
+
+local cid
+if values.reg1.callerid == "" then
+ cid = values.reg1.extension
+else
+ cid = values.reg1.callerid
+end
+%>
+
+<% local values = ... %>
+
+<%
+
+local function yesno ( bool )
+ if bool then
+ return "Yes"
+ else
+ return "No"
+ end
+end
+%>
+
+<flat-profile>
+
+<Restricted_Access_Domains ua="na"></Restricted_Access_Domains>
+<Enable_Web_Server ua="na">Yes</Enable_Web_Server>
+<Web_Server_Port ua="na">80</Web_Server_Port>
+<Enable_Web_Admin_Access ua="na">Yes</Enable_Web_Admin_Access>
+
+<Admin_Passwd ua="na"><%= values.device.adminpassword %></Admin_Passwd>
+
+<User_Password ua="na"><%= values.device.adminpassword %></User_Password>
+
+
+
+<DHCP ua="na">Yes</DHCP>
+<Static_IP ua="na"></Static_IP>
+<NetMask ua="na"></NetMask>
+<Gateway ua="na"></Gateway>
+
+
+
+<HostName ua="na"><% io.write(values.reg1.extension) %></HostName>
+<Domain ua="na" />
+
+<Primary_DNS ua="na"></Primary_DNS>
+<Secondary_DNS ua="na"></Secondary_DNS>
+<DNS_Server_Order ua="na">DHCP,Manual</DNS_Server_Order>
+<DNS_Query_Mode ua="na">Sequential</DNS_Query_Mode>
+
+<Syslog_Server ua="na"><%= web_server %></Syslog_Server>
+<Debug_Server ua="na"><%= web_server %></Debug_Server>
+<Debug_Level ua="na">0</Debug_Level>
+
+<Primary_NTP_Server ua="na"></Primary_NTP_Server>
+<Secondary_NTP_Server ua="na"></Secondary_NTP_Server>
+
+
+
+<Provision_Enable ua="na">Yes</Provision_Enable>
+<Resync_On_Reset ua="na">Yes</Resync_On_Reset>
+<% -- Resync at a particular time of day, not periodically. (24-hour format hhmm) %>
+<Resync_At ua="na">0200</Resync_At>
+<% -- Resync_Periodic is disabled because of using Resync_At instead %>
+<Resync_Periodic ua="na"></Resync_Periodic>
+
+<Resync_Random_Delay ua="na">10</Resync_Random_Delay>
+<Resync_Error_Retry_Delay ua="na">900</Resync_Error_Retry_Delay>
+<% -- Do not resync during a call, unless the call lasts longer than 3 hours %>
+<Forced_Resync_Delay ua="na">10800</Forced_Resync_Delay>
+
+<Resync_From_SIP ua="na">Yes</Resync_From_SIP>
+<Resync_After_Upgrade_Attempt ua="na">Yes</Resync_After_Upgrade_Attempt>
+
+<Resync_Trigger_1 ua="na"></Resync_Trigger_1>
+
+<Resync_Fails_On_FNF>No</Resync_Fails_On_FNF>
+
+
+
+<Profile_Rule ua="na">
+http://<% io.write(web_server) %>/Linksys/$MA.xml
+</Profile_Rule>
+
+<Profile_Rule_B ua="na">
+</Profile_Rule_B>
+
+<Profile_Rule_C ua="na">
+</Profile_Rule_C>
+<Profile_Rule_D ua="na"></Profile_Rule_D>
+<Resync_Trigger_2 ua="na"></Resync_Trigger_2>
+
+<Log_Resync_Request_Msg ua="na">$PN $MAC -- Requesting resync $SCHEME://$SERVIP:$PORT$PATH</Log_Resync_Request_Msg>
+<Log_Resync_Success_Msg ua="na">$PN $MAC -- Successful resync $SCHEME://$SERVIP:$PORT$PATH</Log_Resync_Success_Msg>
+<Log_Resync_Failure_Msg ua="na">$PN $MAC -- Resync failed: $ERR</Log_Resync_Failure_Msg>
+
+<Report_Rule ua="na"></Report_Rule>
+
+
+<Upgrade_Enable ua="na">Yes</Upgrade_Enable>
+<Upgrade_Error_Retry_Delay ua="na">7200</Upgrade_Error_Retry_Delay>
+
+<Downgrade_Rev_Limit ua="na"></Downgrade_Rev_Limit>
+
+
+
+<Upgrade_Rule ua="na">
+(!5.1.6)?http://<% io.write(web_server) %>/pap2t-5-1-6.bin
+</Upgrade_Rule>
+
+
+<Log_Upgrade_Request_Msg ua="na">$PN $MAC -- Requesting upgrade $SCHEME://$SERVIP:$PORT$PATH</Log_Upgrade_Request_Msg>
+<Log_Upgrade_Success_Msg ua="na">$PN $MAC -- Successful upgrade $SCHEME://$SERVIP:$PORT$PATH -- $ERR</Log_Upgrade_Success_Msg>
+<Log_Upgrade_Failure_Msg ua="na">$PN $MAC -- Upgrade failed: $ERR</Log_Upgrade_Failure_Msg>
+
+
+
+<Max_Forward ua="na">70</Max_Forward>
+<Max_Redirection ua="na">5</Max_Redirection>
+<Max_Auth ua="na">2</Max_Auth>
+<SIP_User_Agent_Name ua="na">$MAU $VERSION</SIP_User_Agent_Name>
+<SIP_Server_Name ua="na">$MAU $VERSION</SIP_Server_Name>
+
+<SIP_Accept_Language ua="na"></SIP_Accept_Language>
+<DTMF_Relay_MIME_Type ua="na">application/dtmf-relay</DTMF_Relay_MIME_Type>
+<Hook_Flash_MIME_Type ua="na">application/hook-flash</Hook_Flash_MIME_Type>
+<Remove_Last_Reg ua="na">No</Remove_Last_Reg>
+<Use_Compact_Header ua="na">No</Use_Compact_Header>
+
+
+
+<SIP_T1 ua="na">2</SIP_T1>
+<SIP_T2 ua="na">32</SIP_T2>
+<SIP_T4 ua="na">5</SIP_T4>
+<SIP_Timer_B ua="na">6</SIP_Timer_B>
+<SIP_Timer_F ua="na">31</SIP_Timer_F>
+<SIP_Timer_H ua="na">32</SIP_Timer_H>
+<SIP_Timer_D ua="na">32</SIP_Timer_D>
+<SIP_Timer_J ua="na">32</SIP_Timer_J>
+<INVITE_Expires ua="na">240</INVITE_Expires>
+<ReINVITE_Expires ua="na">30</ReINVITE_Expires>
+<Reg_Min_Expires ua="na">1</Reg_Min_Expires>
+<Reg_Max_Expires ua="na">7200</Reg_Max_Expires>
+<Reg_Retry_Intvl ua="na">60</Reg_Retry_Intvl>
+<Reg_Retry_Long_Intvl ua="na">60</Reg_Retry_Long_Intvl>
+
+
+
+<SIT1_RSC ua="na"></SIT1_RSC>
+<SIT2_RSC ua="na"></SIT2_RSC>
+<SIT3_RSC ua="na"></SIT3_RSC>
+<SIT4_RSC ua="na"></SIT4_RSC>
+
+<Try_Backup_RSC ua="na"></Try_Backup_RSC>
+<Retry_Reg_RSC ua="na"></Retry_Reg_RSC>
+
+
+
+<RTP_Port_Min ua="na">10050</RTP_Port_Min>
+<RTP_Port_Max ua="na">16384</RTP_Port_Max>
+<Max_RTP_ICMP_Err ua="na">0</Max_RTP_ICMP_Err>
+<RTCP_Tx_Interval ua="na">5</RTCP_Tx_Interval>
+
+
+
+<NSE_Dynamic_Payload ua="na">100</NSE_Dynamic_Payload>
+<AVT_Dynamic_Payload ua="na">101</AVT_Dynamic_Payload>
+<G726r16_Dynamic_Payload ua="na">98</G726r16_Dynamic_Payload>
+<G726r24_Dynamic_Payload ua="na">97</G726r24_Dynamic_Payload>
+<G726r40_Dynamic_Payload ua="na">96</G726r40_Dynamic_Payload>
+<G729b_Dynamic_Payload ua="na">99</G729b_Dynamic_Payload>
+
+<NSE_Codec_Name ua="na">NSE</NSE_Codec_Name>
+<AVT_Codec_Name ua="na">telephone-event</AVT_Codec_Name>
+<G711u_Codec_Name ua="na">PCMU</G711u_Codec_Name>
+<G711a_Codec_Name ua="na">PCMA</G711a_Codec_Name>
+<G726r16_Codec_Name ua="na">G726-16</G726r16_Codec_Name>
+<G726r24_Codec_Name ua="na">G726-24</G726r24_Codec_Name>
+<G726r32_Codec_Name ua="na">G726-32</G726r32_Codec_Name>
+<G726r40_Codec_Name ua="na">G726-40</G726r40_Codec_Name>
+<G729a_Codec_Name ua="na">G729</G729a_Codec_Name>
+<G729b_Codec_Name ua="na">G729ab</G729b_Codec_Name>
+<G723_Codec_Name ua="na">G723</G723_Codec_Name>
+
+
+
+<Handle_VIA_received ua="na">Yes</Handle_VIA_received>
+<Handle_VIA_rport ua="na">Yes</Handle_VIA_rport>
+<Insert_VIA_received ua="na">Yes</Insert_VIA_received>
+<Insert_VIA_rport ua="na">Yes</Insert_VIA_rport>
+<Substitute_VIA_Addr ua="na">Yes</Substitute_VIA_Addr>
+<Send_Resp_To_Src_Port ua="na">No</Send_Resp_To_Src_Port>
+<STUN_Enable ua="na">No</STUN_Enable>
+<STUN_Test_Enable ua="na">No</STUN_Test_Enable>
+<STUN_Server ua="na"></STUN_Server>
+<EXT_IP ua="na"></EXT_IP>
+<EXT_RTP_Port_Min ua="na"></EXT_RTP_Port_Min>
+<NAT_Keep_Alive_Intvl ua="na">15</NAT_Keep_Alive_Intvl>
+
+
+
+
+
+
+
+
+<Line_Enable_1_ ua="na">Yes</Line_Enable_1_>
+
+<SAS_Enable_1_ ua="na">No</SAS_Enable_1_>
+<MOH_Server_1_ ua="na"><% io.write(moh) %></MOH_Server_1_>
+<SAS_DLG_Refresh_Intvl_1_ ua="na">30</SAS_DLG_Refresh_Intvl_1_>
+<NAT_Mapping_Enable_1_ ua="na">No</NAT_Mapping_Enable_1_>
+<SAS_Inbound_RTP_Sink_1_ ua="na"></SAS_Inbound_RTP_Sink_1_>
+
+<SIP_Port_1_ ua="na">5060</SIP_Port_1_>
+
+<NAT_Keep_Alive_Enable_1_ ua="na">No</NAT_Keep_Alive_Enable_1_>
+<EXT_SIP_Port_1_ ua="na"></EXT_SIP_Port_1_>
+<NAT_Keep_Alive_Msg_1_ ua="na">$NOTIFY</NAT_Keep_Alive_Msg_1_>
+<SIP_TOS_DiffServ_Value_1_ ua="na">0x68</SIP_TOS_DiffServ_Value_1_>
+<NAT_Keep_Alive_Dest_1_ ua="na">$PROXY</NAT_Keep_Alive_Dest_1_>
+<RTP_TOS_DiffServ_Value_1_ ua="na">0xb8</RTP_TOS_DiffServ_Value_1_>
+
+
+
+<SIP_Debug_Option_1_ ua="na"></SIP_Debug_Option_1_>
+
+<Network_Jitter_Level_1_ ua="na">very high</Network_Jitter_Level_1_>
+<Jitter_Buffer_Adjustment_1_ ua="na">disable</Jitter_Buffer_Adjustment_1_>
+<SIP_100REL_Enable_1_ ua="na">Yes</SIP_100REL_Enable_1_>
+<Blind_Attn-Xfer_Enable_1_ ua="na">Yes</Blind_Attn-Xfer_Enable_1_>
+<Auth_Resync-Reboot_1_ ua="na">No</Auth_Resync-Reboot_1_>
+<Xfer_When_Hangup_Conf_1_ ua="na">Yes</Xfer_When_Hangup_Conf_1_>
+
+
+<RTP_Log_Intvl_1_ ua="na">0</RTP_Log_Intvl_1_>
+<Restrict_Source_IP_1_ ua="na">No</Restrict_Source_IP_1_>
+
+
+
+
+<Proxy_1_ ua="na"><% io.write(server) %></Proxy_1_>
+
+<Use_Outbound_Proxy_1_ ua="na">No</Use_Outbound_Proxy_1_>
+<Outbound_Proxy_1_ ua="na"></Outbound_Proxy_1_>
+<Use_OB_Proxy_In_Dialog_1_ ua="na">Yes</Use_OB_Proxy_In_Dialog_1_>
+
+<Register_1_ ua="na">Yes</Register_1_>
+<Make_Call_Without_Reg_1_ ua="na">No</Make_Call_Without_Reg_1_>
+
+<Register_Expires_1_ ua="na">60</Register_Expires_1_>
+<Ans_Call_Without_Reg_1_ ua="na">Yes</Ans_Call_Without_Reg_1_>
+<Use_DNS_SRV_1_ ua="na">Yes</Use_DNS_SRV_1_>
+<DNS_SRV_Auto_Prefix_1_ ua="na">Yes</DNS_SRV_Auto_Prefix_1_>
+<Proxy_Fallback_Intvl_1_ ua="na">3600</Proxy_Fallback_Intvl_1_>
+<Voice_Mail_Server_1_ ua="na"></Voice_Mail_Server_1_>
+
+
+
+<Display_Name_1_ ua="na"><%= cid %></Display_Name_1_>
+<User_ID_1_ ua="na"><% io.write(values.reg1.extension) %></User_ID_1_>
+<Password_1_ ua="na"><% io.write(values.reg1.password) %></Password_1_>
+<Use_Auth_ID_1_ ua="na">No</Use_Auth_ID_1_>
+<Auth_ID_1_ ua="na"></Auth_ID_1_>
+<Mini_Certificate_1_ ua="na"></Mini_Certificate_1_>
+<SRTP_Private_Key_1_ ua="na"></SRTP_Private_Key_1_>
+
+
+
+<Call_Waiting_Serv_1_ ua="na"><%= yesno(values.services and values.services.callwaitingenable) %></Call_Waiting_Serv_1_>
+<Block_CID_Serv_1_ ua="na">No</Block_CID_Serv_1_>
+<Block_ANC_Serv_1_ ua="na">No</Block_ANC_Serv_1_>
+<Dist_Ring_Serv_1_ ua="na">Yes</Dist_Ring_Serv_1_>
+<Cfwd_All_Serv_1_ ua="na">Yes</Cfwd_All_Serv_1_>
+<Cfwd_Busy_Serv_1_ ua="na">Yes</Cfwd_Busy_Serv_1_>
+<Cfwd_No_Ans_Serv_1_ ua="na">Yes</Cfwd_No_Ans_Serv_1_>
+<Cfwd_Sel_Serv_1_ ua="na">No</Cfwd_Sel_Serv_1_>
+<Cfwd_Last_Serv_1_ ua="na">No</Cfwd_Last_Serv_1_>
+<Block_Last_Serv_1_ ua="na">No</Block_Last_Serv_1_>
+<Accept_Last_Serv_1_ ua="na">No</Accept_Last_Serv_1_>
+<DND_Serv_1_ ua="na">No</DND_Serv_1_>
+<CID_Serv_1_ ua="na">Yes</CID_Serv_1_>
+<CWCID_Serv_1_ ua="na">Yes</CWCID_Serv_1_>
+<Call_Return_Serv_1_ ua="na">No</Call_Return_Serv_1_>
+<Call_Back_Serv_1_ ua="na">Yes</Call_Back_Serv_1_>
+<Three_Way_Call_Serv_1_ ua="na">Yes</Three_Way_Call_Serv_1_>
+<Three_Way_Conf_Serv_1_ ua="na">Yes</Three_Way_Conf_Serv_1_>
+<Attn_Transfer_Serv_1_ ua="na">Yes</Attn_Transfer_Serv_1_>
+<Unattn_Transfer_Serv_1_ ua="na">Yes</Unattn_Transfer_Serv_1_>
+<MWI_Serv_1_ ua="na">Yes</MWI_Serv_1_>
+<VMWI_Serv_1_ ua="na">Yes</VMWI_Serv_1_>
+<Speed_Dial_Serv_1_ ua="na">No</Speed_Dial_Serv_1_>
+<Secure_Call_Serv_1_ ua="na">No</Secure_Call_Serv_1_>
+<Referral_Serv_1_ ua="na">No</Referral_Serv_1_>
+<Feature_Dial_Serv_1_ ua="na">Yes</Feature_Dial_Serv_1_>
+
+
+
+<Preferred_Codec_1_ ua="na">G711u</Preferred_Codec_1_>
+<Silence_Supp_Enable_1_ ua="na">No</Silence_Supp_Enable_1_>
+<Use_Pref_Codec_Only_1_ ua="na">Yes</Use_Pref_Codec_Only_1_>
+<Silence_Threshold_1_ ua="na">medium</Silence_Threshold_1_>
+<Echo_Canc_Enable_1_ ua="na">Yes</Echo_Canc_Enable_1_>
+<G729a_Enable_1_ ua="na">No</G729a_Enable_1_>
+<Echo_Canc_Adapt_Enable_1_ ua="na">Yes</Echo_Canc_Adapt_Enable_1_>
+<G723_Enable_1_ ua="na">No</G723_Enable_1_>
+<Echo_Supp_Enable_1_ ua="na">Yes</Echo_Supp_Enable_1_>
+<G726-16_Enable_1_ ua="na">No</G726-16_Enable_1_>
+<FAX_CED_Detect_Enable_1_ ua="na">Yes</FAX_CED_Detect_Enable_1_>
+<G726-24_Enable_1_ ua="na">No</G726-24_Enable_1_>
+<FAX_CNG_Detect_Enable_1_ ua="na">Yes</FAX_CNG_Detect_Enable_1_>
+<G726-32_Enable_1_ ua="na">Yes</G726-32_Enable_1_>
+<FAX_Passthru_Codec_1_ ua="na">G711u</FAX_Passthru_Codec_1_>
+<G726-40_Enable_1_ ua="na">No</G726-40_Enable_1_>
+<FAX_Codec_Symmetric_1_ ua="na">Yes</FAX_Codec_Symmetric_1_>
+<DTMF_Tx_Method_1_ ua="na">Auto</DTMF_Tx_Method_1_>
+<FAX_Passthru_Method_1_ ua="na">ReINVITE</FAX_Passthru_Method_1_>
+<Hook_Flash_Tx_Method_1_ ua="na">None</Hook_Flash_Tx_Method_1_>
+<FAX_Process_NSE_1_ ua="na">Yes</FAX_Process_NSE_1_>
+<Release_Unused_Codec_1_ ua="na">No</Release_Unused_Codec_1_>
+
+
+<Dial_Plan_1_ ua="na"><% io.write(dialpattern) %></Dial_Plan_1_>
+
+<Enable_IP_Dialing_1_ ua="na">No</Enable_IP_Dialing_1_>
+
+
+
+<Idle_Polarity_1_ ua="na">Forward</Idle_Polarity_1_>
+<Caller_Conn_Polarity_1_ ua="na">Forward</Caller_Conn_Polarity_1_>
+<Callee_Conn_Polarity_1_ ua="na">Forward</Callee_Conn_Polarity_1_>
+
+
+<%
+ if values.services and values.services.forwarding and values.reg1 then
+ local pg_t = values.reg1
+ local fwddata = {}
+
+ if pg_t.forwardallenable then
+ fwddata.all = pg_t.forwardall
+ else
+ fwddata.all = ""
+ end
+ if pg_t.forwardbusyenable then
+ fwddata.busy = pg_t.forwardbusy
+ else
+ fwddata.busy = ""
+ end
+ if pg_t.forwardnoanswerenable then
+ fwddata.noanswer = pg_t.forwardnoanswer
+ fwddata.noanswerdelay = "20"
+ else
+ fwddata.noanswer = ""
+ fwddata.noanswerdelay = ""
+ end
+%>
+<Cfwd_All_Dest_1_ ua="na"><%= fwddata.all %></Cfwd_All_Dest_1_>
+<Cfwd_Busy_Dest_1_ ua="na"><%= fwddata.busy %></Cfwd_Busy_Dest_1_>
+<Cfwd_No_Ans_Dest_1_ ua="na"><%= fwddata.noanswer %></Cfwd_No_Ans_Dest_1_>
+<Cfwd_No_Ans_Delay_1_ ua="na"><%= fwddata.noanswerdelay %></Cfwd_No_Ans_Delay_1_>
+<%
+ end
+%>
+
+
+<Cfwd_Sel1_Caller_1_ ua="na"></Cfwd_Sel1_Caller_1_>
+<Cfwd_Sel1_Dest_1_ ua="na"></Cfwd_Sel1_Dest_1_>
+<Cfwd_Sel2_Caller_1_ ua="na"></Cfwd_Sel2_Caller_1_>
+<Cfwd_Sel2_Dest_1_ ua="na"></Cfwd_Sel2_Dest_1_>
+<Cfwd_Sel3_Caller_1_ ua="na"></Cfwd_Sel3_Caller_1_>
+<Cfwd_Sel3_Dest_1_ ua="na"></Cfwd_Sel3_Dest_1_>
+<Cfwd_Sel4_Caller_1_ ua="na"></Cfwd_Sel4_Caller_1_>
+<Cfwd_Sel4_Dest_1_ ua="na"></Cfwd_Sel4_Dest_1_>
+<Cfwd_Sel5_Caller_1_ ua="na"></Cfwd_Sel5_Caller_1_>
+<Cfwd_Sel5_Dest_1_ ua="na"></Cfwd_Sel5_Dest_1_>
+<Cfwd_Sel6_Caller_1_ ua="na"></Cfwd_Sel6_Caller_1_>
+<Cfwd_Sel6_Dest_1_ ua="na"></Cfwd_Sel6_Dest_1_>
+<Cfwd_Sel7_Caller_1_ ua="na"></Cfwd_Sel7_Caller_1_>
+<Cfwd_Sel7_Dest_1_ ua="na"></Cfwd_Sel7_Dest_1_>
+<Cfwd_Sel8_Caller_1_ ua="na"></Cfwd_Sel8_Caller_1_>
+<Cfwd_Sel8_Dest_1_ ua="na"></Cfwd_Sel8_Dest_1_>
+
+<Cfwd_Last_Caller_1_ ua="na"></Cfwd_Last_Caller_1_>
+<Cfwd_Last_Dest_1_ ua="na"></Cfwd_Last_Dest_1_>
+<Block_Last_Caller_1_ ua="na"></Block_Last_Caller_1_>
+<Accept_Last_Caller_1_ ua="na"></Accept_Last_Caller_1_>
+
+
+
+<Speed_Dial_2_1_ ua="na"></Speed_Dial_2_1_>
+<Speed_Dial_3_1_ ua="na"></Speed_Dial_3_1_>
+<Speed_Dial_4_1_ ua="na"></Speed_Dial_4_1_>
+<Speed_Dial_5_1_ ua="na"></Speed_Dial_5_1_>
+<Speed_Dial_6_1_ ua="na"></Speed_Dial_6_1_>
+<Speed_Dial_7_1_ ua="na"></Speed_Dial_7_1_>
+<Speed_Dial_8_1_ ua="na"></Speed_Dial_8_1_>
+<Speed_Dial_9_1_ ua="na"></Speed_Dial_9_1_>
+
+
+
+
+<Block_CID_Setting_1_ ua="na">No</Block_CID_Setting_1_>
+<Block_ANC_Setting_1_ ua="na">No</Block_ANC_Setting_1_>
+<DND_Setting_1_ ua="na">No</DND_Setting_1_>
+<CID_Setting_1_ ua="na">Yes</CID_Setting_1_>
+<CWCID_Setting_1_ ua="na">Yes</CWCID_Setting_1_>
+<Dist_Ring_Setting_1_ ua="na">Yes</Dist_Ring_Setting_1_>
+<Secure_Call_Setting_1_ ua="na">No</Secure_Call_Setting_1_>
+
+<Message_Waiting_1_ ua="na">No</Message_Waiting_1_>
+
+
+
+<Ring1_Caller_1_ ua="na"></Ring1_Caller_1_>
+<Ring2_Caller_1_ ua="na"></Ring2_Caller_1_>
+<Ring3_Caller_1_ ua="na"></Ring3_Caller_1_>
+<Ring4_Caller_1_ ua="na"></Ring4_Caller_1_>
+<Ring5_Caller_1_ ua="na"></Ring5_Caller_1_>
+<Ring6_Caller_1_ ua="na"></Ring6_Caller_1_>
+<Ring7_Caller_1_ ua="na"></Ring7_Caller_1_>
+<Ring8_Caller_1_ ua="na"></Ring8_Caller_1_>
+
+
+
+<Default_Ring_1_ ua="na">1</Default_Ring_1_>
+<Default_CWT_1_ ua="na">1</Default_CWT_1_>
+<Hold_Reminder_Ring_1_ ua="na">8</Hold_Reminder_Ring_1_>
+<Call_Back_Ring_1_ ua="na"></Call_Back_Ring_1_>
+
+<Cfwd_Ring_Splash_Len_1_ ua="na">0</Cfwd_Ring_Splash_Len_1_>
+<Cblk_Ring_Splash_Len_1_ ua="na">0</Cblk_Ring_Splash_Len_1_>
+<VMWI_Ring_Splash_Len_1_ ua="na">0</VMWI_Ring_Splash_Len_1_>
+<VMWI_Ring_Policy_1_ ua="na">New VM Available</VMWI_Ring_Policy_1_>
+<Ring_On_No_New_VM_1_ ua="na">No</Ring_On_No_New_VM_1_>
+
+
+
+
+<Line_Enable_2_ ua="na">No</Line_Enable_2_>
+
+<SAS_Enable_2_ ua="na">No</SAS_Enable_2_>
+<MOH_Server_2_ ua="na"></MOH_Server_2_>
+<SAS_DLG_Refresh_Intvl_2_ ua="na">30</SAS_DLG_Refresh_Intvl_2_>
+<NAT_Mapping_Enable_2_ ua="na">No</NAT_Mapping_Enable_2_>
+<SAS_Inbound_RTP_Sink_2_ ua="na"></SAS_Inbound_RTP_Sink_2_>
+
+<SIP_Port_2_ ua="na">5060</SIP_Port_2_>
+
+<NAT_Keep_Alive_Enable_2_ ua="na">Yes</NAT_Keep_Alive_Enable_2_>
+<EXT_SIP_Port_2_ ua="na"></EXT_SIP_Port_2_>
+<NAT_Keep_Alive_Msg_2_ ua="na">$NOTIFY</NAT_Keep_Alive_Msg_2_>
+<SIP_TOS_DiffServ_Value_2_ ua="na">0x68</SIP_TOS_DiffServ_Value_2_>
+<NAT_Keep_Alive_Dest_2_ ua="na">$PROXY</NAT_Keep_Alive_Dest_2_>
+<RTP_TOS_DiffServ_Value_2_ ua="na">0xb8</RTP_TOS_DiffServ_Value_2_>
+
+
+
+<SIP_Debug_Option_2_ ua="na"></SIP_Debug_Option_2_>
+
+
+
+<Network_Jitter_Level_2_ ua="na">high</Network_Jitter_Level_2_>
+<SIP_100REL_Enable_2_ ua="na">No</SIP_100REL_Enable_2_>
+<Blind_Attn-Xfer_Enable_2_ ua="na">No</Blind_Attn-Xfer_Enable_2_>
+<Auth_Resync-Reboot_2_ ua="na">No</Auth_Resync-Reboot_2_>
+<Xfer_When_Hangup_Conf_2_ ua="na">No</Xfer_When_Hangup_Conf_2_>
+
+
+<RTP_Log_Intvl_2_ ua="na">0</RTP_Log_Intvl_2_>
+<Restrict_Source_IP_2_ ua="na">No</Restrict_Source_IP_2_>
+
+
+
+
+<Proxy_2_ ua="na"></Proxy_2_>
+
+<Use_Outbound_Proxy_2_ ua="na">No</Use_Outbound_Proxy_2_>
+<Outbound_Proxy_2_ ua="na"></Outbound_Proxy_2_>
+<Use_OB_Proxy_In_Dialog_2_ ua="na">Yes</Use_OB_Proxy_In_Dialog_2_>
+
+<Register_2_ ua="na">Yes</Register_2_>
+<Make_Call_Without_Reg_2_ ua="na">No</Make_Call_Without_Reg_2_>
+
+<Register_Expires_2_ ua="na">60</Register_Expires_2_>
+<Ans_Call_Without_Reg_2_ ua="na">Yes</Ans_Call_Without_Reg_2_>
+<Use_DNS_SRV_2_ ua="na">No</Use_DNS_SRV_2_>
+<DNS_SRV_Auto_Prefix_2_ ua="na">No</DNS_SRV_Auto_Prefix_2_>
+<Proxy_Fallback_Intvl_2_ ua="na">3600</Proxy_Fallback_Intvl_2_>
+<Voice_Mail_Server_2_ ua="na">2147483647</Voice_Mail_Server_2_>
+
+
+
+<Display_Name_2_ ua="na"></Display_Name_2_>
+<User_ID_2_ ua="na"></User_ID_2_>
+<Password_2_ ua="na"></Password_2_>
+<Use_Auth_ID_2_ ua="na">No</Use_Auth_ID_2_>
+<Auth_ID_2_ ua="na"></Auth_ID_2_>
+<Mini_Certificate_2_ ua="na"></Mini_Certificate_2_>
+<SRTP_Private_Key_2_ ua="na"></SRTP_Private_Key_2_>
+
+
+
+<Call_Waiting_Serv_2_ ua="na">Yes</Call_Waiting_Serv_2_>
+<Block_CID_Serv_2_ ua="na">Yes</Block_CID_Serv_2_>
+<Block_ANC_Serv_2_ ua="na">No</Block_ANC_Serv_2_>
+<Dist_Ring_Serv_2_ ua="na">Yes</Dist_Ring_Serv_2_>
+<Cfwd_All_Serv_2_ ua="na">No</Cfwd_All_Serv_2_>
+<Cfwd_Busy_Serv_2_ ua="na">No</Cfwd_Busy_Serv_2_>
+<Cfwd_No_Ans_Serv_2_ ua="na">No</Cfwd_No_Ans_Serv_2_>
+<Cfwd_Sel_Serv_2_ ua="na">No</Cfwd_Sel_Serv_2_>
+<Cfwd_Last_Serv_2_ ua="na">No</Cfwd_Last_Serv_2_>
+<Block_Last_Serv_2_ ua="na">No</Block_Last_Serv_2_>
+<Accept_Last_Serv_2_ ua="na">No</Accept_Last_Serv_2_>
+<DND_Serv_2_ ua="na">No</DND_Serv_2_>
+<CID_Serv_2_ ua="na">Yes</CID_Serv_2_>
+<CWCID_Serv_2_ ua="na">Yes</CWCID_Serv_2_>
+<Call_Return_Serv_2_ ua="na">No</Call_Return_Serv_2_>
+<Call_Back_Serv_2_ ua="na">Yes</Call_Back_Serv_2_>
+<Three_Way_Call_Serv_2_ ua="na">Yes</Three_Way_Call_Serv_2_>
+<Three_Way_Conf_Serv_2_ ua="na">Yes</Three_Way_Conf_Serv_2_>
+<Attn_Transfer_Serv_2_ ua="na">Yes</Attn_Transfer_Serv_2_>
+<Unattn_Transfer_Serv_2_ ua="na">Yes</Unattn_Transfer_Serv_2_>
+<MWI_Serv_2_ ua="na">Yes</MWI_Serv_2_>
+<VMWI_Serv_2_ ua="na">Yes</VMWI_Serv_2_>
+<Speed_Dial_Serv_2_ ua="na">No</Speed_Dial_Serv_2_>
+<Secure_Call_Serv_2_ ua="na">No</Secure_Call_Serv_2_>
+<Referral_Serv_2_ ua="na">No</Referral_Serv_2_>
+<Feature_Dial_Serv_2_ ua="na">Yes</Feature_Dial_Serv_2_>
+
+
+
+<Preferred_Codec_2_ ua="na">G711u</Preferred_Codec_2_>
+<Silence_Supp_Enable_2_ ua="na">No</Silence_Supp_Enable_2_>
+<Use_Pref_Codec_Only_2_ ua="na">Yes</Use_Pref_Codec_Only_2_>
+<Silence_Threshold_2_ ua="na">medium</Silence_Threshold_2_>
+<Echo_Canc_Enable_2_ ua="na">Yes</Echo_Canc_Enable_2_>
+<G729a_Enable_2_ ua="na">Yes</G729a_Enable_2_>
+<Echo_Canc_Adapt_Enable_2_ ua="na">Yes</Echo_Canc_Adapt_Enable_2_>
+<G723_Enable_2_ ua="na">No</G723_Enable_2_>
+<Echo_Supp_Enable_2_ ua="na">Yes</Echo_Supp_Enable_2_>
+<G726-16_Enable_2_ ua="na">No</G726-16_Enable_2_>
+<FAX_CED_Detect_Enable_2_ ua="na">Yes</FAX_CED_Detect_Enable_2_>
+<G726-24_Enable_2_ ua="na">No</G726-24_Enable_2_>
+<FAX_CNG_Detect_Enable_2_ ua="na">Yes</FAX_CNG_Detect_Enable_2_>
+<G726-32_Enable_2_ ua="na">Yes</G726-32_Enable_2_>
+<FAX_Passthru_Codec_2_ ua="na">G711u</FAX_Passthru_Codec_2_>
+<G726-40_Enable_2_ ua="na">No</G726-40_Enable_2_>
+<FAX_Codec_Symmetric_2_ ua="na">Yes</FAX_Codec_Symmetric_2_>
+<DTMF_Tx_Method_2_ ua="na">Auto</DTMF_Tx_Method_2_>
+<FAX_Passthru_Method_2_ ua="na">ReINVITE</FAX_Passthru_Method_2_>
+<Hook_Flash_Tx_Method_2_ ua="na">None</Hook_Flash_Tx_Method_2_>
+<FAX_Process_NSE_2_ ua="na">Yes</FAX_Process_NSE_2_>
+<Release_Unused_Codec_2_ ua="na">Yes</Release_Unused_Codec_2_>
+
+
+
+<Dial_Plan_2_ ua="na">(&lt;:1123&gt;[2-9]xxxxxxS0|&lt;411:18003733411&gt;|*xx|[369]11S0|0|00|011[2-9]x.|1xxx[2-9]xxxxxxS0|xxxxxxxxxxxx.)</Dial_Plan_2_>
+
+<Enable_IP_Dialing_2_ ua="na">No</Enable_IP_Dialing_2_>
+
+
+
+<Idle_Polarity_2_ ua="na">Forward</Idle_Polarity_2_>
+<Caller_Conn_Polarity_2_ ua="na">Forward</Caller_Conn_Polarity_2_>
+<Callee_Conn_Polarity_2_ ua="na">Forward</Callee_Conn_Polarity_2_>
+
+
+
+<Cfwd_All_Dest_2_ ua="na"></Cfwd_All_Dest_2_>
+<Cfwd_Busy_Dest_2_ ua="na"></Cfwd_Busy_Dest_2_>
+<Cfwd_No_Ans_Dest_2_ ua="na"></Cfwd_No_Ans_Dest_2_>
+<Cfwd_No_Ans_Delay_2_ ua="na"></Cfwd_No_Ans_Delay_2_>
+
+
+
+<Cfwd_Sel1_Caller_2_ ua="na"></Cfwd_Sel1_Caller_2_>
+<Cfwd_Sel1_Dest_2_ ua="na"></Cfwd_Sel1_Dest_2_>
+<Cfwd_Sel2_Caller_2_ ua="na"></Cfwd_Sel2_Caller_2_>
+<Cfwd_Sel2_Dest_2_ ua="na"></Cfwd_Sel2_Dest_2_>
+<Cfwd_Sel3_Caller_2_ ua="na"></Cfwd_Sel3_Caller_2_>
+<Cfwd_Sel3_Dest_2_ ua="na"></Cfwd_Sel3_Dest_2_>
+<Cfwd_Sel4_Caller_2_ ua="na"></Cfwd_Sel4_Caller_2_>
+<Cfwd_Sel4_Dest_2_ ua="na"></Cfwd_Sel4_Dest_2_>
+<Cfwd_Sel5_Caller_2_ ua="na"></Cfwd_Sel5_Caller_2_>
+<Cfwd_Sel5_Dest_2_ ua="na"></Cfwd_Sel5_Dest_2_>
+<Cfwd_Sel6_Caller_2_ ua="na"></Cfwd_Sel6_Caller_2_>
+<Cfwd_Sel6_Dest_2_ ua="na"></Cfwd_Sel6_Dest_2_>
+<Cfwd_Sel7_Caller_2_ ua="na"></Cfwd_Sel7_Caller_2_>
+<Cfwd_Sel7_Dest_2_ ua="na"></Cfwd_Sel7_Dest_2_>
+<Cfwd_Sel8_Caller_2_ ua="na"></Cfwd_Sel8_Caller_2_>
+<Cfwd_Sel8_Dest_2_ ua="na"></Cfwd_Sel8_Dest_2_>
+
+<Cfwd_Last_Caller_2_ ua="na"></Cfwd_Last_Caller_2_>
+<Cfwd_Last_Dest_2_ ua="na"></Cfwd_Last_Dest_2_>
+<Block_Last_Caller_2_ ua="na"></Block_Last_Caller_2_>
+<Accept_Last_Caller_2_ ua="na"></Accept_Last_Caller_2_>
+
+
+
+<Speed_Dial_2_2_ ua="na"></Speed_Dial_2_2_>
+<Speed_Dial_3_2_ ua="na"></Speed_Dial_3_2_>
+<Speed_Dial_4_2_ ua="na"></Speed_Dial_4_2_>
+<Speed_Dial_5_2_ ua="na"></Speed_Dial_5_2_>
+<Speed_Dial_6_2_ ua="na"></Speed_Dial_6_2_>
+<Speed_Dial_7_2_ ua="na"></Speed_Dial_7_2_>
+<Speed_Dial_8_2_ ua="na"></Speed_Dial_8_2_>
+<Speed_Dial_9_2_ ua="na"></Speed_Dial_9_2_>
+
+
+
+
+<Block_CID_Setting_2_ ua="na">No</Block_CID_Setting_2_>
+<Block_ANC_Setting_2_ ua="na">No</Block_ANC_Setting_2_>
+<DND_Setting_2_ ua="na">No</DND_Setting_2_>
+<CID_Setting_2_ ua="na">Yes</CID_Setting_2_>
+<CWCID_Setting_2_ ua="na">Yes</CWCID_Setting_2_>
+<Dist_Ring_Setting_2_ ua="na">Yes</Dist_Ring_Setting_2_>
+<Secure_Call_Setting_2_ ua="na">No</Secure_Call_Setting_2_>
+
+<Message_Waiting_2_ ua="na"/>
+
+
+
+<Ring1_Caller_2_ ua="na"></Ring1_Caller_2_>
+<Ring2_Caller_2_ ua="na"></Ring2_Caller_2_>
+<Ring3_Caller_2_ ua="na"></Ring3_Caller_2_>
+<Ring4_Caller_2_ ua="na"></Ring4_Caller_2_>
+<Ring5_Caller_2_ ua="na"></Ring5_Caller_2_>
+<Ring6_Caller_2_ ua="na"></Ring6_Caller_2_>
+<Ring7_Caller_2_ ua="na"></Ring7_Caller_2_>
+<Ring8_Caller_2_ ua="na"></Ring8_Caller_2_>
+
+
+
+<Default_Ring_2_ ua="na">1</Default_Ring_2_>
+<Default_CWT_2_ ua="na">1</Default_CWT_2_>
+<Hold_Reminder_Ring_2_ ua="na">8</Hold_Reminder_Ring_2_>
+<Call_Back_Ring_2_ ua="na"></Call_Back_Ring_2_>
+
+<Cfwd_Ring_Splash_Len_2_ ua="na">0</Cfwd_Ring_Splash_Len_2_>
+<Cblk_Ring_Splash_Len_2_ ua="na">0</Cblk_Ring_Splash_Len_2_>
+<VMWI_Ring_Splash_Len_2_ ua="na">0</VMWI_Ring_Splash_Len_2_>
+<VMWI_Ring_Policy_2_ ua="na">New VM Available</VMWI_Ring_Policy_2_>
+<Ring_On_No_New_VM_2_ ua="na">No</Ring_On_No_New_VM_2_>
+
+
+<CW_Setting_1_ ua="na">1</CW_Setting_1_>
+<CW_Setting_2_ ua="na">1</CW_Setting_2_>
+
+<RTP_Packet_Size ua="na">.020</RTP_Packet_Size>
+
+
+<Dial_Tone ua="na">350@-19,440@-19;10(*/0/1+2)</Dial_Tone>
+<Second_Dial_Tone ua="na">350@-19,440@-19;10(*/0/1+2)</Second_Dial_Tone>
+<Outside_Dial_Tone ua="na">350@-19,440@-19;10(*/0/1+2)</Outside_Dial_Tone>
+<Prompt_Tone ua="na">350@-19,440@-19;10(*/0/1+2)</Prompt_Tone>
+<Busy_Tone ua="na">480@-19,620@-19;10(.5/.5/1+2)</Busy_Tone>
+<Reorder_Tone ua="na">480@-19,620@-19;10(.25/.25/1+2)</Reorder_Tone>
+<Off_Hook_Warning_Tone ua="na">480@-10,620@0;10(.125/.125/1+2)</Off_Hook_Warning_Tone>
+<Ring_Back_Tone ua="na">440@-19,480@-19;*(2/4/1+2)</Ring_Back_Tone>
+<Confirm_Tone ua="na">600@-16;1(.25/.25/1)</Confirm_Tone>
+<SIT1_Tone ua="na">985@-16,1428@-16,1777@-16;20(.380/0/1,.380/0/2,.380/0/3,0/4/0)</SIT1_Tone>
+<SIT2_Tone ua="na">914@-16,1371@-16,1777@-16;20(.274/0/1,.274/0/2,.380/0/3,0/4/0)</SIT2_Tone>
+<SIT3_Tone ua="na">914@-16,1371@-16,1777@-16;20(.380/0/1,.380/0/2,.380/0/3,0/4/0)</SIT3_Tone>
+<SIT4_Tone ua="na">985@-16,1371@-16,1777@-16;20(.380/0/1,.274/0/2,.380/0/3,0/4/0)</SIT4_Tone>
+<MWI_Dial_Tone ua="na">350@-19,440@-19;2(.1/.1/1+2);10(*/0/1+2)</MWI_Dial_Tone>
+<Cfwd_Dial_Tone ua="na">350@-19,440@-19;2(.2/.2/1+2);10(*/0/1+2)</Cfwd_Dial_Tone>
+<Holding_Tone ua="na">600@-19;*(.1/.1/1,.1/.1/1,.1/9.5/1)</Holding_Tone>
+<Conference_Tone ua="na">350@-19;20(.1/.1/1,.1/9.7/1)</Conference_Tone>
+<Secure_Call_Indication_Tone ua="na">397@-19,507@-19;15(0/2/0,.2/.1/1,.1/2.1/2)</Secure_Call_Indication_Tone>
+
+
+
+<Ring1_Cadence ua="na">60(2/4)</Ring1_Cadence>
+<Ring2_Cadence ua="na">60(.3/.2,1/.2,.3/4)</Ring2_Cadence>
+<Ring3_Cadence ua="na">60(.8/.4,.8/4)</Ring3_Cadence>
+<Ring4_Cadence ua="na">60(.4/.2,.3/.2,.8/4)</Ring4_Cadence>
+<Ring5_Cadence ua="na">60(.2/.2,.2/.2,.2/.2,1/4)</Ring5_Cadence>
+<Ring6_Cadence ua="na">60(.2/.4,.2/.4,.2/4)</Ring6_Cadence>
+<Ring7_Cadence ua="na">60(.4/.2,.4/.2,.4/4)</Ring7_Cadence>
+<Ring8_Cadence ua="na">60(0.25/9.75)</Ring8_Cadence>
+
+
+
+<CWT1_Cadence ua="na">30(.3/3.7)</CWT1_Cadence>
+<CWT2_Cadence ua="na">30(.1/.1, .1/9.7)</CWT2_Cadence>
+<CWT3_Cadence ua="na">30(.1/.1, .3/.1, .1/9.3)</CWT3_Cadence>
+<CWT4_Cadence ua="na">30(.1/.1,.1/.1,.1/9.5)</CWT4_Cadence>
+<CWT5_Cadence ua="na">30(.3/.1,.1/.1,.3/9.1)</CWT5_Cadence>
+<CWT6_Cadence ua="na">30(.1/.1,.3/.2,.3/9.1)</CWT6_Cadence>
+<CWT7_Cadence ua="na">30(.3/.1,.3/.1,.1/9.1)</CWT7_Cadence>
+<CWT8_Cadence ua="na">2.3(.3/2)</CWT8_Cadence>
+
+
+
+<Ring1_Name ua="na">Bellcore-dr1</Ring1_Name>
+<Ring2_Name ua="na">Bellcore-dr2</Ring2_Name>
+<Ring3_Name ua="na">Bellcore-dr3</Ring3_Name>
+<Ring4_Name ua="na">Bellcore-dr4</Ring4_Name>
+<Ring5_Name ua="na">Bellcore-dr5</Ring5_Name>
+<Ring6_Name ua="na">Bellcore-dr6</Ring6_Name>
+<Ring7_Name ua="na">Bellcore-dr7</Ring7_Name>
+<Ring8_Name ua="na">Bellcore-dr8</Ring8_Name>
+
+
+
+<Ring_Waveform ua="na">Sinusoid</Ring_Waveform>
+<Ring_Frequency ua="na">20</Ring_Frequency>
+<Ring_Voltage ua="na">90</Ring_Voltage>
+<CWT_Frequency ua="na">440@-10</CWT_Frequency>
+<Synchronized_Ring ua="na">Yes</Synchronized_Ring>
+
+
+
+<Hook_Flash_Timer_Min ua="na">.1</Hook_Flash_Timer_Min>
+<Hook_Flash_Timer_Max ua="na">1.0</Hook_Flash_Timer_Max>
+<Callee_On_Hook_Delay ua="na">0</Callee_On_Hook_Delay>
+<Reorder_Delay ua="na">0</Reorder_Delay>
+<Call_Back_Expires ua="na">4500</Call_Back_Expires>
+<Call_Back_Retry_Intvl ua="na">90</Call_Back_Retry_Intvl>
+<Call_Back_Delay ua="na">2</Call_Back_Delay>
+<VMWI_Refresh_Intvl ua="na">0</VMWI_Refresh_Intvl>
+<Interdigit_Long_Timer ua="na">8</Interdigit_Long_Timer>
+<Interdigit_Short_Timer ua="na">4</Interdigit_Short_Timer>
+<CPC_Delay ua="na">2</CPC_Delay>
+<CPC_Duration ua="na">0</CPC_Duration>
+
+
+
+<Call_Return_Code ua="na"></Call_Return_Code>
+<Blind_Transfer_Code ua="na">*98</Blind_Transfer_Code>
+<Call_Back_Act_Code ua="na"></Call_Back_Act_Code>
+<Call_Back_Deact_Code ua="na"></Call_Back_Deact_Code>
+<Cfwd_All_Act_Code ua="na"></Cfwd_All_Act_Code>
+<Cfwd_All_Deact_Code ua="na"></Cfwd_All_Deact_Code>
+<Cfwd_Busy_Act_Code ua="na"></Cfwd_Busy_Act_Code>
+<Cfwd_Busy_Deact_Code ua="na"></Cfwd_Busy_Deact_Code>
+<Cfwd_No_Ans_Act_Code ua="na"></Cfwd_No_Ans_Act_Code>
+<Cfwd_No_Ans_Deact_Code ua="na"></Cfwd_No_Ans_Deact_Code>
+<Cfwd_Last_Act_Code ua="na"></Cfwd_Last_Act_Code>
+<Cfwd_Last_Deact_Code ua="na"></Cfwd_Last_Deact_Code>
+<Block_Last_Act_Code ua="na"></Block_Last_Act_Code>
+<Block_Last_Deact_Code ua="na"></Block_Last_Deact_Code>
+<Accept_Last_Act_Code ua="na"></Accept_Last_Act_Code>
+<Accept_Last_Deact_Code ua="na"></Accept_Last_Deact_Code>
+<CW_Act_Code ua="na"></CW_Act_Code>
+<CW_Deact_Code ua="na"></CW_Deact_Code>
+<CW_Per_Call_Act_Code ua="na"></CW_Per_Call_Act_Code>
+<CW_Per_Call_Deact_Code ua="na"></CW_Per_Call_Deact_Code>
+<Block_CID_Act_Code ua="na"></Block_CID_Act_Code>
+<Block_CID_Deact_Code ua="na"></Block_CID_Deact_Code>
+<Block_CID_Per_Call_Act_Code ua="na"></Block_CID_Per_Call_Act_Code>
+<Block_CID_Per_Call_Deact_Code ua="na"></Block_CID_Per_Call_Deact_Code>
+<Block_ANC_Act_Code ua="na"></Block_ANC_Act_Code>
+<Block_ANC_Deact_Code ua="na"></Block_ANC_Deact_Code>
+<DND_Act_Code ua="na"></DND_Act_Code>
+<DND_Deact_Code ua="na"></DND_Deact_Code>
+<CID_Act_Code ua="na"></CID_Act_Code>
+<CID_Deact_Code ua="na"></CID_Deact_Code>
+<CWCID_Act_Code ua="na"></CWCID_Act_Code>
+<CWCID_Deact_Code ua="na"></CWCID_Deact_Code>
+<Dist_Ring_Act_Code ua="na"></Dist_Ring_Act_Code>
+<Dist_Ring_Deact_Code ua="na"></Dist_Ring_Deact_Code>
+<Speed_Dial_Act_Code ua="na"></Speed_Dial_Act_Code>
+<Secure_All_Call_Act_Code ua="na"></Secure_All_Call_Act_Code>
+<Secure_No_Call_Act_Code ua="na"></Secure_No_Call_Act_Code>
+<Secure_One_Call_Act_Code ua="na"></Secure_One_Call_Act_Code>
+<Secure_One_Call_Deact_Code ua="na"></Secure_One_Call_Deact_Code>
+<Conference_Act_Code ua="na"></Conference_Act_Code>
+<Attn-Xfer_Act_Code ua="na"></Attn-Xfer_Act_Code>
+<Referral_Services_Codes ua="na"></Referral_Services_Codes>
+<Feature_Dial_Services_Codes ua="na"></Feature_Dial_Services_Codes>
+
+
+
+
+<Prefer_G711u_Code ua="na"></Prefer_G711u_Code>
+<Force_G711u_Code ua="na"></Force_G711u_Code>
+<Prefer_G711a_Code ua="na"></Prefer_G711a_Code>
+<Force_G711a_Code ua="na"></Force_G711a_Code>
+<Prefer_G723_Code ua="na"></Prefer_G723_Code>
+<Force_G723_Code ua="na"></Force_G723_Code>
+<Prefer_G726r16_Code ua="na"></Prefer_G726r16_Code>
+<Force_G726r16_Code ua="na"></Force_G726r16_Code>
+<Prefer_G726r24_Code ua="na"></Prefer_G726r24_Code>
+<Force_G726r24_Code ua="na"></Force_G726r24_Code>
+<Prefer_G726r32_Code ua="na"></Prefer_G726r32_Code>
+<Force_G726r32_Code ua="na"></Force_G726r32_Code>
+<Prefer_G726r40_Code ua="na"></Prefer_G726r40_Code>
+<Force_G726r40_Code ua="na"></Force_G726r40_Code>
+<Prefer_G729a_Code ua="na"></Prefer_G729a_Code>
+<Force_G729a_Code ua="na"></Force_G729a_Code>
+
+<Modem_Line_Toggle_Code ua="na">*99</Modem_Line_Toggle_Code>
+
+
+<Set_Local_Date__mm_dd_ ua="na"/>
+<Set_Local_Time__HH_mm_ ua="na"/>
+
+<Time_Zone ua="na">
+
+
+GMT-05:00
+</Time_Zone>
+
+<Daylight_Saving_Time_Rule ua="na">
+start=3/8/7/2:0:0;end=11/1/7/2:0:0;save=1
+</Daylight_Saving_Time_Rule>
+
+<FXS_Port_Impedance ua="na">
+600</FXS_Port_Impedance>
+
+<FXS_Port_Input_Gain ua="na">-6</FXS_Port_Input_Gain>
+<FXS_Port_Output_Gain ua="na">-3</FXS_Port_Output_Gain>
+<DTMF_Playback_Level ua="na">-16</DTMF_Playback_Level>
+<DTMF_Playback_Length ua="na">.1</DTMF_Playback_Length>
+<Detect_ABCD ua="na">Yes</Detect_ABCD>
+<Playback_ABCD ua="na">Yes</Playback_ABCD>
+<Caller_ID_Method ua="na">Bellcore(N.Amer,China)</Caller_ID_Method>
+<FXS_Port_Power_Limit ua="na">5</FXS_Port_Power_Limit>
+
+<More_Echo_Suppression ua="na">Yes</More_Echo_Suppression>
+
+<Protect_IVR_FactoryReset ua="na">Yes</Protect_IVR_FactoryReset>
+
+</flat-profile>
+
+<%
+-- DEBUGGING
+--require("session")
+--io.write(session.serialize("values", values))
+%>
diff --git a/config/templates/polycom-template.lua b/config/templates/polycom-template.lua
new file mode 100644
index 0000000..5ed35a3
--- /dev/null
+++ b/config/templates/polycom-template.lua
@@ -0,0 +1,346 @@
+<?xml version="1.0" standalone="yes"?>
+
+<%
+-- Polycom Configuration File Template
+-- We use single quotes to avoid escaping XML's double quotes
+
+-- It is important that the first line be the XML declaration
+
+--[[
+ Implemented parameters:
+ values = {
+ device = {
+ adminpassword
+ digitmap
+ digitmaptimeout
+ homepage
+ musiconhold
+ pcportenable
+ registrar
+ sntpserver
+ timezone
+ urldialingenable
+ }
+ regX (where X is a number 1-34) = {
+ extension = EXTEN
+ password = string
+ forwardall = EXTEN
+ forwardallenable = boolean
+ forwardbusy = EXTEN (allow URI?)
+ forwardbusyenable = boolean
+ forwardnoanswer = EXTEN
+ forwardnoanswerenable = boolean
+ }
+ -- Assuming that services will not be nil
+ services = {
+ callhistoryenable = boolean
+ callwaitingenable = boolean
+ forwarding = boolean
+ hotlinedestination = string
+ hotlineenable = boolean
+ mailbox = string
+ speeddialenable = boolean
+ }
+--]]
+%>
+
+<dynamicConfig
+
+<% -- GLOBAL OPTIONS %>
+
+<% --- 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
+end
+%>
+
+<%
+
+xml_attr({ 'voIpProt.server.1.address' }, values.device.registrar)
+xml_attr({ 'mb.main.home' }, values.device.homepage)
+xml_attr({ 'voIpProt.SIP.musicOnHold.uri' }, values.device.musiconhold)
+xml_attr({ 'dialplan.digitmap.timeOut' }, values.device.digitmaptimeout)
+xml_attr({ 'feature.urlDialing.enabled' }, values.device.urldialingenable)
+
+if not values.device.pcportenable then
+ -- set mode to '-1' which disables it
+ xml_attr({ 'device.net.etherModePC' }, '-1')
+ -- apply settings in 'device' parameter above
+ xml_attr({ 'device.net.etherModePC.set' }, '1')
+end
+
+-- Override the default admin password of '456'
+if values.device.adminpassword then
+ xml_attr({ 'device.auth.localAdminPassword' }, values.device.adminpassword)
+ 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' '<GMT+5>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]
+
+ -- Handle explicit hour for DST change
+ -- (Polycom doesn't implement explicit min or sec)
+ -- (Polycom DST implementation assumes DST change is 1 hour)
+ if t.hour then
+ xml_attr({ dstprefix, pos, 'time' }, t.hour)
+ end
+
+ if t.day then
+ -- there may be two of next line, Polycom uses first
+ xml_attr({ dstprefix, 'fixedDayEnable' }, true)
+ xml_attr({ dstprefix, pos, 'month' }, t.month)
+ xml_attr({ dstprefix, pos, 'date' }, t.day)
+ else
+
+ -- there may be two of next line, Polycom uses first
+ xml_attr({ dstprefix, 'fixedDayEnable' }, false)
+ xml_attr({ dstprefix, pos, 'month' }, t.month)
+
+ -- POSIX weekday is between 0 (Sun) and 6 (Sat)
+ -- Polycom dayOfWeek is 1=Sun, 7=Sat
+ xml_attr({ dstprefix, pos, 'dayOfWeek' }, tonumber(t.weekday) + 1)
+
+ -- POSIX week from 1 to 5, where 1st,2nd..4th, and 5=last
+ if t.week == '5' then
+ xml_attr({ dstprefix, pos, 'dayOfWeek.lastInMonth' }, true)
+ else
+ -- Polycom uses 1, 8, 15, 22 for 1st, 2nd... 4th
+ local d = 7 * ( tonumber(t.week) - 1 ) + 1
+ xml_attr({ dstprefix, pos, 'date' }, d)
+ end
+ end
+
+ end
+
+ if tz.dst then
+ xml_attr({'tcpIpApp.sntp.daylightSavings.enable'}, true)
+
+ dstrule('start')
+ dstrule('stop')
+ else
+ xml_attr({'tcpIpApp.sntp.daylightSavings.enable'}, false)
+ end
+end
+
+--]=]
+
+
+-- Check 'services' params
+local enable = {}
+enable.forwarding = false
+enable.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
+ xml_attr({ 'feature.callList.enabled' }, '0')
+ end
+ if not values.services.callwaitingenable then
+ -- only allow one call per line key
+ xml_attr({ 'call.callsPerLineKey' }, '1' )
+ end
+ if values.services.forwarding then
+ enable.forwarding = true
+ end
+ if values.services.hotlineenable then
+ enable.hotline = true
+ -- Set phone to replace any dialed digits with the hotline destination instead
+ xml_attr({ 'dialplan.digitmap' }, 'R[#*0123456789].R'..values.services.hotlinedestination..'R')
+ xml_attr({ 'dialplan.applyToUserDial' }, '1')
+ xml_attr({ 'dialplan.applyToUserSend' }, '1')
+ else
+ xml_attr({ 'dialplan.digitmap' }, values.device.digitmap)
+ end
+ if values.services.mailbox then
+ xml_attr({ 'msg.mwi.1.subscribe' }, values.services.mailbox)
+ xml_attr({ 'msg.mwi.1.callBackMode' }, "contact")
+ xml_attr({ 'msg.mwi.1.callBack' }, string.gsub(values.services.mailbox, "@.*", ""))
+ end
+ -- set local contact directory to be readonly or readwrite
+ if not values.services.speeddialenable then
+ xml_attr({ 'dir.local.contacts.maxNum' }, 0)
+ end
+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)
+ 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')
+ end
+
+
+end
+
+end
+
+%>
+
+/>
+
+<%
+-- DEBUGGING
+--require("session")
+--local log, err = io.open("/root/polycom-template.log", "a")
+--log:write(session.serialize("values", values))
+%>
diff --git a/config/templates/snom-template.lua b/config/templates/snom-template.lua
new file mode 100644
index 0000000..7ac4542
--- /dev/null
+++ b/config/templates/snom-template.lua
@@ -0,0 +1,95 @@
+<%
+local values = ...
+
+local function xml_elem(t,v,p,i)
+ local elem = t
+ if i == nil then
+ if v == true then
+ io.write('<'..elem..' perm="'..p..'">on</'..elem..'>\n')
+ elseif v == false then
+ io.write('<'..elem..' perm="'..p..'">off</'..elem..'>\n')
+ else
+ io.write('<'..elem..' perm="'..p..'">'..tostring(v)..'</'..elem..'>\n')
+ end
+ else
+ if v == true then
+ io.write('<'..elem..' idx="'..i..'" perm="'..p..'">on</'..elem..'>\n')
+ elseif v == false then
+ io.write('<'..elem..' idx="'..i..'" perm="'..p..'">off</'..elem..'>\n')
+ else
+ io.write('<'..elem..' idx="'..i..'" perm="'..p..'">'..tostring(v)..'</'..elem..'>\n')
+ end
+ end
+end
+%>
+
+<?xml version="1.0" encoding="utf-8"?>
+<settings>
+ <phone-settings>
+ <admin_mode_password perm="R"><% io.write(values.device.adminpassword) %></admin_mode_password>
+ <codec_tos perm="RW">184</codec_tos>
+ <% if values.device.dateformat == string.lower("mm/dd/yyyy") then
+ io.write('<date_us_format perm="RW">on</date_us_format>')
+ else
+ io.write('<date_us_format perm="RW">off</date_us_format>')
+ end %>
+ <dhcp perm="RW">on</dhcp>
+ <dim_timer perm="R">60</dim_timer>
+ <% xml_elem('eth_pc',values.device.pcportenable,'R') %>
+ <http_pass perm="R"><% io.write(values.device.adminpassword) %></http_pass>
+ <http_user perm="R">admin</http_user>
+ <ignore_security_warning perm="R">on</ignore_security_warning>
+ <% xml_elem('language',values.device.uilanguage,'RW') %>
+ <ntp_server perm="RW"><% io.write(values.device.sntpserver) %></ntp_server>
+ <publish_presence perm="R">off</publish_presence>
+ <refer_brackets perm="R">on</refer_brackets>
+ <settings_refresh_timer perm="RW">7200</settings_refresh_timer>
+ <signaling_tos perm="RW">184</signaling_tos>
+ <% xml_elem('time_24_format',values.device.timeformat24h,'RW') %>
+ <!--<timezone perm="RW">ITA+1</timezone> http://wiki.snom.com/Settings/timezone -->
+ <!--<tone_scheme perm="RW">ITA</tone_scheme> http://wiki.snom.com/wiki/index.php/Settings/tone_scheme -->
+ <update_policy perm="R">auto_update</update_policy>
+ <use_hidden_tags perm="RW">off</use_hidden_tags>
+ <%
+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
+ xml_elem('record_dialed_calls', pg_t.callhistoryenable, 'R', num)
+ xml_elem('record_missed_calls', pg_t.callhistoryenable, 'R', num)
+ xml_elem('record_received_calls', pg_t.callhistoryenable, 'R', num)
+ -- SNOMs do not support per-line forwarding
+ xml_elem('redirect_allways',pg_t.forwardallenable,'RW')
+ xml_elem('redirect_number',pg_t.forwardall,'RW')
+ xml_elem('redirect_on_busy',pg_t.forwardbusyenable,'RW')
+ xml_elem('redirect_busy_number',pg_t.forwardbusy,'RW')
+ xml_elem('redirect_on_timeout',pg_t.forwardnoanswerenable,'RW')
+ xml_elem('redirect_time_number',pg_t.forwardnoanswer,'RW')
+ xml_elem('redirect_time','20','RW')
+ xml_elem('retry_after_failed_subscribe', '30', 'R', num)
+ xml_elem('user_active', 'on', 'RW', num )
+ xml_elem('user_host', values.device.registrar, 'R', num )
+ xml_elem('user_hold_inactive', 'off', 'R', num)
+ xml_elem('user_moh', values.device.musiconhold, 'R', num)
+ xml_elem('user_name', pg_t.extension, 'R', num)
+ xml_elem('user_outbound', values.device.registrar, 'R', num)
+ xml_elem('user_pass', pg_t.password, 'R', num)
+ xml_elem('user_publish_presence_bootup', 'off', 'R', num)
+ xml_elem('user_ringer', 'Ringer'..pg_t.ringtone, '!', num)
+ xml_elem('user_shared_line',pg_t.sharedlineenable, 'R', num)
+ xml_elem('user_srtp', 'off', 'R', num)
+ xml_elem('user_subscription_expiry', '120', 'R', num) -- by default SNOMs re-register after *half* of this time have passed
+ -- Caller ID string
+ if string.len(pg_t.callerid) == 0 then
+ xml_elem( 'user_realname', pg_t.extension,'R', num)
+ else
+ xml_elem( 'user_realname', pg_t.callerid,'R', num)
+ end
+ end
+ end
+end
+ %>
+ </phone-settings>
+</settings>
diff --git a/config/update_device.lua b/config/update_device.lua
new file mode 100644
index 0000000..90f5340
--- /dev/null
+++ b/config/update_device.lua
@@ -0,0 +1,14 @@
+-- This is the script run after editing a device - the label, classes
+local functions, device, olddevice, params, oldparams = ...
+
+APP.logevent("got to update_device script")
+
+-- We'll handle the changing of the device by handling the resulting changing of the params
+local env = {}
+setmetatable (env, {__index = _G})
+-- loadfile loads into the global environment
+-- so we set env 0, not env 1
+setfenv (0, env)
+local f = loadfile("/etc/provisioning/update_device_params.lua")
+if (f) then f(functions, params, oldparams) end
+setfenv (0, _G)
diff --git a/config/update_device_params.lua b/config/update_device_params.lua
new file mode 100644
index 0000000..974f339
--- /dev/null
+++ b/config/update_device_params.lua
@@ -0,0 +1,41 @@
+-- This is the script run after editing device params
+local functions, params, oldparams = ...
+
+APP.logevent("got to update_device_params script")
+
+local function findip(mac)
+ if not mac or mac == "" then
+ return nil
+ end
+ local ipaddr = functions.getselectresponse("SELECT ip FROM provisioning_requests WHERE mac~*'"..mac.."'")
+ if ipaddr and ipaddr[1] then
+ return ipaddr[1].ip
+ end
+end
+
+local notify_device = function(mac, extension)
+ local ipaddr = findip(mac)
+ if ipaddr then
+ APP.logevent("Notifying "..ipaddr.." to update for "..(mac or ""))
+ os.execute("/etc/provisioning/notify_device "..ipaddr.." "..extension)
+ addfuturenotify(ipaddr, extension)
+ else
+ APP.logevent("Warning - could not find IP address for "..(mac or ""))
+ end
+end
+
+-- Notify the phone to pull it's config
+-- Try to get a valid extension currently on the device
+local oldexten = ""
+for name,val in pairs(oldparams.value) do
+ if string.match(name, "^reg") and val.value.extension and val.value.extension.value ~= "" then
+ oldexten = val.value.extension.value
+ break
+ end
+end
+if params.value.device and params.value.device.value.mac and params.value.device.value.mac.value ~= "" then
+ notify_device(params.value.device.value.mac.value, oldexten)
+end
+if oldparams.value.device and oldparams.value.device.value.mac and oldparams.value.device.value.mac.value ~= "" then
+ notify_device(oldparams.value.device.value.mac.value, oldexten)
+end