Merge pull request #278 from nmav/ocserv
[project/luci.git] / applications / luci-asterisk / luasrc / model / cbi / asterisk-dialplans.lua
1 --[[
2 LuCI - Lua Configuration Interface
3
4 Copyright 2008 Steven Barth <steven@midlink.org>
5 Copyright 2008 Jo-Philipp Wich <xm@leipzig.freifunk.net>
6
7 Licensed under the Apache License, Version 2.0 (the "License");
8 you may not use this file except in compliance with the License.
9 You may obtain a copy of the License at
10
11         http://www.apache.org/licenses/LICENSE-2.0
12
13 $Id$
14 ]]--
15
16 cbimap = Map("asterisk", "asterisk", "")
17
18 dialplan = cbimap:section(TypedSection, "dialplan", "Section dialplan", "")
19 dialplan.addremove = true
20 dialplan.dynamic = true
21
22 include = dialplan:option(MultiValue, "include", "Include zones and plans", "")
23 cbimap.uci:foreach( "asterisk", "dialplan", function(s) include:value(s['.name']) end )
24 cbimap.uci:foreach( "asterisk", "dialzone", function(s) include:value(s['.name']) end )
25
26 dialplanexten = cbimap:section(TypedSection, "dialplanexten", "Dialplan Extension", "")
27 dialplanexten.anonymous = true
28 dialplanexten.addremove = true
29 dialplanexten.dynamic = true
30
31
32 dialplangeneral = cbimap:section(TypedSection, "dialplangeneral", "Dialplan General Options", "")
33 dialplangeneral.anonymous = true
34 dialplangeneral.addremove = true
35
36 allowtransfer = dialplangeneral:option(Flag, "allowtransfer", "Allow transfer", "")
37 allowtransfer.rmempty = true
38
39 canreinvite = dialplangeneral:option(ListValue, "canreinvite", "Reinvite/redirect media connections", "")
40 canreinvite:value("yes", "Yes")
41 canreinvite:value("nonat", "Yes when not behind NAT")
42 canreinvite:value("update", "Use UPDATE rather than INVITE for path redirection")
43 canreinvite:value("no", "No")
44 canreinvite.rmempty = true
45
46 clearglobalvars = dialplangeneral:option(Flag, "clearglobalvars", "Clear global vars", "")
47 clearglobalvars.rmempty = true
48
49
50 dialplangoto = cbimap:section(TypedSection, "dialplangoto", "Dialplan Goto", "")
51 dialplangoto.anonymous = true
52 dialplangoto.addremove = true
53 dialplangoto.dynamic = true
54
55
56 dialplanmeetme = cbimap:section(TypedSection, "dialplanmeetme", "Dialplan Conference", "")
57 dialplanmeetme.anonymous = true
58 dialplanmeetme.addremove = true
59 dialplanmeetme.dynamic = true
60
61
62 dialplansaytime = cbimap:section(TypedSection, "dialplansaytime", "Dialplan Time", "")
63 dialplansaytime.anonymous = true
64 dialplansaytime.addremove = true
65 dialplansaytime.dynamic = true
66
67
68 dialplanvoice = cbimap:section(TypedSection, "dialplanvoice", "Dialplan Voicemail", "")
69 dialplanvoice.anonymous = true
70 dialplanvoice.addremove = true
71 dialplanvoice.dynamic = true
72
73
74 dialzone = cbimap:section(TypedSection, "dialzone", "Dial Zones for Dialplan", "")
75 dialzone.addremove = true
76 dialzone.template = "cbi/tblsection"
77
78 addprefix = dialzone:option(Value, "addprefix", "Prefix to add matching dialplans", "")
79 addprefix.rmempty = true
80
81 --international = dialzone:option(DynamicList, "international", "Match International prefix", "")
82 international = dialzone:option(Value, "international", "Match International prefix", "")
83 international.rmempty = true
84
85 localprefix = dialzone:option(Value, "localprefix", "Prefix (0) to add/remove to/from intl. numbers", "")
86 localprefix.rmempty = true
87
88 localzone = dialzone:option(Value, "localzone", "Dialzone for intl. numbers matched as local", "")
89 localzone.titleref = luci.dispatcher.build_url( "admin", "services", "asterisk", "dialplans" )
90 cbimap.uci:foreach( "asterisk", "dialplan", function(s) localzone:value(s['.name']) end )
91 cbimap.uci:foreach( "asterisk", "dialzone", function(s) localzone:value(s['.name']) end )
92
93 match = dialzone:option(Value, "match", "Match plan", "")
94 match.rmempty = true
95
96 uses = dialzone:option(ListValue, "uses", "Connection to use", "")
97 uses.titleref = luci.dispatcher.build_url( "admin", "services", "asterisk", "sip-conns" )
98 cbimap.uci:foreach( "asterisk", "sip", function(s) uses:value('SIP/'..s['.name']) end )
99 cbimap.uci:foreach( "asterisk", "iax", function(s) uses:value('IAX/'..s['.name']) end )
100
101
102 return cbimap