Built motion from commit e2ff5cd.|0.0.92
[motion.git] / server / models / fax_account.js
1 /**
2  * Chat Website Model
3  */
4
5 var crypto = require('crypto');
6
7 module.exports = function(sequelize, DataTypes) {
8
9         var FaxAccount = sequelize.define('FaxAccount', {
10                 name: {
11                         type: DataTypes.STRING,
12                         validate: {
13                                 notEmpty: true
14                         }
15                 },
16                 description: DataTypes.STRING,
17                 ecm: {
18                         type: DataTypes.ENUM('yes', 'no'),
19                         defaultValue: 'yes'
20                 },
21                 headerinfo: {
22                         type: DataTypes.STRING,
23                         defaultValue: 'xCALLY Motion Fax'
24                 },
25                 localstationid: {
26                         type: DataTypes.STRING,
27                         unique: true
28                 },
29                 minrate: {
30                         type: DataTypes.ENUM('2400', '4800', '7200', '9600', '12000', '14400'),
31                         defaultValue: '4800'
32                 },
33                 maxrate: {
34                         type: DataTypes.ENUM('2400', '4800', '7200', '9600', '12000', '14400'),
35                         defaultValue: '14400'
36                 },
37                 modem: {
38                         type: DataTypes.STRING,
39                         defaultValue: 'v17,v27,v29'
40                 },
41                 gateway: {
42                         type: DataTypes.STRING,
43                         defaultValue: 'no',
44                         validate: {
45                                 is: /^(?:yes|no|[0-9]+)$/
46                         }
47                 },
48                 faxdetect: {
49                         type: DataTypes.STRING,
50                         defaultValue: 'no',
51                         validate: {
52                                 is: /^(?:yes|no|t38|cng|[0-9]+)$/
53                         }
54                 },
55                 t38timeout: {
56                         type: DataTypes.INTEGER,
57                         defaultValue: 5000,
58                         validate: {
59                                 min: 1000
60                         }
61                 },
62                 tech: {
63                         type: DataTypes.ENUM('SIP', 'IAX', 'DADHI', 'KHOMP'),
64                         defaultValue: 'SIP'
65                 }
66         }, {
67                 tableName: 'fax_accounts',
68                 associate: function(models) {
69                         FaxAccount.belongsTo(models.Trunk);
70                         FaxAccount.hasMany(models.FaxRoom);
71                         FaxAccount.hasMany(models.FaxApplication);
72                 }
73         });
74
75         return FaxAccount;
76 };