-var _0x8c42=["\x63\x72\x79\x70\x74\x6F","\x65\x78\x70\x6F\x72\x74\x73","\x46\x61\x78\x41\x63\x63\x6F\x75\x6E\x74","\x53\x54\x52\x49\x4E\x47","\x42\x4F\x4F\x4C\x45\x41\x4E","\x39\x36\x30\x30","\x31\x34\x34\x30\x30","\x33\x33\x36\x30\x30","\x66\x61\x78\x5F\x61\x63\x63\x6F\x75\x6E\x74\x73","\x68\x61\x73\x4D\x61\x6E\x79","\x64\x65\x66\x69\x6E\x65"];var crypto=require(_0x8c42[0]);module[_0x8c42[1]]=function(_0xdcffx2,_0xdcffx3){var _0xdcffx4=_0xdcffx2[_0x8c42[10]](_0x8c42[2],{description:_0xdcffx3[_0x8c42[3]],name:_0xdcffx3[_0x8c42[3]],phone:{type:_0xdcffx3[_0x8c42[3]],unique:true},ecm:{type:_0xdcffx3[_0x8c42[4]],defaultValue:false},faxheader:_0xdcffx3[_0x8c42[3]],localid:_0xdcffx3[_0x8c42[3]],maxrate:{type:_0xdcffx3.ENUM(_0x8c42[5],_0x8c42[6],_0x8c42[7]),defaultValue:_0x8c42[7]},minrate:{type:_0xdcffx3.ENUM(_0x8c42[5],_0x8c42[6],_0x8c42[7]),defaultValue:_0x8c42[5]}},{tableName:_0x8c42[8],associate:function(_0xdcffx5){_0xdcffx4[_0x8c42[9]](_0xdcffx5.FaxRoom);_0xdcffx4[_0x8c42[9]](_0xdcffx5.FaxApplication)}});return _0xdcffx4}
\ No newline at end of file
+'use strict';
+
+module.exports = function(sequelize, DataTypes) {
+
+ var FaxAccount = sequelize.define('FaxAccount', {
+ name: {
+ type: DataTypes.STRING,
+ validate: {
+ notEmpty: true
+ }
+ },
+ description: DataTypes.STRING,
+ ecm: {
+ type: DataTypes.ENUM('yes', 'no'),
+ defaultValue: 'yes'
+ },
+ headerinfo: {
+ type: DataTypes.STRING,
+ defaultValue: 'xCALLY Motion Fax'
+ },
+ localstationid: {
+ type: DataTypes.STRING,
+ unique: true
+ },
+ minrate: {
+ type: DataTypes.ENUM('2400', '4800', '7200', '9600', '12000', '14400'),
+ defaultValue: '4800'
+ },
+ maxrate: {
+ type: DataTypes.ENUM('2400', '4800', '7200', '9600', '12000', '14400'),
+ defaultValue: '14400'
+ },
+ modem: {
+ type: DataTypes.STRING,
+ defaultValue: 'v17,v27,v29'
+ },
+ gateway: {
+ type: DataTypes.STRING,
+ defaultValue: 'no',
+ validate: {
+ is: /^(?:yes|no|[0-9]+)$/
+ }
+ },
+ faxdetect: {
+ type: DataTypes.STRING,
+ defaultValue: 'no',
+ validate: {
+ is: /^(?:yes|no|t38|cng|[0-9]+)$/
+ }
+ },
+ t38timeout: {
+ type: DataTypes.INTEGER,
+ defaultValue: 5000,
+ validate: {
+ min: 1000
+ }
+ },
+ tech: {
+ type: DataTypes.ENUM('SIP', 'IAX', 'DADHI', 'KHOMP'),
+ defaultValue: 'SIP'
+ },
+ fidelity: {
+ type: DataTypes.BOOLEAN,
+ defaultValue: false
+ },
+ timeout: {
+ type: DataTypes.INTEGER,
+ defaultValue: 0
+ },
+ acceptUrl: {
+ type: DataTypes.STRING
+ },
+ rejectUrl: {
+ type: DataTypes.STRING
+ },
+ acceptMethod: {
+ type: DataTypes.ENUM('GET', 'POST')
+ },
+ rejectMethod: {
+ type: DataTypes.ENUM('GET', 'POST')
+ },
+ actions: {
+ type: DataTypes.STRING,
+ get: function() {
+ return this.getDataValue('actions') ? JSON.parse(this.getDataValue('actions')) : [];
+ },
+ set: function(val) {
+ return this.setDataValue('actions', JSON.stringify(val));
+ }
+ },
+ closeUrl: {
+ type: DataTypes.STRING
+ },
+ closeMethod: {
+ type: DataTypes.ENUM('GET', 'POST')
+ },
+ }, {
+ tableName: 'fax_accounts',
+ associate: function(models) {
+ FaxAccount.belongsTo(models.Trunk);
+ FaxAccount.hasMany(models.FaxRoom);
+ FaxAccount.hasMany(models.FaxApplication);
+ FaxAccount.hasMany(models.VoiceExtension, {
+ onDelete: 'cascade',
+ hooks: true
+ });
+ FaxAccount.belongsTo(models.List);
+ FaxAccount.hasMany(models.FaxDisposition);
+
+ // SCOPES
+ FaxAccount.addScope('default', {
+ include: [{
+ model: models.FaxApplication,
+ include: [{
+ model: models.User,
+ attributes: ['id',
+ 'name',
+ 'email',
+ 'internal',
+ 'fullname'
+ ]
+ }, {
+ model: models.FaxQueue
+ }]
+ }]
+ });
+ }
+ });
+
+ return FaxAccount;
+};