* luci/app/asterisk: more work on cbi models
[project/luci.git] / applications / luci-asterisk / luasrc / model / cbi / asterisk-sip-connections.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 sip = cbimap:section(TypedSection, "sip", "SIP Connection", "")
19 sip.addremove = true
20
21 alwaysinternational = sip:option(Flag, "alwaysinternational", "Always Dial International", "")
22 alwaysinternational.optional = true
23
24 canreinvite = sip:option(ListValue, "canreinvite", "Reinvite/redirect media connections", "")
25 canreinvite:value("yes", "Yes")
26 canreinvite:value("nonat", "Yes when not behind NAT")
27 canreinvite:value("update", "Use UPDATE rather than INVITE for path redirection")
28 canreinvite:value("no", "No")
29 canreinvite.optional = true
30
31 context = sip:option(ListValue, "context", "Context to use", "")
32 context.titleref = luci.dispatcher.build_url( "admin", "services", "asterisk", "dialplans" )
33 cbimap.uci:foreach( "asterisk", "dialplan", function(s) context:value(s['.name']) end )
34 cbimap.uci:foreach( "asterisk", "dialzone", function(s) context:value(s['.name']) end )
35
36 countrycode = sip:option(Value, "countrycode", "Country Code for connection", "")
37 countrycode.optional = true
38
39 dtmfmode = sip:option(ListValue, "dtmfmode", "DTMF mode", "")
40 dtmfmode:value("info", "Use RFC2833 or INFO for the BudgeTone")
41 dtmfmode:value("rfc2833", "Use RFC2833 for the BudgeTone")
42 dtmfmode:value("inband", "Use Inband (only with ulaw/alaw)")
43 dtmfmode.optional = true
44
45 extension = sip:option(Value, "extension", "Add as Extension", "")
46 extension.optional = true
47
48 fromdomain = sip:option(Value, "fromdomain", "Primary domain identity for From: headers", "")
49 fromdomain.optional = true
50
51 fromuser = sip:option(Value, "fromuser", "From user (required by many SIP providers)", "")
52 fromuser.optional = true
53
54 host = sip:option(Value, "host", "Host name (or blank)", "")
55 host.optional = true
56
57 incoming = sip:option(DynamicList, "incoming", "Ring on incoming dialplan contexts", "")
58 incoming.optional = true
59
60 insecure = sip:option(ListValue, "insecure", "Allow Insecure for", "")
61 insecure:value("port", "Allow mismatched port number")
62 insecure:value("invite", "Do not require auth of incoming INVITE")
63 insecure:value("port,invite", "Allow mismatched port and Do not require auth of incoming INVITE")
64 insecure.optional = true
65
66 internationalprefix = sip:option(Value, "internationalprefix", "International Dial Prefix", "")
67 internationalprefix.optional = true
68
69 mailbox = sip:option(Value, "mailbox", "Mailbox for MWI", "")
70 mailbox.optional = true
71
72 nat = sip:option(Flag, "nat", "NAT between phone and Asterisk", "")
73 nat.optional = true
74
75 pedantic = sip:option(Flag, "pedantic", "Check tags in headers", "")
76 pedantic.optional = true
77
78 port = sip:option(Value, "port", "SIP Port", "")
79 port.optional = true
80
81 prefix = sip:option(Value, "prefix", "Dial Prefix (for external line)", "")
82 prefix.optional = true
83
84 qualify = sip:option(Value, "qualify", "Reply Timeout (ms) for down connection", "")
85 qualify.optional = true
86
87 register = sip:option(Flag, "register", "Register connection", "")
88 register.optional = true
89
90 secret = sip:option(Value, "secret", "Secret", "")
91 secret.optional = true
92
93 selfmailbox = sip:option(Flag, "selfmailbox", "Dial own extension for mailbox", "")
94 selfmailbox.optional = true
95
96 timeout = sip:option(Value, "timeout", "Dial Timeout (sec)", "")
97 timeout.optional = true
98
99 type = sip:option(ListValue, "type", "Client Type", "")
100 type:value("friend", "Friend (outbound/inbound)")
101 type:value("user", "User (inbound - authenticate by \"from\")")
102 type:value("peer", "Peer (outbound - match by host)")
103 type.optional = true
104
105 username = sip:option(Value, "username", "Username", "")
106 username.optional = true
107
108
109 return cbimap