diff options
author | Jo-Philipp Wich <jow@openwrt.org> | 2009-03-29 19:11:57 +0000 |
---|---|---|
committer | Jo-Philipp Wich <jow@openwrt.org> | 2009-03-29 19:11:57 +0000 |
commit | 2c7a76105403ede3bf4a9803a47ca62d86e8cd72 (patch) | |
tree | f58cfe499be453ed4c0f02efcfd4ccd7668fbdc4 /applications/luci-asterisk/luasrc/controller | |
parent | dd267f9457476e0a2b29be0a98fcd05062f50f13 (diff) |
applications/luci-asterisk: initial dialplan voicemail box support
Diffstat (limited to 'applications/luci-asterisk/luasrc/controller')
-rw-r--r-- | applications/luci-asterisk/luasrc/controller/asterisk.lua | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/applications/luci-asterisk/luasrc/controller/asterisk.lua b/applications/luci-asterisk/luasrc/controller/asterisk.lua index 123666efc..3bd369da3 100644 --- a/applications/luci-asterisk/luasrc/controller/asterisk.lua +++ b/applications/luci-asterisk/luasrc/controller/asterisk.lua @@ -103,6 +103,31 @@ function handle_dialplan() end end + for k, v in pairs(luci.http.formvaluetable("delvbox")) do + local plan = ast.dialplan.plan(k) + if #v > 0 and plan then + uci:delete_all("asterisk", "dialplanvoice", + { extension=v, dialplan=plan.name }) + uci:save("asterisk") + end + end + + for k, v in pairs(luci.http.formvaluetable("addvbox")) do + local plan = ast.dialplan.plan(k) + local vbox = ast.voicemail.box(v) + if plan and vbox then + local vext = luci.http.formvalue("addvboxext.%s" % plan.name) + vext = ( vext and #vext > 0 ) and vext or vbox.number + uci:section("asterisk", "dialplanvoice", nil, { + dialplan = plan.name, + extension = vext, + voicebox = vbox.number, + voicecontext = vbox.context + }) + uci:save("asterisk") + end + end + local aname = luci.http.formvalue("addplan") if aname and #aname > 0 then if aname:match("^[a-zA-Z0-9_]+$") then |