1 -- Copyright 2019 John Crispin <blogic@openwrt.org>
2 -- Licensed to the public under the Apache License 2.0.
4 module("luci.controller.ltqtapi", package.seeall)
7 if not nixio.fs.access("/etc/config/telephony") then
11 page = node("admin", "telephony")
12 page.target = firstchild()
13 page.title = _("VoIP")
16 entry({"admin", "telephony", "account"}, cbi("luci_ltqtapi/account") , _("Account"), 10)
17 entry({"admin", "telephony", "contact"}, cbi("luci_ltqtapi/contact") , _("Contacts"), 20)
19 entry({"admin", "telephony", "status"}, call("tapi_status")).leaf = true
22 function tapi_status()
24 local state = require "luci.model.uci".cursor_state()
25 state:load("telephony")
27 st.status = "Offline";
28 if state:get("telephony", "state", "port1", "0") == "0" then
33 if state:get("telephony", "state", "port2", "0") == "0" then
38 luci.http.prepare_content("application/json")
39 luci.http.write_json(st)