aboutsummaryrefslogtreecommitdiffstats
path: root/main/acf-provisioning/acf-provisioning.post-upgrade
blob: f37be4ddceb6129924b8be1e4a3cdb19a1bbd3d7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
#!/bin/sh

new=$1
old=$2

# if current is older than 0.0.7-r1 we update.
if [ "$(apk version -t $old 0.0.7-r1)" = "<" ]; then

psql -U postgres -c "INSERT INTO provisioning_classes VALUES(default, (SELECT class_group_id FROM provisioning_class_groups WHERE name='device'), 'Unsupported Phone', '999')"\
	provisioning
psql -U postgres -c "INSERT INTO provisioning_groups VALUES(default, 'reg1', 'Registration 1 Unsupported', '10')"\
	provisioning
psql -U postgres -c "INSERT INTO classes_to_param_groups VALUES((SELECT class_id FROM provisioning_classes WHERE label='Unsupported Phone'), (SELECT group_id FROM provisioning_groups WHERE label='Registration 1 Unsupported'))"\
	provisioning
psql -U postgres -c "INSERT INTO param_groups_to_params VALUES((SELECT group_id FROM provisioning_groups WHERE label='Registration 1 Unsupported'), (SELECT param_id FROM provisioning_params WHERE name='extension'), null, true)"\
	provisioning
psql -U postgres -c "INSERT INTO param_groups_to_params VALUES((SELECT group_id FROM provisioning_groups WHERE label='Registration 1 Unsupported'), (SELECT param_id FROM provisioning_params WHERE name='password'), null, true)"\
	provisioning

fi

# if current is older than 0.0.8 we update.
if [ "$(apk version -t $old 0.0.8)" = "<" ]; then

psql -U postgres -c "ALTER TABLE provisioning_params ADD COLUMN validate text" provisioning

psql -U postgres -c "UPDATE provisioning_params SET descr='Phone dial pattern based on section 2.1.5 of RFC 3435, plus a comma to turn dialtone back on', regexp='^[*#0-9xT|,.%[%]-]*\$' WHERE name='digitmap'" provisioning
psql -U postgres -c "UPDATE provisioning_params SET descr='Timeout in seconds for each segment of digit map (separated by ''|'')', regexp='^[0-9|]*\$' WHERE name='digitmaptimeout'" provisioning

psql -U postgres -c "UPDATE provisioning_params SET regexp='^%x%x%x%x%x%x%x%x%x%x%x%x\$', validate='local value, functions, params = ...\nvalue = string.upper(value)\nlocal others = functions.getselectresponse(\"SELECT count(*) FROM provisioning_values WHERE param_id=\\'\"..params.value.device.value.mac.param_id..\"\\' AND device_id!=\\'\"..params.value.device_id.value..\"\\' AND value=\\'\"..value..\"\\'\")\nif tonumber(others[1].count) > 0 then\n\treturn value, \"MAC Address must be unique\"\nend\nreturn value' WHERE name='mac'" provisioning

psql -U postgres -c "INSERT INTO provisioning_params VALUES(default, 'callwaitingenable', 'boolean', 'Call Waiting Enable', '', 'true', '205', '', null)" provisioning
psql -U postgres -c "INSERT INTO provisioning_params VALUES(default, 'speeddialenable', 'boolean', 'Speed Dial Enable', '', 'true', '206', '', null)" provisioning
psql -U postgres -c "INSERT INTO param_groups_to_params VALUES((SELECT group_id FROM provisioning_groups WHERE label='Standard Phone'), (SELECT param_id FROM provisioning_params WHERE name='callwaitingenable'), 'true', false)" provisioning
psql -U postgres -c "INSERT INTO param_groups_to_params VALUES((SELECT group_id FROM provisioning_groups WHERE label='Standard Phone'), (SELECT param_id FROM provisioning_params WHERE name='speeddialenable'), 'true', false)" provisioning
psql -U postgres -c "INSERT INTO param_groups_to_params VALUES((SELECT group_id FROM provisioning_groups WHERE label='Public Phone'), (SELECT param_id FROM provisioning_params WHERE name='callwaitingenable'), 'true', false)" provisioning
psql -U postgres -c "INSERT INTO param_groups_to_params VALUES((SELECT group_id FROM provisioning_groups WHERE label='Public Phone'), (SELECT param_id FROM provisioning_params WHERE name='speeddialenable'), 'false', false)" provisioning
psql -U postgres -c "INSERT INTO param_groups_to_params VALUES((SELECT group_id FROM provisioning_groups WHERE label='Hotline'), (SELECT param_id FROM provisioning_params WHERE name='callwaitingenable'), 'true', false)" provisioning
psql -U postgres -c "INSERT INTO param_groups_to_params VALUES((SELECT group_id FROM provisioning_groups WHERE label='Hotline'), (SELECT param_id FROM provisioning_params WHERE name='speeddialenable'), 'false', false)" provisioning

