Built motion from commit 1038d87.|0.0.141
[motion.git] / server / models / tools_trunk.js
1 'use strict';
2
3
4
5 module.exports = function(sequelize, DataTypes) {
6   var Trunk = sequelize.define('Trunk', {
7     name: {
8       type: DataTypes.STRING,
9       primaryKey: true,
10       validate: {
11         notEmpty: true,
12         is: /^[A-Za-z0-9\.\_]+$/i
13       }
14     },
15     type: {
16       type: DataTypes.ENUM('friend', 'user', 'peer'),
17       allowNull: true,
18       defaultValue: 'friend'
19     },
20     context: {
21       type: DataTypes.STRING,
22       defaultValue: 'from-voip-provider'
23     },
24     callingpres: {
25       type: DataTypes.ENUM('ALLOWED_NOT_SCREENED',
26         'ALLOWED_PASSED_SCREEN', 'ALLOWED_FAILED_SCREEN', 'ALLOWED',
27         'PROHIB_NOT_SCREENED', 'PROHIB_PASSED_SCREEN',
28         'PROHIB_FAILED_SCREEN', 'PROHIB'),
29       allowNull: true,
30     },
31     permit: {
32       type: DataTypes.STRING,
33       allowNull: true,
34     },
35     deny: {
36       type: DataTypes.STRING,
37       allowNull: true,
38     },
39     secret: {
40       type: DataTypes.STRING,
41       allowNull: true,
42     },
43     md5secret: {
44       type: DataTypes.STRING,
45       allowNull: true,
46     },
47     remotesecret: {
48       type: DataTypes.STRING,
49       allowNull: true,
50     },
51     transport: {
52       type: DataTypes.STRING,
53       allowNull: true,
54       defaultValue: 'udp'
55     },
56     dtmfmode: {
57       type: DataTypes.ENUM('rfc2833', 'info', 'shortinfo', 'inband',
58         'auto'),
59       allowNull: true,
60       defaultValue: 'rfc2833'
61     },
62     directmedia: {
63       type: DataTypes.ENUM('yes', 'no', 'nonat', 'update', 'outgoing'),
64       allowNull: true,
65       defaultValue: 'no'
66     },
67     directrtpsetup: {
68       type: DataTypes.ENUM('yes', 'no'),
69       allowNull: true,
70       defaultValue: 'no'
71     },
72     directmediapermit: {
73       type: DataTypes.STRING,
74       allowNull: true,
75     },
76     directmediadeny: {
77       type: DataTypes.STRING,
78       allowNull: true,
79     },
80     nat: {
81       type: DataTypes.STRING,
82       allowNull: true,
83       defaultValue: 'force_rport,comedia'
84     },
85     callgroup: {
86       type: DataTypes.STRING,
87       allowNull: true,
88     },
89     namedcallgroup: { //We are in named call groups engineering,sales,netgroup,protgroup
90       type: DataTypes.STRING,
91       allowNull: true,
92     },
93     pickupgroup: {
94       type: DataTypes.STRING,
95       allowNull: true,
96     },
97     namedpickupgroup: { //We can do call pick-p for named call group sales
98       type: DataTypes.STRING,
99       allowNull: true,
100     },
101     language: {
102       type: DataTypes.STRING,
103       allowNull: true,
104       defaultValue: 'en'
105     },
106     tonezone: {
107       type: DataTypes.STRING,
108       allowNull: true
109     },
110     disallow: {
111       type: DataTypes.STRING,
112       allowNull: true,
113       defaultValue: 'all'
114     },
115     allow: {
116       type: DataTypes.STRING,
117       allowNull: false,
118       defaultValue: 'alaw;ulaw;gsm'
119     },
120     autoframing: {
121       type: DataTypes.ENUM('yes', 'no'),
122       allowNull: true,
123     },
124     insecure: {
125       type: DataTypes.STRING,
126       allowNull: true,
127       defaultValue: 'port,invite'
128     },
129     trustrpid: {
130       type: DataTypes.ENUM('yes', 'no'),
131       allowNull: true,
132       defaultValue: 'no'
133     },
134     trust_id_outbound: {
135       type: DataTypes.ENUM('yes', 'no'),
136       allowNull: true,
137       defaultValue: 'no'
138     },
139     progressinband: {
140       type: DataTypes.ENUM('yes', 'no', 'never'),
141       allowNull: true,
142     },
143     promiscredir: {
144       type: DataTypes.ENUM('yes', 'no'),
145       allowNull: true,
146     },
147     useclientcode: {
148       type: DataTypes.ENUM('yes', 'no'),
149       allowNull: true,
150     },
151     accountcode: {
152       type: DataTypes.INTEGER(11),
153       allowNull: true,
154     },
155     setvar: {
156       type: DataTypes.STRING,
157       allowNull: true,
158     },
159     callerid: {
160       type: DataTypes.STRING,
161       allowNull: true,
162       defaultValue: '"" <>'
163     },
164     amaflags: {
165       type: DataTypes.STRING,
166       allowNull: true,
167     },
168     callcounter: {
169       type: DataTypes.ENUM('yes', 'no'),
170       allowNull: true,
171       defaultValue: 'yes'
172     },
173     busylevel: {
174       type: DataTypes.INTEGER(11),
175       allowNull: true,
176     },
177     allowoverlap: {
178       type: DataTypes.ENUM('yes', 'no'),
179       allowNull: true,
180     },
181     allowsubscribe: {
182       type: DataTypes.ENUM('yes', 'no'),
183       allowNull: true,
184     },
185     allowtransfer: {
186       type: DataTypes.ENUM('yes', 'no'),
187       allowNull: true,
188     },
189     ignoresdpversion: {
190       type: DataTypes.ENUM('yes', 'no'),
191       allowNull: true,
192     },
193     subscribecontext: {
194       type: DataTypes.STRING,
195       allowNull: true,
196     },
197     template: {
198       type: DataTypes.STRING,
199       allowNull: true,
200     },
201     videosupport: {
202       type: DataTypes.ENUM('yes', 'no', 'always'),
203       allowNull: true,
204       defaultValue: 'no'
205     },
206     maxcallbitrate: {
207       type: DataTypes.INTEGER(11),
208       allowNull: true,
209     },
210     rfc2833compensate: {
211       type: DataTypes.ENUM('yes', 'no'),
212       allowNull: true,
213     },
214     mailbox: {
215       type: DataTypes.STRING,
216       allowNull: true,
217     },
218     session_timers: {
219       type: DataTypes.ENUM('accept', 'refuse', 'originate'),
220       allowNull: true,
221     },
222     session_expires: {
223       type: DataTypes.INTEGER(11),
224       allowNull: true,
225     },
226     session_minse: {
227       type: DataTypes.INTEGER(11),
228       allowNull: true,
229     },
230     session_refresher: {
231       type: DataTypes.ENUM('uac', 'uas'),
232       allowNull: true,
233       defaultValue: 'uas'
234     },
235     t38pt_usertpsource: {
236       type: DataTypes.STRING,
237       allowNull: true,
238     },
239     regexten: {
240       type: DataTypes.STRING,
241       allowNull: true,
242     },
243     fromdomain: {
244       type: DataTypes.STRING,
245       allowNull: true,
246     },
247     fromuser: {
248       type: DataTypes.STRING,
249       allowNull: true,
250     },
251     host: {
252       type: DataTypes.STRING,
253       allowNull: true,
254       defaultValue: 'dynamic'
255     },
256     port: {
257       type: DataTypes.INTEGER(5),
258       allowNull: true,
259     },
260     qualify: {
261       type: DataTypes.ENUM('yes', 'no'),
262       allowNull: true,
263       defaultValue: 'yes'
264     },
265     keepalive: {
266       type: DataTypes.INTEGER(11),
267       allowNull: true,
268     },
269     defaultip: {
270       type: DataTypes.STRING,
271       allowNull: true,
272     },
273     defaultuser: {
274       type: DataTypes.STRING,
275       allowNull: true,
276     },
277     rtptimeout: { // Terminate call if 60 seconds of no RTP or RTCP activity on the audio channel  when we're not on hold.
278       type: DataTypes.INTEGER(11),
279       allowNull: true,
280     },
281     rtpholdtimeout: { // Terminate call if 300 seconds of no RTP or RTCP activity on the audio channel when we're on hold (must be > rtptimeout)
282       type: DataTypes.INTEGER(11),
283       allowNull: true,
284     },
285     rtpkeepalive: { // Send keepalives in the RTP stream to keep NAT open (default is off - zero)
286       type: DataTypes.INTEGER(11),
287       allowNull: true,
288     },
289     sendrpid: {
290       type: DataTypes.ENUM('yes', 'no'),
291       allowNull: true,
292       defaultValue: 'no'
293     },
294     outboundproxy: {
295       type: DataTypes.STRING,
296       allowNull: true,
297     },
298     callbackextension: {
299       type: DataTypes.STRING,
300       allowNull: true,
301     },
302     timert1: {
303       type: DataTypes.INTEGER(11),
304       allowNull: true,
305     },
306     timerb: {
307       type: DataTypes.INTEGER(11),
308       allowNull: true,
309     },
310     qualifyfreq: {
311       type: DataTypes.INTEGER(11),
312       allowNull: true,
313     },
314     contactpermit: {
315       type: DataTypes.STRING,
316       allowNull: true,
317     },
318     contactdeny: {
319       type: DataTypes.STRING,
320       allowNull: true,
321     },
322     contactacl: {
323       type: DataTypes.STRING,
324       allowNull: true,
325     },
326     unsolicited_mailbox: {
327       type: DataTypes.STRING,
328       allowNull: true,
329     },
330     use_q850_reason: {
331       type: DataTypes.STRING,
332       allowNull: true,
333     },
334     maxforwards: {
335       type: DataTypes.INTEGER(11),
336       allowNull: true,
337     },
338     encryption: {
339       type: DataTypes.ENUM('yes', 'no'),
340       allowNull: true,
341       defaultValue: 'no'
342     },
343     avpf: {
344       type: DataTypes.ENUM('yes', 'no'),
345       allowNull: true
346     },
347     force_avp: {
348       type: DataTypes.ENUM('yes', 'no'),
349       allowNull: true
350     },
351     icesupport: {
352       type: DataTypes.ENUM('yes', 'no'),
353       allowNull: true
354     },
355     dtlsenable: {
356       type: DataTypes.ENUM('yes', 'no'),
357       allowNull: true
358     },
359     dtlsverify: {
360       type: DataTypes.ENUM('yes', 'no', 'fingerprint', 'certificate'),
361       allowNull: true
362     },
363     dtlsrekey: {
364       type: DataTypes.INTEGER(11),
365       allowNull: true,
366     },
367     dtlscertfile: {
368       type: DataTypes.STRING,
369       allowNull: true,
370     },
371     dtlsprivatekey: {
372       type: DataTypes.STRING,
373       allowNull: true,
374     },
375     dtlscipher: {
376       type: DataTypes.STRING,
377       allowNull: true,
378     },
379     dtlscafile: {
380       type: DataTypes.STRING,
381       allowNull: true,
382     },
383     dtlscapath: {
384       type: DataTypes.STRING,
385       allowNull: true,
386     },
387     dtlssetup: {
388       type: DataTypes.ENUM('active', 'passive', 'actpass'),
389       allowNull: true
390     },
391     dtlsfingerprint: {
392       type: DataTypes.STRING,
393       allowNull: true,
394     },
395     usereqphone: { //This provider requires ";user=phone" on URI
396       type: DataTypes.ENUM('yes', 'no'),
397       allowNull: true,
398       defaultValue: 'no'
399     },
400     recordonfeature: { //Feature to use when INFO with Record: on is received.
401       type: DataTypes.STRING,
402       allowNull: true,
403     },
404     recordofffeature: { //Feature to use when INFO with Record: off is received.
405       type: DataTypes.STRING,
406       allowNull: true,
407     },
408     call_limit: {
409       type: DataTypes.INTEGER(11),
410       allowNull: true,
411       defaultValue: 1000
412     },
413     registertrying: { //Send a 100 Trying when the device registers.
414       type: DataTypes.ENUM('yes', 'no'),
415       allowNull: true,
416     },
417     subscribemwi: { //Only send notifications if this phone subscribes for mailbox notification
418       type: DataTypes.ENUM('yes', 'no'),
419       allowNull: true,
420     },
421     vmexten: { // dialplan extension to reach mailbox. defaults to global vmexten which defaults to "asterisk"
422       type: DataTypes.STRING,
423       allowNull: true,
424     },
425     mohinterpret: { // This option specifies a preference for which music on hold class this channel should listen to when put on hold
426       type: DataTypes.STRING,
427       allowNull: true,
428     },
429     mohsuggest: { //  This option specifies which music on hold class to suggest to the peer channel when this channel places the peer on hold.
430       type: DataTypes.STRING,
431       allowNull: true,
432     },
433     parkinglot: {
434       type: DataTypes.STRING,
435       allowNull: true,
436     },
437     description: {
438       type: DataTypes.STRING,
439       allowNull: true,
440     },
441     canreinvite: {
442       type: DataTypes.ENUM('yes', 'no', 'nonat', 'update', 'update,nonat'),
443       allowNull: true,
444       defaultValue: 'no'
445     },
446     registry: {
447       type: DataTypes.STRING,
448       allowNull: true,
449     },
450     otherFields: {
451       type: DataTypes.STRING,
452       allowNull: true,
453     },
454     active: {
455       type: DataTypes.BOOLEAN,
456       defaultValue: true
457     },
458     status: {
459       type: DataTypes.STRING
460     },
461     peerstatus: {
462       type: DataTypes.STRING
463     }
464   }, {
465     tableName: 'tools_trunks'
466   });
467
468   return Trunk;
469 }