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 type: DataTypes.STRING
99 type: DataTypes.ENUM('GET', 'POST')
102 tableName: 'fax_accounts',
103 associate: function(models) {
104 FaxAccount.belongsTo(models.Trunk);
105 FaxAccount.hasMany(models.FaxRoom);
106 FaxAccount.hasMany(models.FaxApplication);
107 FaxAccount.hasMany(models.VoiceExtension, {
111 FaxAccount.belongsTo(models.List);
112 FaxAccount.hasMany(models.FaxDisposition);
115 FaxAccount.addScope('default', {
117 model: models.FaxApplication,
127 model: models.FaxQueue