fi

# if current is older than 0.0.9 we update.
if [ "$(apk version -t $old 0.0.9)" = "<" ]; then

psql -U postgres -c "INSERT INTO provisioning_params VALUES(default, 'mailbox', 'text', 'Voice Mailbox', 'Mailbox extension or URL', '', '207', '', null)" provisioning
psql -U postgres -c "INSERT INTO param_groups_to_params VALUES((SELECT group_id FROM provisioning_groups WHERE label='Standard Phone'), (SELECT param_id FROM provisioning_params WHERE name='mailbox'), '', true)" provisioning

fi

# if current is older than 0.0.11 we update.
if [ "$(apk version -t $old 0.0.11)" = "<" ]; then

psql -U postgres -c "INSERT INTO provisioning_classes VALUES(default, (SELECT class_group_id FROM provisioning_class_groups WHERE name='device'), 'Polycom SoundPoint IP 450 SIP', '2')" provisioning
psql -U postgres -c "INSERT INTO provisioning_classes VALUES(default, (SELECT class_group_id FROM provisioning_class_groups WHERE name='device'), 'Polycom SoundPoint IP 550/560 SIP', '3')" provisioning
psql -U postgres -c "INSERT INTO provisioning_classes VALUES(default, (SELECT class_group_id FROM provisioning_class_groups WHERE name='device'), 'Polycom VVX 1500', '6')" provisioning
psql -U postgres -c "UPDATE provisioning_classes SET label='Polycom SoundStation IP 5000/6000/7000 SIP', seq='5' WHERE label='Polycom SoundStation IP 6000 SIP'" provisioning
psql -U postgres -c "UPDATE provisioning_classes SET label='Polycom SoundPoint IP 320/321/330/331/335 SIP', seq='1' WHERE label='Polycom SoundPoint IP 321/331/335 SIP'" provisioning
psql -U postgres -c "UPDATE provisioning_classes SET label='Polycom SoundPoint IP 650/670 SIP', seq='4' WHERE label='Polycom SoundPoint IP 650 SIP'" provisioning
psql -U postgres -c "UPDATE provisioning_classes SET seq='7' WHERE label='Linksys Internet Phone Adapter PAP2T'" provisioning
psql -U postgres -c "INSERT INTO classes_to_param_groups VALUES((SELECT class_id FROM provisioning_classes WHERE label='Polycom SoundPoint IP 450 SIP'), (SELECT group_id FROM provisioning_groups WHERE label='Registration 1'))" provisioning
psql -U postgres -c "INSERT INTO classes_to_param_groups VALUES((SELECT class_id FROM provisioning_classes WHERE label='Polycom SoundPoint IP 450 SIP'), (SELECT group_id FROM provisioning_groups WHERE label='Registration 2'))" provisioning
psql -U postgres -c "INSERT INTO classes_to_param_groups VALUES((SELECT class_id FROM provisioning_classes WHERE label='Polycom SoundPoint IP 450 SIP'), (SELECT group_id FROM provisioning_groups WHERE label='Registration 3'))" provisioning
psql -U postgres -c "INSERT INTO classes_to_param_groups VALUES((SELECT class_id FROM provisioning_classes WHERE label='Polycom SoundPoint IP 450 SIP'), (SELECT group_id FROM provisioning_groups WHERE label='Polycom Device'))" provisioning
psql -U postgres -c "INSERT INTO classes_to_param_groups VALUES((SELECT class_id FROM provisioning_classes WHERE label='Polycom SoundPoint IP 550/560 SIP'), (SELECT group_id FROM provisioning_groups WHERE label='Registration 1'))" provisioning
psql -U postgres -c "INSERT INTO classes_to_param_groups VALUES((SELECT class_id FROM provisioning_classes WHERE label='Polycom SoundPoint IP 550/560 SIP'), (SELECT group_id FROM provisioning_groups WHERE label='Registration 2'))" provisioning
psql -U postgres -c "INSERT INTO classes_to_param_groups VALUES((SELECT class_id FROM provisioning_classes WHERE label='Polycom SoundPoint IP 550/560 SIP'), (SELECT group_id FROM provisioning_groups WHERE label='Registration 3'))" provisioning
psql -U postgres -c "INSERT INTO classes_to_param_groups VALUES((SELECT class_id FROM provisioning_classes WHERE label='Polycom SoundPoint IP 550/560 SIP'), (SELECT group_id FROM provisioning_groups WHERE label='Registration 4'))" provisioning
psql -U postgres -c "INSERT INTO classes_to_param_groups VALUES((SELECT class_id FROM provisioning_classes WHERE label='Polycom SoundPoint IP 550/560 SIP'), (SELECT group_id FROM provisioning_groups WHERE label='Polycom Device'))" provisioning
psql -U postgres -c "INSERT INTO classes_to_param_groups VALUES((SELECT class_id FROM provisioning_classes WHERE label='Polycom VVX 1500'), (SELECT group_id FROM provisioning_groups WHERE label='Registration 1'))" provisioning
psql -U postgres -c "INSERT INTO classes_to_param_groups VALUES((SELECT class_id FROM provisioning_classes WHERE label='Polycom VVX 1500'), (SELECT group_id FROM provisioning_groups WHERE label='Registration 2'))" provisioning
psql -U postgres -c "INSERT INTO classes_to_param_groups VALUES((SELECT class_id FROM provisioning_classes WHERE label='Polycom VVX 1500'), (SELECT group_id FROM provisioning_groups WHERE label='Registration 3'))" provisioning
psql -U postgres -c "INSERT INTO classes_to_param_groups VALUES((SELECT class_id FROM provisioning_classes WHERE label='Polycom VVX 1500'), (SELECT group_id FROM provisioning_groups WHERE label='Registration 4'))" provisioning
psql -U postgres -c "INSERT INTO classes_to_param_groups VALUES((SELECT class_id FROM provisioning_classes WHERE label='Polycom VVX 1500'), (SELECT group_id FROM provisioning_groups WHERE label='Registration 5'))" provisioning
psql -U postgres -c "INSERT INTO classes_to_param_groups VALUES((SELECT class_id FROM provisioning_classes WHERE label='Polycom VVX 1500'), (SELECT group_id FROM provisioning_groups WHERE label='Polycom Device'))" provisioning
psql -U postgres -c "UPDATE param_groups_to_params SET value=null WHERE group_id=(SELECT group_id FROM provisioning_groups WHERE label='Standard Phone') AND param_id=(SELECT param_id FROM provisioning_params WHERE name='mailbox')" provisioning
psql -U postgres -c "INSERT INTO param_groups_to_params VALUES((SELECT group_id FROM provisioning_groups WHERE label='Standard Phone'), (SELECT param_id FROM provisioning_params WHERE name='mailcallback'), null, true)" provisioning
psql -U postgres -c "INSERT INTO provisioning_params VALUES(default, 'mailcallback', 'text', 'Voice Mailbox Callback', 'Extension or URL for mailbox message retrieval', '', '208', '', null)" provisioning

