21 Revision ID: 4da0c5f79a9c 23 Create Date: 2013-07-28 12:28:03.091587 28 revision =
'4da0c5f79a9c' 31 from alembic
import op
32 import sqlalchemy
as sa
33 from sqlalchemy.dialects.postgresql
import ENUM
35 YESNO_VALUES = [
'yes',
'no']
36 TYPE_VALUES = [
'friend',
'user',
'peer']
38 SIP_TRANSPORT_VALUES = [
'udp',
'tcp',
'tls',
'ws',
'wss',
'udp,tcp',
'tcp,udp']
39 SIP_DTMFMODE_VALUES = [
'rfc2833',
'info',
'shortinfo',
'inband',
'auto']
40 SIP_DIRECTMEDIA_VALUES = [
'yes',
'no',
'nonat',
'update']
41 SIP_PROGRESSINBAND_VALUES = [
'yes',
'no',
'never']
42 SIP_SESSION_TIMERS_VALUES = [
'accept',
'refuse',
'originate']
43 SIP_SESSION_REFRESHER_VALUES = [
'uac',
'uas']
44 SIP_CALLINGPRES_VALUES = [
'allowed_not_screened',
'allowed_passed_screen',
45 'allowed_failed_screen',
'allowed',
46 'prohib_not_screened',
'prohib_passed_screen',
47 'prohib_failed_screen',
'prohib']
49 IAX_REQUIRECALLTOKEN_VALUES = [
'yes',
'no',
'auto']
50 IAX_ENCRYPTION_VALUES = [
'yes',
'no',
'aes128']
51 IAX_TRANSFER_VALUES = [
'yes',
'no',
'mediaonly']
53 MOH_MODE_VALUES = [
'custom',
'files',
'mp3nb',
'quietmp3nb',
'quietmp3']
59 sa.Column(
'id', sa.Integer, primary_key=
True, nullable=
False,
61 sa.Column(
'name', sa.String(40), nullable=
False, unique=
True),
62 sa.Column(
'ipaddr', sa.String(45)),
63 sa.Column(
'port', sa.Integer),
64 sa.Column(
'regseconds', sa.Integer),
65 sa.Column(
'defaultuser', sa.String(40)),
66 sa.Column(
'fullcontact', sa.String(80)),
67 sa.Column(
'regserver', sa.String(20)),
68 sa.Column(
'useragent', sa.String(20)),
69 sa.Column(
'lastms', sa.Integer),
70 sa.Column(
'host', sa.String(40)),
71 sa.Column(
'type', sa.Enum(*TYPE_VALUES, name=
'type_values')),
72 sa.Column(
'context', sa.String(40)),
73 sa.Column(
'permit', sa.String(95)),
74 sa.Column(
'deny', sa.String(95)),
75 sa.Column(
'secret', sa.String(40)),
76 sa.Column(
'md5secret', sa.String(40)),
77 sa.Column(
'remotesecret', sa.String(40)),
78 sa.Column(
'transport', sa.Enum(*SIP_TRANSPORT_VALUES,
79 name=
'sip_transport_values')),
80 sa.Column(
'dtmfmode', sa.Enum(*SIP_DTMFMODE_VALUES,
81 name=
'sip_dtmfmode_values')),
82 sa.Column(
'directmedia', sa.Enum(*SIP_DIRECTMEDIA_VALUES,
83 name=
'sip_directmedia_values')),
84 sa.Column(
'nat', sa.String(29)),
85 sa.Column(
'callgroup', sa.String(40)),
86 sa.Column(
'pickupgroup', sa.String(40)),
87 sa.Column(
'language', sa.String(40)),
88 sa.Column(
'disallow', sa.String(200)),
89 sa.Column(
'allow', sa.String(200)),
90 sa.Column(
'insecure', sa.String(40)),
91 sa.Column(
'trustrpid', sa.Enum(*YESNO_VALUES,
92 name=
'yes_no_values')),
93 sa.Column(
'progressinband', sa.Enum(*SIP_PROGRESSINBAND_VALUES,
94 name=
'sip_progressinband_values')),
95 sa.Column(
'promiscredir', sa.Enum(*YESNO_VALUES,
96 name=
'yes_no_values')),
97 sa.Column(
'useclientcode', sa.Enum(*YESNO_VALUES,
98 name=
'yes_no_values')),
99 sa.Column(
'accountcode', sa.String(40)),
100 sa.Column(
'setvar', sa.String(200)),
101 sa.Column(
'callerid', sa.String(40)),
102 sa.Column(
'amaflags', sa.String(40)),
103 sa.Column(
'callcounter', sa.Enum(*YESNO_VALUES,
104 name=
'yes_no_values')),
105 sa.Column(
'busylevel', sa.Integer),
106 sa.Column(
'allowoverlap', sa.Enum(*YESNO_VALUES,
107 name=
'yes_no_values')),
108 sa.Column(
'allowsubscribe', sa.Enum(*YESNO_VALUES,
109 name=
'yes_no_values')),
110 sa.Column(
'videosupport', sa.Enum(*YESNO_VALUES,
111 name=
'yes_no_values')),
112 sa.Column(
'maxcallbitrate', sa.Integer),
113 sa.Column(
'rfc2833compensate', sa.Enum(*YESNO_VALUES,
114 name=
'yes_no_values')),
115 sa.Column(
'mailbox', sa.String(40)),
116 sa.Column(
'session-timers', sa.Enum(*SIP_SESSION_TIMERS_VALUES,
117 name=
'sip_session_timers_values')),
118 sa.Column(
'session-expires', sa.Integer),
119 sa.Column(
'session-minse', sa.Integer),
120 sa.Column(
'session-refresher', sa.Enum(*SIP_SESSION_REFRESHER_VALUES,
121 name=
'sip_session_refresher_values')),
122 sa.Column(
't38pt_usertpsource', sa.String(40)),
123 sa.Column(
'regexten', sa.String(40)),
124 sa.Column(
'fromdomain', sa.String(40)),
125 sa.Column(
'fromuser', sa.String(40)),
126 sa.Column(
'qualify', sa.String(40)),
127 sa.Column(
'defaultip', sa.String(45)),
128 sa.Column(
'rtptimeout', sa.Integer),
129 sa.Column(
'rtpholdtimeout', sa.Integer),
130 sa.Column(
'sendrpid', sa.Enum(*YESNO_VALUES,
131 name=
'yes_no_values')),
132 sa.Column(
'outboundproxy', sa.String(40)),
133 sa.Column(
'callbackextension', sa.String(40)),
134 sa.Column(
'timert1', sa.Integer),
135 sa.Column(
'timerb', sa.Integer),
136 sa.Column(
'qualifyfreq', sa.Integer),
137 sa.Column(
'constantssrc', sa.Enum(*YESNO_VALUES,
138 name=
'yes_no_values')),
139 sa.Column(
'contactpermit', sa.String(95)),
140 sa.Column(
'contactdeny', sa.String(95)),
141 sa.Column(
'usereqphone', sa.Enum(*YESNO_VALUES, name=
'yes_no_values')),
142 sa.Column(
'textsupport', sa.Enum(*YESNO_VALUES, name=
'yes_no_values')),
143 sa.Column(
'faxdetect', sa.Enum(*YESNO_VALUES, name=
'yes_no_values')),
144 sa.Column(
'buggymwi', sa.Enum(*YESNO_VALUES, name=
'yes_no_values')),
145 sa.Column(
'auth', sa.String(40)),
146 sa.Column(
'fullname', sa.String(40)),
147 sa.Column(
'trunkname', sa.String(40)),
148 sa.Column(
'cid_number', sa.String(40)),
149 sa.Column(
'callingpres', sa.Enum(*SIP_CALLINGPRES_VALUES,
150 name=
'sip_callingpres_values')),
151 sa.Column(
'mohinterpret', sa.String(40)),
152 sa.Column(
'mohsuggest', sa.String(40)),
153 sa.Column(
'parkinglot', sa.String(40)),
154 sa.Column(
'hasvoicemail', sa.Enum(*YESNO_VALUES,
155 name=
'yes_no_values')),
156 sa.Column(
'subscribemwi', sa.Enum(*YESNO_VALUES,
157 name=
'yes_no_values')),
158 sa.Column(
'vmexten', sa.String(40)),
159 sa.Column(
'autoframing', sa.Enum(*YESNO_VALUES, name=
'yes_no_values')),
160 sa.Column(
'rtpkeepalive', sa.Integer),
161 sa.Column(
'call-limit', sa.Integer),
162 sa.Column(
'g726nonstandard', sa.Enum(*YESNO_VALUES,
163 name=
'yes_no_values')),
164 sa.Column(
'ignoresdpversion', sa.Enum(*YESNO_VALUES,
165 name=
'yes_no_values')),
166 sa.Column(
'allowtransfer', sa.Enum(*YESNO_VALUES,
167 name=
'yes_no_values')),
168 sa.Column(
'dynamic', sa.Enum(*YESNO_VALUES, name=
'yes_no_values')),
169 sa.Column(
'path', sa.String(256)),
170 sa.Column(
'supportpath', sa.Enum(*YESNO_VALUES, name=
'yes_no_values'))
172 op.create_index(
'sippeers_name',
'sippeers', [
'name'])
173 op.create_index(
'sippeers_name_host',
'sippeers', [
'name',
'host'])
174 op.create_index(
'sippeers_ipaddr_port',
'sippeers', [
'ipaddr',
'port'])
175 op.create_index(
'sippeers_host_port',
'sippeers', [
'host',
'port'])
179 sa.Column(
'id', sa.Integer, primary_key=
True, nullable=
False,
181 sa.Column(
'name', sa.String(40), nullable=
False, unique=
True),
182 sa.Column(
'type', sa.Enum(*TYPE_VALUES, name=
'type_values')),
183 sa.Column(
'username', sa.String(40)),
184 sa.Column(
'mailbox', sa.String(40)),
185 sa.Column(
'secret', sa.String(40)),
186 sa.Column(
'dbsecret', sa.String(40)),
187 sa.Column(
'context', sa.String(40)),
188 sa.Column(
'regcontext', sa.String(40)),
189 sa.Column(
'host', sa.String(40)),
190 sa.Column(
'ipaddr', sa.String(40)),
191 sa.Column(
'port', sa.Integer),
192 sa.Column(
'defaultip', sa.String(20)),
193 sa.Column(
'sourceaddress', sa.String(20)),
194 sa.Column(
'mask', sa.String(20)),
195 sa.Column(
'regexten', sa.String(40)),
196 sa.Column(
'regseconds', sa.Integer),
197 sa.Column(
'accountcode', sa.String(20)),
198 sa.Column(
'mohinterpret', sa.String(20)),
199 sa.Column(
'mohsuggest', sa.String(20)),
200 sa.Column(
'inkeys', sa.String(40)),
201 sa.Column(
'outkeys', sa.String(40)),
202 sa.Column(
'language', sa.String(10)),
203 sa.Column(
'callerid', sa.String(100)),
204 sa.Column(
'cid_number', sa.String(40)),
205 sa.Column(
'sendani', sa.Enum(*YESNO_VALUES, name=
'yes_no_values')),
206 sa.Column(
'fullname', sa.String(40)),
207 sa.Column(
'trunk', sa.Enum(*YESNO_VALUES, name=
'yes_no_values')),
208 sa.Column(
'auth', sa.String(20)),
209 sa.Column(
'maxauthreq', sa.Integer),
210 sa.Column(
'requirecalltoken', sa.Enum(*IAX_REQUIRECALLTOKEN_VALUES,
211 name=
'iax_requirecalltoken_values')),
212 sa.Column(
'encryption', sa.Enum(*IAX_ENCRYPTION_VALUES,
213 name=
'iax_encryption_values')),
214 sa.Column(
'transfer', sa.Enum(*IAX_TRANSFER_VALUES,
215 name=
'iax_transfer_values')),
216 sa.Column(
'jitterbuffer', sa.Enum(*YESNO_VALUES,
217 name=
'yes_no_values')),
218 sa.Column(
'forcejitterbuffer', sa.Enum(*YESNO_VALUES,
219 name=
'yes_no_values')),
220 sa.Column(
'disallow', sa.String(200)),
221 sa.Column(
'allow', sa.String(200)),
222 sa.Column(
'codecpriority', sa.String(40)),
223 sa.Column(
'qualify', sa.String(10)),
224 sa.Column(
'qualifysmoothing',
225 sa.Enum(*YESNO_VALUES, name=
'yes_no_values')),
226 sa.Column(
'qualifyfreqok', sa.String(10)),
227 sa.Column(
'qualifyfreqnotok', sa.String(10)),
228 sa.Column(
'timezone', sa.String(20)),
229 sa.Column(
'adsi', sa.Enum(*YESNO_VALUES, name=
'yes_no_values')),
230 sa.Column(
'amaflags', sa.String(20)),
231 sa.Column(
'setvar', sa.String(200))
233 op.create_index(
'iaxfriends_name',
'iaxfriends', [
'name'])
234 op.create_index(
'iaxfriends_name_host',
'iaxfriends', [
'name',
'host'])
235 op.create_index(
'iaxfriends_name_ipaddr_port',
'iaxfriends',
236 [
'name',
'ipaddr',
'port'])
237 op.create_index(
'iaxfriends_ipaddr_port',
'iaxfriends', [
'ipaddr',
'port'])
238 op.create_index(
'iaxfriends_host_port',
'iaxfriends', [
'host',
'port'])
242 sa.Column(
'uniqueid', sa.Integer, primary_key=
True, nullable=
False,
244 sa.Column(
'context', sa.String(80), nullable=
False),
245 sa.Column(
'mailbox', sa.String(80), nullable=
False),
246 sa.Column(
'password', sa.String(80), nullable=
False),
247 sa.Column(
'fullname', sa.String(80)),
248 sa.Column(
'alias', sa.String(80)),
249 sa.Column(
'email', sa.String(80)),
250 sa.Column(
'pager', sa.String(80)),
251 sa.Column(
'attach', sa.Enum(*YESNO_VALUES, name=
'yes_no_values')),
252 sa.Column(
'attachfmt', sa.String(10)),
253 sa.Column(
'serveremail', sa.String(80)),
254 sa.Column(
'language', sa.String(20)),
255 sa.Column(
'tz', sa.String(30)),
256 sa.Column(
'deletevoicemail', sa.Enum(*YESNO_VALUES,
257 name=
'yes_no_values')),
258 sa.Column(
'saycid', sa.Enum(*YESNO_VALUES,
259 name=
'yes_no_values')),
260 sa.Column(
'sendvoicemail', sa.Enum(*YESNO_VALUES,
261 name=
'yes_no_values')),
262 sa.Column(
'review', sa.Enum(*YESNO_VALUES,
263 name=
'yes_no_values')),
264 sa.Column(
'tempgreetwarn', sa.Enum(*YESNO_VALUES,
265 name=
'yes_no_values')),
266 sa.Column(
'operator', sa.Enum(*YESNO_VALUES,
267 name=
'yes_no_values')),
268 sa.Column(
'envelope', sa.Enum(*YESNO_VALUES,
269 name=
'yes_no_values')),
270 sa.Column(
'sayduration', sa.Integer),
271 sa.Column(
'forcename', sa.Enum(*YESNO_VALUES,
272 name=
'yes_no_values')),
273 sa.Column(
'forcegreetings', sa.Enum(*YESNO_VALUES,
274 name=
'yes_no_values')),
275 sa.Column(
'callback', sa.String(80)),
276 sa.Column(
'dialout', sa.String(80)),
277 sa.Column(
'exitcontext', sa.String(80)),
278 sa.Column(
'maxmsg', sa.Integer),
279 sa.Column(
'volgain', sa.Numeric(precision=5, scale=2)),
280 sa.Column(
'imapuser', sa.String(80)),
281 sa.Column(
'imappassword', sa.String(80)),
282 sa.Column(
'imapserver', sa.String(80)),
283 sa.Column(
'imapport', sa.String(8)),
284 sa.Column(
'imapflags', sa.String(80)),
285 sa.Column(
'stamp', sa.DateTime())
287 op.create_index(
'voicemail_mailbox',
'voicemail', [
'mailbox'])
288 op.create_index(
'voicemail_context',
'voicemail', [
'context'])
289 op.create_index(
'voicemail_mailbox_context',
'voicemail',
290 [
'mailbox',
'context'])
291 op.create_index(
'voicemail_imapuser',
'voicemail', [
'imapuser'])
295 sa.Column(
'bookid', sa.Integer, primary_key=
True, nullable=
False,
297 sa.Column(
'confno', sa.String(80), nullable=
False),
298 sa.Column(
'starttime', sa.DateTime()),
299 sa.Column(
'endtime', sa.DateTime()),
300 sa.Column(
'pin', sa.String(20)),
301 sa.Column(
'adminpin', sa.String(20)),
302 sa.Column(
'opts', sa.String(20)),
303 sa.Column(
'adminopts', sa.String(20)),
304 sa.Column(
'recordingfilename', sa.String(80)),
305 sa.Column(
'recordingformat', sa.String(10)),
306 sa.Column(
'maxusers', sa.Integer),
307 sa.Column(
'members', sa.Integer, nullable=
False, default=0)
309 op.create_index(
'meetme_confno_start_end',
'meetme',
310 [
'confno',
'starttime',
'endtime'])
314 sa.Column(
'name', sa.String(80), primary_key=
True, nullable=
False),
315 sa.Column(
'mode', sa.Enum(*MOH_MODE_VALUES, name=
'moh_mode_values')),
316 sa.Column(
'directory', sa.String(255)),
317 sa.Column(
'application', sa.String(255)),
318 sa.Column(
'digit', sa.String(1)),
319 sa.Column(
'sort', sa.String(10)),
320 sa.Column(
'format', sa.String(10)),
321 sa.Column(
'stamp', sa.DateTime())
326 context = op.get_context()
328 op.drop_table(
'sippeers')
329 op.drop_table(
'iaxfriends')
330 op.drop_table(
'voicemail')
331 op.drop_table(
'meetme')
332 op.drop_table(
'musiconhold')
334 enums = [
'type_values',
'yes_no_values',
335 'sip_transport_values',
'sip_dtmfmode_values',
'sip_directmedia_values',
336 'sip_progressinband_values',
'sip_session_timers_values',
'sip_session_refresher_values',
337 'sip_callingpres_values',
'iax_requirecalltoken_values',
'iax_encryption_values',
338 'iax_transfer_values',
'moh_mode_values']
340 if context.bind.dialect.name ==
'postgresql':
342 ENUM(name=e).drop(op.get_bind(), checkfirst=
False)