2 LuCI - Lua Configuration Interface
4 Copyright 2019 John Crispin <blogic@openwrt.org>
6 Licensed under the Apache License, Version 2.0 (the "License");
7 you may not use this file except in compliance with the License.
8 You may obtain a copy of the License at
10 http://www.apache.org/licenses/LICENSE-2.0
14 module("luci.controller.ltqtapi", package.seeall)
17 if not nixio.fs.access("/etc/config/telephony") then
21 page = node("admin", "telephony")
22 page.target = firstchild()
23 page.title = _("VoIP")
26 entry({"admin", "telephony", "account"}, cbi("luci_ltqtapi/account") , _("Account"), 10)
27 entry({"admin", "telephony", "contact"}, cbi("luci_ltqtapi/contact") , _("Contacts"), 20)
29 entry({"admin", "telephony", "status"}, call("tapi_status")).leaf = true
32 function tapi_status()
34 local state = require "luci.model.uci".cursor_state()
35 state:load("telephony")
37 st.status = "Offline";
38 if state:get("telephony", "state", "port1", "0") == "0" then
43 if state:get("telephony", "state", "port2", "0") == "0" then
48 luci.http.prepare_content("application/json")
49 luci.http.write_json(st)