diff options
author | Jo-Philipp Wich <jow@openwrt.org> | 2009-03-30 19:29:37 +0000 |
---|---|---|
committer | Jo-Philipp Wich <jow@openwrt.org> | 2009-03-30 19:29:37 +0000 |
commit | d0c6e88b95782d8c50cd8c6caec1302bb9ab1a9d (patch) | |
tree | 64d160f4a8f64fc9467c58e3605aaba37b3e1c30 /applications/luci-asterisk/luasrc/model/cbi | |
parent | 7385d0b070e2aa4a367b8864fcaad00e65fabb18 (diff) |
applications/luci-asterisk: add meetme support, data integrity improvements
Diffstat (limited to 'applications/luci-asterisk/luasrc/model/cbi')
3 files changed, 100 insertions, 1 deletions
diff --git a/applications/luci-asterisk/luasrc/model/cbi/asterisk/meetme.lua b/applications/luci-asterisk/luasrc/model/cbi/asterisk/meetme.lua new file mode 100644 index 0000000000..b02a8f6120 --- /dev/null +++ b/applications/luci-asterisk/luasrc/model/cbi/asterisk/meetme.lua @@ -0,0 +1,49 @@ +--[[ +LuCI - Lua Configuration Interface + +Copyright 2009 Jo-Philipp Wich <xm@subsignal.org> + +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$ +]]-- + +local ast = require "luci.asterisk" + +cbimap = Map("asterisk", "MeetMe - Rooms") + +meetme = cbimap:section(TypedSection, "meetme", "MeetMe Rooms") +meetme.addremove = true +meetme.anonymous = true +meetme.template = "cbi/tblsection" +meetme:option(Value, "_description", "Description", "Short room description") + +room = meetme:option(Value, "room", "Room Number", "Unique room identifier") + +function room.write(self, s, val) + if val and #val > 0 then + local old = self:cfgvalue(s) + self.map.uci:foreach("asterisk", "dialplanmeetme", + function(v) + if v.room == old then + self.map:set(v['.name'], "room", val) + end + end) + Value.write(self, s, val) + end +end + + +meetme:option(Value, "pin", "PIN", "PIN required to access") +meetme:option(Value, "adminpin", "Admin PIN", "PIN required for administration") + +function meetme.remove(self, s) + return ast.meetme.remove(self.map:get(s, "room"), self.map.uci) +end + + +return cbimap diff --git a/applications/luci-asterisk/luasrc/model/cbi/asterisk/meetme_settings.lua b/applications/luci-asterisk/luasrc/model/cbi/asterisk/meetme_settings.lua new file mode 100644 index 0000000000..511d7a71a7 --- /dev/null +++ b/applications/luci-asterisk/luasrc/model/cbi/asterisk/meetme_settings.lua @@ -0,0 +1,28 @@ +--[[ +LuCI - Lua Configuration Interface + +Copyright 2009 Jo-Philipp Wich <xm@subsignal.org> + +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$ +]]-- + +cbimap = Map("asterisk", "MeetMe - Common Settings", + "Common settings for MeetMe phone conferences.") + +meetme = cbimap:section(TypedSection, "meetmegeneral", "General MeetMe Options") +meetme.addremove = false +meetme.anonymous = true + +audiobuffers = meetme:option(ListValue, "audiobuffers", + "Number of 20ms audio buffers to use for conferences") + +for i = 2, 32 do audiobuffers:value(i) end + + +return cbimap diff --git a/applications/luci-asterisk/luasrc/model/cbi/asterisk/voicemail.lua b/applications/luci-asterisk/luasrc/model/cbi/asterisk/voicemail.lua index 1c92d0dbfe..5d0de756b3 100644 --- a/applications/luci-asterisk/luasrc/model/cbi/asterisk/voicemail.lua +++ b/applications/luci-asterisk/luasrc/model/cbi/asterisk/voicemail.lua @@ -12,6 +12,8 @@ You may obtain a copy of the License at $Id$ ]]-- +local ast = require "luci.asterisk" + cbimap = Map("asterisk", "Voicemail - Mailboxes") voicemail = cbimap:section(TypedSection, "voicemail", "Voicemail Boxes") @@ -22,7 +24,23 @@ voicemail.template = "cbi/tblsection" context = voicemail:option(ListValue, "context", "Context") context:value("default") -voicemail:option(Value, "number", "Mailbox Number", "Unique mailbox identifier") +number = voicemail:option(Value, "number", + "Mailbox Number", "Unique mailbox identifier") + +function number.write(self, s, val) + if val and #val > 0 then + local old = self:cfgvalue(s) + self.map.uci:foreach("asterisk", "dialplanvoice", + function(v) + if v.voicebox == old then + self.map:set(v['.name'], "voicebox", val) + end + end) + Value.write(self, s, val) + end +end + + voicemail:option(Value, "name", "Ownername", "Human readable display name") voicemail:option(Value, "password", "Password", "Access protection") voicemail:option(Value, "email", "eMail", "Where to send voice messages") @@ -33,5 +51,9 @@ zone.titleref = luci.dispatcher.build_url("admin/asterisk/voicemail/settings") cbimap.uci:foreach("asterisk", "voicezone", function(s) zone:value(s['.name']) end) +function voicemail.remove(self, s) + return ast.voicemail.remove(self.map:get(s, "number"), self.map.uci) +end + return cbimap |