1 -- Copyright 2009 Jo-Philipp Wich <xm@subsignal.org>
2 -- Licensed to the public under the Apache License 2.0.
4 local ast = require "luci.asterisk"
6 cbimap = Map("asterisk", "Voicemail - Mailboxes")
8 voicemail = cbimap:section(TypedSection, "voicemail", "Voicemail Boxes")
9 voicemail.addremove = true
10 voicemail.anonymous = true
11 voicemail.template = "cbi/tblsection"
13 context = voicemail:option(ListValue, "context", "Context")
14 context:value("default")
16 number = voicemail:option(Value, "number",
17 "Mailbox Number", "Unique mailbox identifier")
19 function number.write(self, s, val)
20 if val and #val > 0 then
21 local old = self:cfgvalue(s)
22 self.map.uci:foreach("asterisk", "dialplanvoice",
24 if v.voicebox == old then
25 self.map:set(v['.name'], "voicebox", val)
28 Value.write(self, s, val)
33 voicemail:option(Value, "name", "Ownername", "Human readable display name")
34 voicemail:option(Value, "password", "Password", "Access protection")
35 voicemail:option(Value, "email", "eMail", "Where to send voice messages")
36 voicemail:option(Value, "page", "Pager", "Pager number")
38 zone = voicemail:option(ListValue, "zone", "Timezone", "Used time format")
39 zone.titleref = luci.dispatcher.build_url("admin/asterisk/voicemail/settings")
40 cbimap.uci:foreach("asterisk", "voicezone",
41 function(s) zone:value(s['.name']) end)
43 function voicemail.remove(self, s)
44 return ast.voicemail.remove(self.map:get(s, "number"), self.map.uci)