5 module.exports = function(sequelize, DataTypes) {
7 var ReportCallHistory = sequelize.define('ReportCallHistory', {
9 type: DataTypes.STRING,
14 values: ['inbound', 'internal', 'outbound', 'inbound-fax', 'outbound-fax', 'tigerdial']
16 tag: DataTypes.STRING,
17 accountcode: DataTypes.STRING,
18 source: DataTypes.STRING,
19 destination: DataTypes.STRING,
20 destinationcontext: DataTypes.STRING,
21 callerid: DataTypes.STRING,
22 channel: DataTypes.STRING,
23 destinationchannel: DataTypes.STRING,
24 lastapplication: DataTypes.STRING,
25 lastdata: DataTypes.STRING,
26 starttime: DataTypes.DATE,
29 set: function(answertime) {
30 if (answertime !== '') {
31 this.setDataValue('answertime', answertime);
33 this.setDataValue('answertime', null);
37 endtime: DataTypes.DATE,
38 duration: DataTypes.INTEGER,
39 billableseconds: DataTypes.INTEGER,
40 disposition: DataTypes.STRING,
41 amaflags: DataTypes.STRING,
42 userfield: DataTypes.STRING
44 tableName: 'report_call_history',
45 associate: function(models) {
46 // ReportCallHistory.hasMany(models.ReportQueueHistory, {
47 // as: 'HistoryQueueCalls',
48 // foreignKey: 'uniqueid',
51 // ReportCallHistory.hasMany(models.ReportAgentHistory, {
52 // as: 'HistoryReportAgents',
53 // foreignKey: 'uniqueid',
58 ReportCallHistory.removeAttribute('id');
59 return ReportCallHistory;