5 var crypto = require('crypto');
7 module.exports = function(sequelize, DataTypes) {
9 var FaxAccount = sequelize.define('FaxAccount', {
11 type: DataTypes.STRING,
16 description: DataTypes.STRING,
18 type: DataTypes.ENUM('yes', 'no'),
22 type: DataTypes.STRING,
23 defaultValue: 'xCALLY Motion Fax'
26 type: DataTypes.STRING,
30 type: DataTypes.ENUM('2400', '4800', '7200', '9600', '12000', '14400'),
34 type: DataTypes.ENUM('2400', '4800', '7200', '9600', '12000', '14400'),
38 type: DataTypes.STRING,
39 defaultValue: 'v17,v27,v29'
42 type: DataTypes.STRING,
45 is: /^(?:yes|no|[0-9]+)$/
49 type: DataTypes.STRING,
52 is: /^(?:yes|no|t38|cng|[0-9]+)$/
56 type: DataTypes.INTEGER,
63 type: DataTypes.ENUM('SIP', 'IAX', 'DADHI', 'KHOMP'),
67 type: DataTypes.BOOLEAN,
71 type: DataTypes.INTEGER,
75 type: DataTypes.STRING
78 type: DataTypes.STRING
81 type: DataTypes.ENUM('GET', 'POST')
84 type: DataTypes.ENUM('GET', 'POST')
87 type: DataTypes.STRING,
89 return this.getDataValue('actions') ? JSON.parse(this.getDataValue('actions')) : [];
92 return this.setDataValue('actions', JSON.stringify(val));
96 tableName: 'fax_accounts',
97 associate: function(models) {
98 FaxAccount.belongsTo(models.Trunk);
99 FaxAccount.hasMany(models.FaxRoom);
100 FaxAccount.hasMany(models.FaxApplication);
101 FaxAccount.hasMany(models.VoiceExtension, {
105 FaxAccount.belongsTo(models.List);
106 FaxAccount.hasMany(models.FaxDisposition);
109 FaxAccount.addScope('default', {
111 model: models.FaxApplication,
121 model: models.FaxQueue