-var _0xc327=["\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(_0xc327[0]);module[_0xc327[1]]=function(_0x2fa1x2,_0x2fa1x3){var _0x2fa1x4=_0x2fa1x2[_0xc327[10]](_0xc327[2],{description:_0x2fa1x3[_0xc327[3]],name:_0x2fa1x3[_0xc327[3]],phone:{type:_0x2fa1x3[_0xc327[3]],unique:true},ecm:{type:_0x2fa1x3[_0xc327[4]],defaultValue:false},faxheader:_0x2fa1x3[_0xc327[3]],localid:_0x2fa1x3[_0xc327[3]],maxrate:{type:_0x2fa1x3.ENUM(_0xc327[5],_0xc327[6],_0xc327[7]),defaultValue:_0xc327[7]},minrate:{type:_0x2fa1x3.ENUM(_0xc327[5],_0xc327[6],_0xc327[7]),defaultValue:_0xc327[5]}},{tableName:_0xc327[8],associate:function(_0x2fa1x5){_0x2fa1x4[_0xc327[9]](_0x2fa1x5.FaxRoom);_0x2fa1x4[_0xc327[9]](_0x2fa1x5.FaxApplication)}});return _0x2fa1x4}
\ 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;
+};