fi

# if current is older than 0.1.1 we update.
if [ "$(apk version -t $old 0.1.1)" = "<" ]; then

psql -U postgres -c "INSERT INTO provisioning_groups VALUES(default, 'device', 'Snom Device', '1')" provisioning
psql -U postgres -c "INSERT INTO provisioning_groups VALUES(default, 'reg1', 'Registration 1 No Forwarding', '10')" provisioning
psql -U postgres -c "INSERT INTO provisioning_groups VALUES(default, 'reg2', 'Registration 2 No Forwarding', '10')" provisioning
psql -U postgres -c "INSERT INTO provisioning_groups VALUES(default, 'reg3', 'Registration 3 No Forwarding', '10')" provisioning
psql -U postgres -c "INSERT INTO provisioning_groups VALUES(default, 'reg4', 'Registration 4 No Forwarding', '10')" provisioning
psql -U postgres -c "INSERT INTO provisioning_groups VALUES(default, 'reg5', 'Registration 5 No Forwarding', '10')" provisioning
psql -U postgres -c "INSERT INTO provisioning_groups VALUES(default, 'reg6', 'Registration 6 No Forwarding', '10')" provisioning
psql -U postgres -c "INSERT INTO provisioning_groups VALUES(default, 'reg7', 'Registration 7 No Forwarding', '10')" provisioning
psql -U postgres -c "INSERT INTO provisioning_groups VALUES(default, 'reg8', 'Registration 8 No Forwarding', '10')" provisioning
psql -U postgres -c "INSERT INTO provisioning_groups VALUES(default, 'reg9', 'Registration 9 No Forwarding', '10')" provisioning
psql -U postgres -c "INSERT INTO provisioning_groups VALUES(default, 'reg10', 'Registration 10 No Forwarding', '11')" provisioning
psql -U postgres -c "INSERT INTO provisioning_groups VALUES(default, 'reg11', 'Registration 11 No Forwarding', '11')" provisioning
psql -U postgres -c "INSERT INTO provisioning_groups VALUES(default, 'reg12', 'Registration 12 No Forwarding', '11')" provisioning
psql -U postgres -c "INSERT INTO param_groups_to_params VALUES((SELECT group_id FROM provisioning_groups WHERE label='Snom Device'), (SELECT param_id FROM provisioning_params WHERE name='template'), '/etc/provisioning/templates/snom-template.lua', false)" provisioning
psql -U postgres -c "INSERT INTO param_groups_to_params VALUES((SELECT group_id FROM provisioning_groups WHERE label='Snom Device'), (SELECT param_id FROM provisioning_params WHERE name='mac'), null, true)" provisioning
psql -U postgres -c "INSERT INTO param_groups_to_params VALUES((SELECT group_id FROM provisioning_groups WHERE label='Snom Device'), (SELECT param_id FROM provisioning_params WHERE name='registrar'), null, false)" provisioning
psql -U postgres -c "INSERT INTO param_groups_to_params VALUES((SELECT group_id FROM provisioning_groups WHERE label='Snom Device'), (SELECT param_id FROM provisioning_params WHERE name='digitmap'), null, false)" provisioning
psql -U postgres -c "INSERT INTO param_groups_to_params VALUES((SELECT group_id FROM provisioning_groups WHERE label='Snom Device'), (SELECT param_id FROM provisioning_params WHERE name='digitmaptimeout'), null, false)" provisioning
psql -U postgres -c "INSERT INTO param_groups_to_params VALUES((SELECT group_id FROM provisioning_groups WHERE label='Snom Device'), (SELECT param_id FROM provisioning_params WHERE name='sntpserver'), null, false)" provisioning
psql -U postgres -c "INSERT INTO param_groups_to_params VALUES((SELECT group_id FROM provisioning_groups WHERE label='Snom Device'), (SELECT param_id FROM provisioning_params WHERE name='timezone'), null, false)" provisioning
psql -U postgres -c "INSERT INTO param_groups_to_params VALUES((SELECT group_id FROM provisioning_groups WHERE label='Snom Device'), (SELECT param_id FROM provisioning_params WHERE name='musiconhold'), null, false)" provisioning
psql -U postgres -c "INSERT INTO param_groups_to_params VALUES((SELECT group_id FROM provisioning_groups WHERE label='Snom Device'), (SELECT param_id FROM provisioning_params WHERE name='adminpassword'), null, false)" provisioning
psql -U postgres -c "INSERT INTO param_groups_to_params VALUES((SELECT group_id FROM provisioning_groups WHERE label='Snom Device'), (SELECT param_id FROM provisioning_params WHERE name='pcportenable'), null, false)" provisioning
psql -U postgres -c "INSERT INTO param_groups_to_params VALUES((SELECT group_id FROM provisioning_groups WHERE label='Snom Device'), (SELECT param_id FROM provisioning_params WHERE name='urldialingenable'), null, false)" provisioning
psql -U postgres -c "INSERT INTO param_groups_to_params VALUES((SELECT group_id FROM provisioning_groups WHERE label='Snom Device'), (SELECT param_id FROM provisioning_params WHERE name='forwardnoanswer'), null, true)" provisioning
psql -U postgres -c "INSERT INTO param_groups_to_params VALUES((SELECT group_id FROM provisioning_groups WHERE label='Snom Device'), (SELECT param_id FROM provisioning_params WHERE name='forwardnoanswerenable'), null, true)" provisioning
psql -U postgres -c "INSERT INTO param_groups_to_params VALUES((SELECT group_id FROM provisioning_groups WHERE label='Snom Device'), (SELECT param_id FROM provisioning_params WHERE name='forwardbusy'), null, true)" provisioning
psql -U postgres -c "INSERT INTO param_groups_to_params VALUES((SELECT group_id FROM provisioning_groups WHERE label='Snom Device'), (SELECT param_id FROM provisioning_params WHERE name='forwardbusyenable'), null, true)" provisioning
psql -U postgres -c "INSERT INTO param_groups_to_params VALUES((SELECT group_id FROM provisioning_groups WHERE label='Snom Device'), (SELECT param_id FROM provisioning_params WHERE name='forwardall'), null, true)" provisioning
psql -U postgres -c "INSERT INTO param_groups_to_params VALUES((SELECT group_id FROM provisioning_groups WHERE label='Snom Device'), (SELECT param_id FROM provisioning_params WHERE name='forwardallenable'), null, true)" provisioning
psql -U postgres -c "INSERT INTO param_groups_to_params VALUES((SELECT group_id FROM provisioning_groups WHERE label='Registration 1 No Forwarding'), (SELECT param_id FROM provisioning_params WHERE name='extension'), null, true)" provisioning
psql -U postgres -c "INSERT INTO param_groups_to_params VALUES((SELECT group_id FROM provisioning_groups WHERE label='Registration 1 No Forwarding'), (SELECT param_id FROM provisioning_params WHERE name='password'), null, false)" provisioning
psql -U postgres -c "INSERT INTO param_groups_to_params VALUES((SELECT group_id FROM provisioning_groups WHERE label='Registration 1 No Forwarding'), (SELECT param_id FROM provisioning_params WHERE name='callerid'), null, true)" provisioning
psql -U postgres -c "INSERT INTO param_groups_to_params VALUES((SELECT group_id FROM provisioning_groups WHERE label='Registration 2 No Forwarding'), (SELECT param_id FROM provisioning_params WHERE name='extension'), null, true)" provisioning
psql -U postgres -c "INSERT INTO param_groups_to_params VALUES((SELECT group_id FROM provisioning_groups WHERE label='Registration 2 No Forwarding'), (SELECT param_id FROM provisioning_params WHERE name='password'), null, false)" provisioning
psql -U postgres -c "INSERT INTO param_groups_to_params VALUES((SELECT group_id FROM provisioning_groups WHERE label='Registration 2 No Forwarding'), (SELECT param_id FROM provisioning_params WHERE name='callerid'), null, true)" provisioning
psql -U postgres -c "INSERT INTO param_groups_to_params VALUES((SELECT group_id FROM provisioning_groups WHERE label='Registration 3 No Forwarding'), (SELECT param_id FROM provisioning_params WHERE name='extension'), null, true)" provisioning
psql -U postgres -c "INSERT INTO param_groups_to_params VALUES((SELECT group_id FROM provisioning_groups WHERE label='Registration 3 No Forwarding'), (SELECT param_id FROM provisioning_params WHERE name='password'), null, false)" provisioning
psql -U postgres -c "INSERT INTO param_groups_to_params VALUES((SELECT group_id FROM provisioning_groups WHERE label='Registration 3 No Forwarding'), (SELECT param_id FROM provisioning_params WHERE name='callerid'), null, true)" provisioning
psql -U postgres -c "INSERT INTO param_groups_to_params VALUES((SELECT group_id FROM provisioning_groups WHERE label='Registration 4 No Forwarding'), (SELECT param_id FROM provisioning_params WHERE name='extension'), null, true)" provisioning
psql -U postgres -c "INSERT INTO param_groups_to_params VALUES((SELECT group_id FROM provisioning_groups WHERE label='Registration 4 No Forwarding'), (SELECT param_id FROM provisioning_params WHERE name='password'), null, false)" provisioning
psql -U postgres -c "INSERT INTO param_groups_to_params VALUES((SELECT group_id FROM provisioning_groups WHERE label='Registration 4 No Forwarding'), (SELECT param_id FROM provisioning_params WHERE name='callerid'), null, true)" provisioning
psql -U postgres -c "INSERT INTO param_groups_to_params VALUES((SELECT group_id FROM provisioning_groups WHERE label='Registration 5 No Forwarding'), (SELECT param_id FROM provisioning_params WHERE name='extension'), null, true)" provisioning
psql -U postgres -c "INSERT INTO param_groups_to_params VALUES((SELECT group_id FROM provisioning_groups WHERE label='Registration 5 No Forwarding'), (SELECT param_id FROM provisioning_params WHERE name='password'), null, false)" provisioning
psql -U postgres -c "INSERT INTO param_groups_to_params VALUES((SELECT group_id FROM provisioning_groups WHERE label='Registration 5 No Forwarding'), (SELECT param_id FROM provisioning_params WHERE name='callerid'), null, true)" provisioning
psql -U postgres -c "INSERT INTO param_groups_to_params VALUES((SELECT group_id FROM provisioning_groups WHERE label='Registration 6 No Forwarding'), (SELECT param_id FROM provisioning_params WHERE name='extension'), null, true)" provisioning
psql -U postgres -c "INSERT INTO param_groups_to_params VALUES((SELECT group_id FROM provisioning_groups WHERE label='Registration 6 No Forwarding'), (SELECT param_id FROM provisioning_params WHERE name='password'), null, false)" provisioning
psql -U postgres -c "INSERT INTO param_groups_to_params VALUES((SELECT group_id FROM provisioning_groups WHERE label='Registration 6 No Forwarding'), (SELECT param_id FROM provisioning_params WHERE name='callerid'), null, true)" provisioning
psql -U postgres -c "INSERT INTO param_groups_to_params VALUES((SELECT group_id FROM provisioning_groups WHERE label='Registration 7 No Forwarding'), (SELECT param_id FROM provisioning_params WHERE name='extension'), null, true)" provisioning
psql -U postgres -c "INSERT INTO param_groups_to_params VALUES((SELECT group_id FROM provisioning_groups WHERE label='Registration 7 No Forwarding'), (SELECT param_id FROM provisioning_params WHERE name='password'), null, false)" provisioning
psql -U postgres -c "INSERT INTO param_groups_to_params VALUES((SELECT group_id FROM provisioning_groups WHERE label='Registration 7 No Forwarding'), (SELECT param_id FROM provisioning_params WHERE name='callerid'), null, true)" provisioning
psql -U postgres -c "INSERT INTO param_groups_to_params VALUES((SELECT group_id FROM provisioning_groups WHERE label='Registration 8 No Forwarding'), (SELECT param_id FROM provisioning_params WHERE name='extension'), null, true)" provisioning
psql -U postgres -c "INSERT INTO param_groups_to_params VALUES((SELECT group_id FROM provisioning_groups WHERE label='Registration 8 No Forwarding'), (SELECT param_id FROM provisioning_params WHERE name='password'), null, false)" provisioning
psql -U postgres -c "INSERT INTO param_groups_to_params VALUES((SELECT group_id FROM provisioning_groups WHERE label='Registration 8 No Forwarding'), (SELECT param_id FROM provisioning_params WHERE name='callerid'), null, true)" provisioning
psql -U postgres -c "INSERT INTO param_groups_to_params VALUES((SELECT group_id FROM provisioning_groups WHERE label='Registration 9 No Forwarding'), (SELECT param_id FROM provisioning_params WHERE name='extension'), null, true)" provisioning
psql -U postgres -c "INSERT INTO param_groups_to_params VALUES((SELECT group_id FROM provisioning_groups WHERE label='Registration 9 No Forwarding'), (SELECT param_id FROM provisioning_params WHERE name='password'), null, false)" provisioning
psql -U postgres -c "INSERT INTO param_groups_to_params VALUES((SELECT group_id FROM provisioning_groups WHERE label='Registration 9 No Forwarding'), (SELECT param_id FROM provisioning_params WHERE name='callerid'), null, true)" provisioning
psql -U postgres -c "INSERT INTO param_groups_to_params VALUES((SELECT group_id FROM provisioning_groups WHERE label='Registration 10 No Forwarding'), (SELECT param_id FROM provisioning_params WHERE name='extension'), null, true)" provisioning
psql -U postgres -c "INSERT INTO param_groups_to_params VALUES((SELECT group_id FROM provisioning_groups WHERE label='Registration 10 No Forwarding'), (SELECT param_id FROM provisioning_params WHERE name='password'), null, false)" provisioning
psql -U postgres -c "INSERT INTO param_groups_to_params VALUES((SELECT group_id FROM provisioning_groups WHERE label='Registration 10 No Forwarding'), (SELECT param_id FROM provisioning_params WHERE name='callerid'), null, true)" provisioning
psql -U postgres -c "INSERT INTO param_groups_to_params VALUES((SELECT group_id FROM provisioning_groups WHERE label='Registration 11 No Forwarding'), (SELECT param_id FROM provisioning_params WHERE name='extension'), null, true)" provisioning
psql -U postgres -c "INSERT INTO param_groups_to_params VALUES((SELECT group_id FROM provisioning_groups WHERE label='Registration 11 No Forwarding'), (SELECT param_id FROM provisioning_params WHERE name='password'), null, false)" provisioning
psql -U postgres -c "INSERT INTO param_groups_to_params VALUES((SELECT group_id FROM provisioning_groups WHERE label='Registration 11 No Forwarding'), (SELECT param_id FROM provisioning_params WHERE name='callerid'), null, true)" provisioning
psql -U postgres -c "INSERT INTO param_groups_to_params VALUES((SELECT group_id FROM provisioning_groups WHERE label='Registration 12 No Forwarding'), (SELECT param_id FROM provisioning_params WHERE name='extension'), null, true)" provisioning
psql -U postgres -c "INSERT INTO param_groups_to_params VALUES((SELECT group_id FROM provisioning_groups WHERE label='Registration 12 No Forwarding'), (SELECT param_id FROM provisioning_params WHERE name='password'), null, false)" provisioning
psql -U postgres -c "INSERT INTO param_groups_to_params VALUES((SELECT group_id FROM provisioning_groups WHERE label='Registration 12 No Forwarding'), (SELECT param_id FROM provisioning_params WHERE name='callerid'), null, true)" provisioning
psql -U postgres -c "INSERT INTO provisioning_options VALUES((SELECT param_id FROM provisioning_params WHERE name='template'), 'Snom', '/etc/provisioning/templates/snom-template.lua', '3')" provisioning
psql -U postgres -c "INSERT INTO provisioning_classes VALUES(default, (SELECT class_group_id FROM provisioning_class_groups WHERE name='device'), 'Snom 300', '10')" provisioning
psql -U postgres -c "INSERT INTO provisioning_classes VALUES(default, (SELECT class_group_id FROM provisioning_class_groups WHERE name='device'), 'Snom 320/360/370', '11')" provisioning
psql -U postgres -c "INSERT INTO classes_to_param_groups VALUES((SELECT class_id FROM provisioning_classes WHERE label='Snom 300'), (SELECT group_id FROM provisioning_groups WHERE label='Registration 1 No Forwarding'))" provisioning
psql -U postgres -c "INSERT INTO classes_to_param_groups VALUES((SELECT class_id FROM provisioning_classes WHERE label='Snom 300'), (SELECT group_id FROM provisioning_groups WHERE label='Registration 2 No Forwarding'))" provisioning
psql -U postgres -c "INSERT INTO classes_to_param_groups VALUES((SELECT class_id FROM provisioning_classes WHERE label='Snom 300'), (SELECT group_id FROM provisioning_groups WHERE label='Registration 3 No Forwarding'))" provisioning
psql -U postgres -c "INSERT INTO classes_to_param_groups VALUES((SELECT class_id FROM provisioning_classes WHERE label='Snom 300'), (SELECT group_id FROM provisioning_groups WHERE label='Registration 4 No Forwarding'))" provisioning
psql -U postgres -c "INSERT INTO classes_to_param_groups VALUES((SELECT class_id FROM provisioning_classes WHERE label='Snom 300'), (SELECT group_id FROM provisioning_groups WHERE label='Snom Device'))" provisioning
psql -U postgres -c "INSERT INTO classes_to_param_groups VALUES((SELECT class_id FROM provisioning_classes WHERE label='Snom 320/360/370'), (SELECT group_id FROM provisioning_groups WHERE label='Registration 1 No Forwarding'))" provisioning
psql -U postgres -c "INSERT INTO classes_to_param_groups VALUES((SELECT class_id FROM provisioning_classes WHERE label='Snom 320/360/370'), (SELECT group_id FROM provisioning_groups WHERE label='Registration 2 No Forwarding'))" provisioning
psql -U postgres -c "INSERT INTO classes_to_param_groups VALUES((SELECT class_id FROM provisioning_classes WHERE label='Snom 320/360/370'), (SELECT group_id FROM provisioning_groups WHERE label='Registration 3 No Forwarding'))" provisioning
psql -U postgres -c "INSERT INTO classes_to_param_groups VALUES((SELECT class_id FROM provisioning_classes WHERE label='Snom 320/360/370'), (SELECT group_id FROM provisioning_groups WHERE label='Registration 4 No Forwarding'))" provisioning
psql -U postgres -c "INSERT INTO classes_to_param_groups VALUES((SELECT class_id FROM provisioning_classes WHERE label='Snom 320/360/370'), (SELECT group_id FROM provisioning_groups WHERE label='Registration 5 No Forwarding'))" provisioning
psql -U postgres -c "INSERT INTO classes_to_param_groups VALUES((SELECT class_id FROM provisioning_classes WHERE label='Snom 320/360/370'), (SELECT group_id FROM provisioning_groups WHERE label='Registration 6 No Forwarding'))" provisioning
psql -U postgres -c "INSERT INTO classes_to_param_groups VALUES((SELECT class_id FROM provisioning_classes WHERE label='Snom 320/360/370'), (SELECT group_id FROM provisioning_groups WHERE label='Registration 7 No Forwarding'))" provisioning
psql -U postgres -c "INSERT INTO classes_to_param_groups VALUES((SELECT class_id FROM provisioning_classes WHERE label='Snom 320/360/370'), (SELECT group_id FROM provisioning_groups WHERE label='Registration 8 No Forwarding'))" provisioning
psql -U postgres -c "INSERT INTO classes_to_param_groups VALUES((SELECT class_id FROM provisioning_classes WHERE label='Snom 320/360/370'), (SELECT group_id FROM provisioning_groups WHERE label='Registration 9 No Forwarding'))" provisioning
psql -U postgres -c "INSERT INTO classes_to_param_groups VALUES((SELECT class_id FROM provisioning_classes WHERE label='Snom 320/360/370'), (SELECT group_id FROM provisioning_groups WHERE label='Registration 10 No Forwarding'))" provisioning
psql -U postgres -c "INSERT INTO classes_to_param_groups VALUES((SELECT class_id FROM provisioning_classes WHERE label='Snom 320/360/370'), (SELECT group_id FROM provisioning_groups WHERE label='Registration 11 No Forwarding'))" provisioning
psql -U postgres -c "INSERT INTO classes_to_param_groups VALUES((SELECT class_id FROM provisioning_classes WHERE label='Snom 320/360/370'), (SELECT group_id FROM provisioning_groups WHERE label='Registration 12 No Forwarding'))" provisioning
psql -U postgres -c "INSERT INTO classes_to_param_groups VALUES((SELECT class_id FROM provisioning_classes WHERE label='Snom 320/360/370'), (SELECT group_id FROM provisioning_groups WHERE label='Snom Device'))" provisioning
psql -U postgres -c "UPDATE provisioning_params SET value='UTC0' WHERE name='timezone' and value=''" provisioning

fi

exit 0