From 1bb4822dca6113f73e3bc89e2acf15935e6f8e92 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Wed, 3 Dec 2014 15:17:05 +0100 Subject: Rework LuCI build system * Rename subdirectories to their repective OpenWrt package names * Make each LuCI module its own standalone package * Deploy a shared luci.mk which is used by each module Makefile Signed-off-by: Jo-Philipp Wich --- .../luasrc/view/asterisk/cbi/cell.htm | 22 ++ .../luasrc/view/asterisk/dialplans.htm | 254 +++++++++++++++++++++ .../luasrc/view/asterisk/dialzones.htm | 174 ++++++++++++++ 3 files changed, 450 insertions(+) create mode 100644 applications/luci-app-asterisk/luasrc/view/asterisk/cbi/cell.htm create mode 100644 applications/luci-app-asterisk/luasrc/view/asterisk/dialplans.htm create mode 100644 applications/luci-app-asterisk/luasrc/view/asterisk/dialzones.htm (limited to 'applications/luci-app-asterisk/luasrc/view') diff --git a/applications/luci-app-asterisk/luasrc/view/asterisk/cbi/cell.htm b/applications/luci-app-asterisk/luasrc/view/asterisk/cbi/cell.htm new file mode 100644 index 000000000..b5d618ff9 --- /dev/null +++ b/applications/luci-app-asterisk/luasrc/view/asterisk/cbi/cell.htm @@ -0,0 +1,22 @@ +<%# +LuCI - Lua Configuration Interface +Copyright 2008 Steven Barth +Copyright 2008 Jo-Philipp Wich + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +$Id: dvalue.htm 3367 2008-09-19 10:42:02Z Cyrus $ + +-%> + +<%+cbi/valueheader%> +<% if self.href then %><% end -%> + <%=self:cfgvalue(section)%> +<%- if self.href then %><%end%> +  + +<%+cbi/valuefooter%> diff --git a/applications/luci-app-asterisk/luasrc/view/asterisk/dialplans.htm b/applications/luci-app-asterisk/luasrc/view/asterisk/dialplans.htm new file mode 100644 index 000000000..a46a8db17 --- /dev/null +++ b/applications/luci-app-asterisk/luasrc/view/asterisk/dialplans.htm @@ -0,0 +1,254 @@ +<%# +LuCI - Lua Configuration Interface +Copyright 2008 Steven Barth +Copyright 2008 Jo-Philipp Wich + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +$Id$ + +-%> + +<%+header%> + +<% + local uci = luci.model.uci.cursor_state() + local ast = require "luci.asterisk" + + function digit_pattern(s,t) + return "%s" + %{ t and " title='" .. t .. "'" or "", s } + end + + function rowstyle(i) + return "cbi-rowstyle-%i" %{ + ( i % 2 ) == 0 and 2 or 1 + } + end + + function format_matches(z) + local html = { } + + if type(z) ~= "table" then + z = { matches = { z } } + end + + if z.localprefix then + for _, m in ipairs(z.matches) do + html[#html+1] = + digit_pattern(z.localprefix, "local prefix") .. " " .. + digit_pattern(m) + end + end + + if z.intlmatches and #z.intlmatches > 0 then + for _, i in ipairs(z.intlmatches) do + for _, m in ipairs(z.matches) do + html[#html+1] = "%s %s" %{ + digit_pattern("(%s)" % i, "intl. prefix"), + digit_pattern(m) + } + end + end + else + for _, m in ipairs(z.matches) do + html[#html+1] = digit_pattern(m) + end + end + + return table.concat(html, "; ") + end +%> + + +
" enctype="multipart/form-data"> +
+ + + +
+ +
+

Outgoing Call Routing

+
+ Here you can manage your dial plans which are used to route outgoing calls from your local extensions.

+ Related tasks:
+ Manage dialzones | + Manage voicemail boxes | + Manage meetme rooms +
+ +
+ +
+ + <% for i, plan in pairs(ast.dialplan.plans()) do %> +
+ + + + + + + + <% local zones_used = { }; local row = 0 %> + <% for i, zone in ipairs(plan.zones) do zones_used[zone.name] = true %> + + + + + <% row = row + 1; end %> + + + + <% local boxes_used = { } %> + <% for ext, box in luci.util.kspairs(plan.voicemailboxes) do boxes_used[box.id] = true %> + + + + + <% row = row + 1; end %> + + + + <% local rooms_used = { } %> + <% for ext, room in luci.util.kspairs(plan.meetmerooms) do rooms_used[room.room] = true %> + + + + + <% row = row + 1; end %> + + + + + + +
+ Dialplan <%=plan.name%> + + + Remove this dialplan + +
+ └ Dialzone <%=zone.name%> (<%=zone.description%>) +

