summaryrefslogtreecommitdiffstats
path: root/config/determine_class.lua
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/determine_class.lua
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/determine_class.lua')
-rw-r--r--config/determine_class.lua21
1 files changed, 21 insertions, 0 deletions
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