3 var crypto = require('crypto');
4 var md5 = require('md5');
5 var _ = require('lodash');
7 module.exports = function(sequelize, DataTypes) {
8 var Trunk = sequelize.define('Trunk', {
10 type: DataTypes.STRING,
14 is: /^[A-Za-z0-9\.\_]+$/i
18 type: DataTypes.ENUM('friend', 'user', 'peer'),
20 defaultValue: 'friend'
23 type: DataTypes.STRING,
24 defaultValue: 'from-voip-provider'
27 type: DataTypes.ENUM('ALLOWED_NOT_SCREENED',
28 'ALLOWED_PASSED_SCREEN', 'ALLOWED_FAILED_SCREEN', 'ALLOWED',
29 'PROHIB_NOT_SCREENED', 'PROHIB_PASSED_SCREEN',
30 'PROHIB_FAILED_SCREEN', 'PROHIB'),
34 type: DataTypes.STRING,
38 type: DataTypes.STRING,
42 type: DataTypes.STRING,
46 type: DataTypes.STRING,
50 type: DataTypes.STRING,
54 type: DataTypes.STRING,
59 type: DataTypes.ENUM('rfc2833', 'info', 'shortinfo', 'inband',
62 defaultValue: 'rfc2833'
65 type: DataTypes.ENUM('yes', 'no', 'nonat', 'update', 'outgoing'),
70 type: DataTypes.ENUM('yes', 'no'),
75 type: DataTypes.STRING,
79 type: DataTypes.STRING,
83 type: DataTypes.STRING,
85 defaultValue: 'force_rport,comedia'
88 type: DataTypes.STRING,
91 namedcallgroup: { //We are in named call groups engineering,sales,netgroup,protgroup
92 type: DataTypes.STRING,
96 type: DataTypes.STRING,
99 namedpickupgroup: { //We can do call pick-p for named call group sales
100 type: DataTypes.STRING,
104 type: DataTypes.STRING,
109 type: DataTypes.STRING,
113 type: DataTypes.STRING,
118 type: DataTypes.STRING,
120 defaultValue: 'alaw;ulaw;gsm'
123 type: DataTypes.ENUM('yes', 'no'),
127 type: DataTypes.STRING,
129 defaultValue: 'port,invite'
132 type: DataTypes.ENUM('yes', 'no'),
137 type: DataTypes.ENUM('yes', 'no'),
142 type: DataTypes.ENUM('yes', 'no', 'never'),
146 type: DataTypes.ENUM('yes', 'no'),
150 type: DataTypes.ENUM('yes', 'no'),
154 type: DataTypes.INTEGER(11),
158 type: DataTypes.STRING,
162 type: DataTypes.STRING,
164 defaultValue: '"" <>'
167 type: DataTypes.STRING,
171 type: DataTypes.ENUM('yes', 'no'),
176 type: DataTypes.INTEGER(11),
180 type: DataTypes.ENUM('yes', 'no'),
184 type: DataTypes.ENUM('yes', 'no'),
188 type: DataTypes.ENUM('yes', 'no'),
192 type: DataTypes.ENUM('yes', 'no'),
196 type: DataTypes.STRING,
200 type: DataTypes.STRING,
204 type: DataTypes.ENUM('yes', 'no', 'always'),
209 type: DataTypes.INTEGER(11),
213 type: DataTypes.ENUM('yes', 'no'),
217 type: DataTypes.STRING,
221 type: DataTypes.ENUM('accept', 'refuse', 'originate'),
225 type: DataTypes.INTEGER(11),
229 type: DataTypes.INTEGER(11),
233 type: DataTypes.ENUM('uac', 'uas'),
237 t38pt_usertpsource: {
238 type: DataTypes.STRING,
242 type: DataTypes.STRING,
246 type: DataTypes.STRING,
250 type: DataTypes.STRING,
254 type: DataTypes.STRING,
256 defaultValue: 'dynamic'
259 type: DataTypes.INTEGER(5),
263 type: DataTypes.ENUM('yes', 'no'),
268 type: DataTypes.INTEGER(11),
272 type: DataTypes.STRING,
276 type: DataTypes.STRING,
279 rtptimeout: { // Terminate call if 60 seconds of no RTP or RTCP activity on the audio channel when we're not on hold.
280 type: DataTypes.INTEGER(11),
283 rtpholdtimeout: { // Terminate call if 300 seconds of no RTP or RTCP activity on the audio channel when we're on hold (must be > rtptimeout)
284 type: DataTypes.INTEGER(11),
287 rtpkeepalive: { // Send keepalives in the RTP stream to keep NAT open (default is off - zero)
288 type: DataTypes.INTEGER(11),
292 type: DataTypes.ENUM('yes', 'no'),
297 type: DataTypes.STRING,
301 type: DataTypes.STRING,
305 type: DataTypes.INTEGER(11),
309 type: DataTypes.INTEGER(11),
313 type: DataTypes.INTEGER(11),
317 type: DataTypes.STRING,
321 type: DataTypes.STRING,
325 type: DataTypes.STRING,
328 unsolicited_mailbox: {
329 type: DataTypes.STRING,
333 type: DataTypes.STRING,
337 type: DataTypes.INTEGER(11),
341 type: DataTypes.ENUM('yes', 'no'),
346 type: DataTypes.ENUM('yes', 'no'),
350 type: DataTypes.ENUM('yes', 'no'),
354 type: DataTypes.ENUM('yes', 'no'),
358 type: DataTypes.ENUM('yes', 'no'),
362 type: DataTypes.ENUM('yes', 'no', 'fingerprint', 'certificate'),
366 type: DataTypes.INTEGER(11),
370 type: DataTypes.STRING,
374 type: DataTypes.STRING,
378 type: DataTypes.STRING,
382 type: DataTypes.STRING,
386 type: DataTypes.STRING,
390 type: DataTypes.ENUM('active', 'passive', 'actpass'),
394 type: DataTypes.STRING,
397 usereqphone: { //This provider requires ";user=phone" on URI
398 type: DataTypes.ENUM('yes', 'no'),
402 recordonfeature: { //Feature to use when INFO with Record: on is received.
403 type: DataTypes.STRING,
406 recordofffeature: { //Feature to use when INFO with Record: off is received.
407 type: DataTypes.STRING,
411 type: DataTypes.INTEGER(11),
415 registertrying: { //Send a 100 Trying when the device registers.
416 type: DataTypes.ENUM('yes', 'no'),
419 subscribemwi: { //Only send notifications if this phone subscribes for mailbox notification
420 type: DataTypes.ENUM('yes', 'no'),
423 vmexten: { // dialplan extension to reach mailbox. defaults to global vmexten which defaults to "asterisk"
424 type: DataTypes.STRING,
427 mohinterpret: { // This option specifies a preference for which music on hold class this channel should listen to when put on hold
428 type: DataTypes.STRING,
431 mohsuggest: { // This option specifies which music on hold class to suggest to the peer channel when this channel places the peer on hold.
432 type: DataTypes.STRING,
436 type: DataTypes.STRING,
440 type: DataTypes.STRING,
444 type: DataTypes.ENUM('yes', 'no', 'nonat', 'update', 'update,nonat'),
449 type: DataTypes.STRING,
453 type: DataTypes.STRING,
457 type: DataTypes.BOOLEAN,
461 type: DataTypes.STRING
464 type: DataTypes.STRING
467 tableName: 'tools_trunks'