+ Lines: + <%=ast.tools.hyperlinks( + zone.trunks, function(v) + return luci.dispatcher.build_url("admin", "asterisk", "trunks", "%s") % v:lower() + end + )%>
+ Matches: + <%=format_matches(zone)%> +

+
+ + Edit dialzone + + + Remove from this dialplan + +
+ └ Voicemailbox <%=box.id%> (<%=box.name%>) +

+ Owner: <%=box.name%> | + eMail: <%=#box.email > 0 and box.email or 'n/a'%> | + Pager: <%=#box.page > 0 and box.page or 'n/a'%>
+ Matches: <%=format_matches(ext)%> +

+
+ + Manage mailboxes ... + + + Remove from this dialplan + +
+ └ MeetMe Room <%=room.room%> + <% if room.description and #room.description > 0 then %> (<%=room.description%>)<% end %> +

+ Matches: <%=format_matches(ext)%> +

+
+ + Manage conferences ... + + + Remove from this dialplan + +
+
+ + Add Dialzone:
+ +

+ + Add Voicemailbox:
+ + as extension + +

+ + Add MeetMe Conference:
+ + as extension + +

+ + +
+ +
+
+
+ <% end %> + +
+
+

Create a new dialplan

+ The name is required and must be unique. It may only contain the characters A-Z, a-z, 0-9 and _ .
+ + <%- if create_error then %> +
Invalid name given!
+ <% end -%> + +
+ + +
+
+ +
+
+
+
+<%+footer%> diff --git a/applications/luci-app-asterisk/luasrc/view/asterisk/dialzones.htm b/applications/luci-app-asterisk/luasrc/view/asterisk/dialzones.htm new file mode 100644 index 000000000..f93496df8 --- /dev/null +++ b/applications/luci-app-asterisk/luasrc/view/asterisk/dialzones.htm @@ -0,0 +1,174 @@ +<%# +LuCI - Lua Configuration Interface +Copyright 2008 Steven Barth +Copyright 2008 Jo-Philipp Wich + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +$Id$ + +-%> + +<%+header%> + +<% + local uci = luci.model.uci.cursor_state() + local ast = require("luci.asterisk") + + function digit_pattern(s) + return "%s" % s + end + + function rowstyle(i) + return "cbi-rowstyle-%i" %{ + ( i % 2 ) == 0 and 2 or 1 + } + end + + local function find_trunks() + local t = { } + + uci:foreach("asterisk", "sip", + function(s) + if uci:get_bool("asterisk", s['.name'], "provider") then + t[#t+1] = { + "SIP/%s" % s['.name'], + "SIP: %s" % s['.name'] + } + end + end) + + uci:foreach("asterisk", "iax", + function(s) + t[#t+1] = { + "IAX/%s" % s['.name'], + "IAX: %s" % s.extension or s['.name'] + } + end) + + return t + end + +%> + + +
" enctype="multipart/form-data"> +
+ + + +
+ +
+

Dial Zone Management

+
+ " class="cbi-title-ref">Back to dialplan overview

+ Here you can manage your dial zones. The zones are used to route outgoing calls to the destination. + Each zone groups multiple trunks and number matches to represent a logical destination. Zones can + also be used to enforce certain dial restrictions on selected extensions. +
+ + +
+
+ + + + + + + + + + + + + + + <% for i, rule in pairs(ast.dialzone.zones()) do %> + + + + + + + + + <% end %> +
+

Dialzone Overview

+
NamePrepend- MatchTrunkDescription
+ <%=rule.name%> + + <% for _ in ipairs(rule.matches) do %> + <%=rule.addprefix and digit_pattern(rule.addprefix)%> 
+ <% end %> +
+ <% for _, m in ipairs(rule.matches) do %> + <%=rule.localprefix and "%s " % digit_pattern(rule.localprefix)%> + <%=digit_pattern(m)%>
+ <% end %> +
+ <%=ast.tools.hyperlinks( + rule.trunks, function(v) + return luci.dispatcher.build_url("admin", "asterisk", "trunks", "%s") % v:lower() + end + )%> + + <%=rule.description or rule.name%> + + + Edit entry + + + Delete entry + +
+
+
+
+ +
+
+

Create a new dialzone

+ The name is required and must be unique. It may only contain the characters A-Z, a-z, 0-9 and _ .
+ You can specifiy multiple number matches by separating them with spaces.
+ + <%- if create_error then %> +
Invalid name given!
+ <% end -%> + + + + + + +
+
+ +

+ +
+ +
+
+ +
+
+ + +
+
+
+
+
+
+<%+footer%> -- cgit v1.2.3