summaryrefslogtreecommitdiffhomepage
path: root/applications/luci-app-asterisk/luasrc/model/cbi/asterisk/phones.lua
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2018-11-12 10:13:34 +0100
committerJo-Philipp Wich <jo@mein.io>2018-11-14 20:46:04 +0100
commitcf3621522815544d42d1cc5cdf65b4fd1a6b4412 (patch)
tree7d2656f92612be0ff31e0d987cb08b38a404a6fe /applications/luci-app-asterisk/luasrc/model/cbi/asterisk/phones.lua
parent4791180eb3253381b4bc69342ee58605a15431dd (diff)
applications: drop luci-app-asterisk
This application was never useful to begin with, drop it to avoid further confusion. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'applications/luci-app-asterisk/luasrc/model/cbi/asterisk/phones.lua')
-rw-r--r--applications/luci-app-asterisk/luasrc/model/cbi/asterisk/phones.lua104
1 files changed, 0 insertions, 104 deletions
diff --git a/applications/luci-app-asterisk/luasrc/model/cbi/asterisk/phones.lua b/applications/luci-app-asterisk/luasrc/model/cbi/asterisk/phones.lua
deleted file mode 100644
index a6c44f9335..0000000000
--- a/applications/luci-app-asterisk/luasrc/model/cbi/asterisk/phones.lua
+++ /dev/null
@@ -1,104 +0,0 @@
--- Copyright 2008 Jo-Philipp Wich <jow@openwrt.org>
--- Licensed to the public under the Apache License 2.0.
-
-local ast = require("luci.asterisk")
-
-cbimap = Map("asterisk", "Registered Phones")
-cbimap.pageaction = false
-
-local sip_peers = { }
-cbimap.uci:foreach("asterisk", "sip",
- function(s)
- if s.type ~= "peer" then
- s.name = s['.name']
- s.info = ast.sip.peer(s.name)
- sip_peers[s.name] = s
- end
- end)
-
-
-sip_table = cbimap:section(TypedSection, "sip", "SIP Phones")
-sip_table.template = "cbi/tblsection"
-sip_table.extedit = luci.dispatcher.build_url("admin", "asterisk", "phones", "sip", "%s")
-sip_table.addremove = true
-
-function sip_table.filter(self, s)
- return s and not cbimap.uci:get_bool("asterisk", s, "provider")
-end
-
-function sip_table.create(self, section)
- if TypedSection.create(self, section) then
- created = section
- cbimap.uci:tset("asterisk", section, {
- type = "friend",
- qualify = "yes",
- provider = "no",
- host = "dynamic",
- nat = "no",
- canreinvite = "no",
- extension = section:match("^%d+$") and section or "",
- username = section:match("^%d+$") and section or ""
- })
- else
- self.invalid_cts = true
- end
-end
-
-function sip_table.parse(self, ...)
- TypedSection.parse(self, ...)
- if created then
- cbimap.uci:save("asterisk")
- luci.http.redirect(luci.dispatcher.build_url(
- "admin", "asterisk", "phones", "sip", created
- ))
- end
-end
-
-
-user = sip_table:option(DummyValue, "username", "Username")
-function user.cfgvalue(self, s)
- return sip_peers[s] and sip_peers[s].callerid or
- AbstractValue.cfgvalue(self, s)
-end
-
-host = sip_table:option(DummyValue, "host", "Hostname")
-function host.cfgvalue(self, s)
- if sip_peers[s] and sip_peers[s].info.address then
- return "%s:%i" %{ sip_peers[s].info.address, sip_peers[s].info.port }
- else
- return "n/a"
- end
-end
-
-context = sip_table:option(DummyValue, "context", "Dialplan")
-context.href = luci.dispatcher.build_url("admin", "asterisk", "dialplan")
-
-online = sip_table:option(DummyValue, "online", "Registered")
-function online.cfgvalue(self, s)
- if sip_peers[s] and sip_peers[s].info.online == nil then
- return "n/a"
- else
- return sip_peers[s] and sip_peers[s].info.online
- and "yes" or "no (%s)" % {
- sip_peers[s] and sip_peers[s].info.Status:lower() or "unknown"
- }
- end
-end
-
-delay = sip_table:option(DummyValue, "delay", "Delay")
-function delay.cfgvalue(self, s)
- if sip_peers[s] and sip_peers[s].info.online then
- return "%i ms" % sip_peers[s].info.delay
- else
- return "n/a"
- end
-end
-
-info = sip_table:option(Button, "_info", "Info")
-function info.write(self, s)
- luci.http.redirect(luci.dispatcher.build_url(
- "admin", "asterisk", "phones", "sip", s, "info"
- ))
-end
-
-return cbimap