Built motion from commit 06df96e on branch develop.
[motion.git] / server / models / report_call.js
1 /**
2  * CDR Model
3  */
4
5 module.exports = function(sequelize, DataTypes) {
6
7   var ReportCall = sequelize.define('ReportCall', {
8     accountcode: DataTypes.STRING,
9     source: DataTypes.STRING,
10     destination: DataTypes.STRING,
11     destinationcontext: DataTypes.STRING,
12     callerid: DataTypes.STRING,
13     channel: DataTypes.STRING,
14     destinationchannel: DataTypes.STRING,
15     lastapplication: DataTypes.STRING,
16     lastdata: DataTypes.STRING,
17     starttime: DataTypes.DATE,
18     answertime: {
19       type: DataTypes.DATE,
20       set: function(answertime) {
21         if (answertime !== '') {
22           this.setDataValue('answertime', answertime);
23         } else {
24           this.setDataValue('answertime', null);
25         }
26       }
27     },
28     endtime: DataTypes.DATE,
29     duration: DataTypes.INTEGER,
30     billableseconds: DataTypes.INTEGER,
31     disposition: DataTypes.STRING,
32     amaflags: DataTypes.STRING,
33     uniqueid: DataTypes.STRING,
34     userfield: DataTypes.STRING,
35   }, {
36     tableName: 'report_call'
37   });
38
39   return ReportCall;
40 };