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")
25 page.i18n = "telephony"
27 entry({"admin", "telephony", "account"}, cbi("luci_ltqtapi/account") , _("Account"), 10)
28 entry({"admin", "telephony", "contact"}, cbi("luci_ltqtapi/contact") , _("Contacts"), 20)
30 entry({"admin", "telephony", "status"}, call("tapi_status")).leaf = true
33 function tapi_status()
35 local state = require "luci.model.uci".cursor_state()
36 state:load("telephony")
38 st.status = "Offline";
39 if state:get("telephony", "state", "port1", "0") == "0" then
44 if state:get("telephony", "state", "port2", "0") == "0" then
49 luci.http.prepare_content("application/json")
50 luci.http.write_json(st)