Built motion from commit 2239aeb.|0.0.113
[motion.git] / server / models / history / report_call_history.js
index d749924..d1411b2 100644 (file)
@@ -1 +1,60 @@
-var _0x16aa=["\x65\x78\x70\x6F\x72\x74\x73","\x52\x65\x70\x6F\x72\x74\x43\x61\x6C\x6C\x48\x69\x73\x74\x6F\x72\x79","\x53\x54\x52\x49\x4E\x47","\x45\x4E\x55\x4D","\x69\x6E\x62\x6F\x75\x6E\x64","\x69\x6E\x74\x65\x72\x6E\x61\x6C","\x6F\x75\x74\x62\x6F\x75\x6E\x64","\x44\x41\x54\x45","","\x61\x6E\x73\x77\x65\x72\x74\x69\x6D\x65","\x73\x65\x74\x44\x61\x74\x61\x56\x61\x6C\x75\x65","\x49\x4E\x54\x45\x47\x45\x52","\x72\x65\x70\x6F\x72\x74\x5F\x63\x61\x6C\x6C\x5F\x68\x69\x73\x74\x6F\x72\x79","\x48\x69\x73\x74\x6F\x72\x79\x51\x75\x65\x75\x65\x43\x61\x6C\x6C\x73","\x75\x6E\x69\x71\x75\x65\x69\x64","\x68\x61\x73\x4D\x61\x6E\x79","\x48\x69\x73\x74\x6F\x72\x79\x52\x65\x70\x6F\x72\x74\x41\x67\x65\x6E\x74\x73","\x64\x65\x66\x69\x6E\x65"];module[_0x16aa[0]]=function(_0x4b4fx1,_0x4b4fx2){var _0x4b4fx3=_0x4b4fx1[_0x16aa[17]](_0x16aa[1],{uniqueid:{type:_0x4b4fx2[_0x16aa[2]],unique:true},type:{type:_0x4b4fx2[_0x16aa[3]],values:[_0x16aa[4],_0x16aa[5],_0x16aa[6]]},tag:_0x4b4fx2[_0x16aa[2]],accountcode:_0x4b4fx2[_0x16aa[2]],source:_0x4b4fx2[_0x16aa[2]],destination:_0x4b4fx2[_0x16aa[2]],destinationcontext:_0x4b4fx2[_0x16aa[2]],callerid:_0x4b4fx2[_0x16aa[2]],channel:_0x4b4fx2[_0x16aa[2]],destinationchannel:_0x4b4fx2[_0x16aa[2]],lastapplication:_0x4b4fx2[_0x16aa[2]],lastdata:_0x4b4fx2[_0x16aa[2]],starttime:_0x4b4fx2[_0x16aa[7]],answertime:{type:_0x4b4fx2[_0x16aa[7]],set:function(_0x4b4fx4){if(_0x4b4fx4!==_0x16aa[8]){this[_0x16aa[10]](_0x16aa[9],_0x4b4fx4)}else {this[_0x16aa[10]](_0x16aa[9],null)}}},endtime:_0x4b4fx2[_0x16aa[7]],duration:_0x4b4fx2[_0x16aa[11]],billableseconds:_0x4b4fx2[_0x16aa[11]],disposition:_0x4b4fx2[_0x16aa[2]],amaflags:_0x4b4fx2[_0x16aa[2]],userfield:_0x4b4fx2[_0x16aa[2]]},{tableName:_0x16aa[12],associate:function(_0x4b4fx5){_0x4b4fx3[_0x16aa[15]](_0x4b4fx5.ReportQueueHistory,{as:_0x16aa[13],foreignKey:_0x16aa[14],constraints:false});_0x4b4fx3[_0x16aa[15]](_0x4b4fx5.ReportAgentHistory,{as:_0x16aa[16],foreignKey:_0x16aa[14],constraints:false})}});return _0x4b4fx3}
\ No newline at end of file
+/**
+ * CDR Model
+ */
+
+module.exports = function(sequelize, DataTypes) {
+
+  var ReportCallHistory = sequelize.define('ReportCallHistory', {
+    uniqueid: {
+      type: DataTypes.STRING,
+      unique: true
+    },
+    type: {
+      type: DataTypes.ENUM,
+      values: ['inbound', 'internal', 'outbound', 'inbound-fax', 'outbound-fax', 'tigerdial']
+    },
+    tag: DataTypes.STRING,
+    accountcode: DataTypes.STRING,
+    source: DataTypes.STRING,
+    destination: DataTypes.STRING,
+    destinationcontext: DataTypes.STRING,
+    callerid: DataTypes.STRING,
+    channel: DataTypes.STRING,
+    destinationchannel: DataTypes.STRING,
+    lastapplication: DataTypes.STRING,
+    lastdata: DataTypes.STRING,
+    starttime: DataTypes.DATE,
+    answertime: {
+      type: DataTypes.DATE,
+      set: function(answertime) {
+        if (answertime !== '') {
+          this.setDataValue('answertime', answertime);
+        } else {
+          this.setDataValue('answertime', null);
+        }
+      }
+    },
+    endtime: DataTypes.DATE,
+    duration: DataTypes.INTEGER,
+    billableseconds: DataTypes.INTEGER,
+    disposition: DataTypes.STRING,
+    amaflags: DataTypes.STRING,
+    userfield: DataTypes.STRING
+  }, {
+    tableName: 'report_call_history',
+    associate: function(models) {
+      // ReportCallHistory.hasMany(models.ReportQueueHistory, {
+      //   as: 'HistoryQueueCalls',
+      //   foreignKey: 'uniqueid',
+      //   constraints: false
+      // });
+      // ReportCallHistory.hasMany(models.ReportAgentHistory, {
+      //   as: 'HistoryReportAgents',
+      //   foreignKey: 'uniqueid',
+      //   constraints: false
+      // });
+    }
+  });
+  ReportCallHistory.removeAttribute('id');
+  return ReportCallHistory;
+};