Built motion from commit (unavailable).|2.5.31
[motion2.git] / server / services / ami / realtime / index.js
index a767a6b..ca8f7e9 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa41a=['initCampaignHopperHistory','initFaxAccounts','exports','bluebird','util','moment','../model/agent','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/zendeskAccount','../model/salesforceAccount','../model/zohoAccount','../model/deskAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','telephones','trunks','voiceQueues','triggers','templates','outbound','queueChannels','timers','settings','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty','SIP/%s','name','interface','format','total','sumDuration','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','answered','unmanaged','abandoned','sumHoldTime','outboundAnswerAgiCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','mergeFromDatabase','prototype','initAgents','length','isNil','initTrunks','isUndefined','initTriggers','initTemplates','initZendeskAccounts','initSalesforceAccounts','freshdeskAccounts','initZohoAccounts','initVtigerAccounts','initServicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','groupBy','uniqueid','queue','queuecallerexit','queuecallerleaveAt','diff','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','queuecallercomplete','sumBillable','initVoiceCallReports','duration','ANSWERED','initCampaigns','campaigns','dialQueueProject','SquareProject','voiceExtensions'];(function(_0x509ab7,_0x194364){var _0x2b8f79=function(_0x9f541f){while(--_0x9f541f){_0x509ab7['push'](_0x509ab7['shift']());}};_0x2b8f79(++_0x194364);}(_0xa41a,0x6b));var _0xaa41=function(_0x3259a2,_0x174b02){_0x3259a2=_0x3259a2-0x0;var _0x314467=_0xa41a[_0x3259a2];return _0x314467;};'use strict';var BPromise=require(_0xaa41('0x0'));var util=require(_0xaa41('0x1'));var _=require('lodash');var moment=require(_0xaa41('0x2'));var Agent=require(_0xaa41('0x3'));var Telephone=require(_0xaa41('0x4'));var Trunk=require(_0xaa41('0x5'));var VoiceQueue=require(_0xaa41('0x6'));var Trigger=require(_0xaa41('0x7'));var Template=require(_0xaa41('0x8'));var Campaign=require(_0xaa41('0x9'));var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require(_0xaa41('0xa'));var SalesforceAccount=require(_0xaa41('0xb'));var FreshdeskAccount=require('../model/freshdeskAccount');var SugarcrmAccount=require('../model/sugarcrmAccount');var ZohoAccount=require(_0xaa41('0xc'));var DeskAccount=require(_0xaa41('0xd'));var VtigerAccount=require('../model/vtigerAccount');var ServicenowAccount=require(_0xaa41('0xe'));var Dynamics365Account=require(_0xaa41('0xf'));var FreshsalesAccount=require(_0xaa41('0x10'));var FaxAccount=require(_0xaa41('0x11'));var Realtime=function(){this[_0xaa41('0x12')]={};this[_0xaa41('0x13')]={};this[_0xaa41('0x14')]={};this[_0xaa41('0x15')]={};this[_0xaa41('0x16')]={};this['campaigns']={};this[_0xaa41('0x17')]={};this[_0xaa41('0x18')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this['channels']={};this[_0xaa41('0x19')]={};this['outboundChannels']={};this[_0xaa41('0x1a')]={};this[_0xaa41('0x1b')]={};this[_0xaa41('0x1c')]={};this[_0xaa41('0x1d')]={};this[_0xaa41('0x1e')]={};this['freshdeskAccounts']={};this[_0xaa41('0x1f')]={};this[_0xaa41('0x20')]={};this[_0xaa41('0x21')]={};this[_0xaa41('0x22')]={};this[_0xaa41('0x23')]={};this[_0xaa41('0x24')]={};this[_0xaa41('0x25')]={};};function freeIsNotKey(_0x550ad5,_0x2d868a,_0x16b930){var _0x4210fa=_[_0xaa41('0x26')](_0x550ad5,function(_0x230a6a,_0xd20ddf){return _0x230a6a[_0x16b930];});for(var _0x29efe5 in _0x2d868a){if(_0x2d868a[_0xaa41('0x27')](_0x29efe5)){if(!_0x4210fa[_0x29efe5]){delete _0x2d868a[_0x29efe5];}}}}function freeIsNotKeySip(_0x150ddf,_0x4fe1a4){var _0x5cd936=_[_0xaa41('0x26')](_0x150ddf,function(_0x22de55,_0x35c753){return util['format'](_0xaa41('0x28'),_0x22de55[_0xaa41('0x29')]);});for(var _0x4e768e in _0x4fe1a4){if(_0x4fe1a4['hasOwnProperty'](_0x4e768e)){if(!_0x5cd936[_0x4e768e]){delete _0x4fe1a4[_0x4e768e];}}}}function freeIsNotKeyAgent(_0x1b1910,_0x5d4374){var _0xafd672=_[_0xaa41('0x26')](_0x1b1910,function(_0x3e2175,_0x1f27f3){var _0x1d623c=_['isNil'](_0x3e2175[_0xaa41('0x2a')])?util[_0xaa41('0x2b')](_0xaa41('0x28'),_0x3e2175[_0xaa41('0x29')]):_0x3e2175[_0xaa41('0x2a')];return _0x1d623c;});for(var _0xa1f024 in _0x5d4374){if(_0x5d4374['hasOwnProperty'](_0xa1f024)){if(!_0xafd672[_0xa1f024]){delete _0x5d4374[_0xa1f024];}}}}function clearVoiceCallReports(_0x5795f4){_0x5795f4[_0xaa41('0x2c')]=0x0;_0x5795f4['answered']=0x0;_0x5795f4['sumHoldTime']=0x0;_0x5795f4[_0xaa41('0x2d')]=0x0;_0x5795f4['sumBillable']=0x0;}function clearCampaigns(_0x536bed){if(!_[_0xaa41('0x2e')](_0x536bed)){for(var _0x9c8c21 in _0x536bed){if(_0x536bed[_0xaa41('0x27')](_0x9c8c21)){_0x536bed[_0x9c8c21][_0xaa41('0x2f')]=0x0;_0x536bed[_0x9c8c21][_0xaa41('0x30')]=0x0;}}}}function clearVoiceQueues(_0xa7269f){if(!_['isEmpty'](_0xa7269f)){for(var _0x30a174 in _0xa7269f){if(_0xa7269f[_0xaa41('0x27')](_0x30a174)){_0xa7269f[_0x30a174][_0xaa41('0x2c')]=0x0;_0xa7269f[_0x30a174][_0xaa41('0x31')]=0x0;_0xa7269f[_0x30a174][_0xaa41('0x32')]=0x0;_0xa7269f[_0x30a174][_0xaa41('0x33')]=0x0;_0xa7269f[_0x30a174][_0xaa41('0x34')]=0x0;_0xa7269f[_0x30a174][_0xaa41('0x2d')]=0x0;_0xa7269f[_0x30a174]['sumBillable']=0x0;_0xa7269f[_0x30a174][_0xaa41('0x35')]=0x0;_0xa7269f[_0x30a174]['outboundNoAnswerCallsDay']=0x0;_0xa7269f[_0x30a174]['outboundBusyCallsDay']=0x0;_0xa7269f[_0x30a174][_0xaa41('0x36')]=0x0;_0xa7269f[_0x30a174][_0xaa41('0x37')]=0x0;_0xa7269f[_0x30a174]['outboundUnknownCallsDay']=0x0;_0xa7269f[_0x30a174][_0xaa41('0x38')]=0x0;_0xa7269f[_0x30a174][_0xaa41('0x39')]=0x0;_0xa7269f[_0x30a174]['outboundBlacklistCallsDay']=0x0;_0xa7269f[_0x30a174]['outboundOriginateFailureCallsDay']=0x0;_0xa7269f[_0x30a174]['outboundRejectCallsDay']=0x0;_0xa7269f[_0x30a174][_0xaa41('0x3a')]=0x0;_0xa7269f[_0x30a174][_0xaa41('0x35')]=0x0;_0xa7269f[_0x30a174][_0xaa41('0x3b')]=0x0;_0xa7269f[_0x30a174][_0xaa41('0x3c')]=!![];}}}}Realtime['prototype'][_0xaa41('0x3d')]=function(_0x45c8fe,_0x3e0204){for(var _0x4de770 in _0x3e0204){if(_0x45c8fe[_0xaa41('0x27')](_0x4de770)){_0x45c8fe[_0x4de770]=_0x3e0204[_0x4de770];}}};Realtime[_0xaa41('0x3e')][_0xaa41('0x3f')]=function(){var _0x57ab80=this;return function(_0x252c62){if(_0x252c62){freeIsNotKeyAgent(_0x252c62,_0x57ab80[_0xaa41('0x12')]);for(var _0x57fe1d=0x0,_0x23eb50={},_0x13b6d4={};_0x57fe1d<_0x252c62[_0xaa41('0x40')];_0x57fe1d+=0x1){_0x23eb50=_0x252c62[_0x57fe1d];var _0x5cec87=_[_0xaa41('0x41')](_0x23eb50['interface'])?util[_0xaa41('0x2b')](_0xaa41('0x28'),_0x23eb50[_0xaa41('0x29')]):_0x23eb50['interface'];if(_['isUndefined'](_0x57ab80['agents'][_0x5cec87])){_0x57ab80[_0xaa41('0x12')][_0x5cec87]=new Agent(_0x23eb50);}else{_0x57ab80[_0xaa41('0x3d')](_0x57ab80[_0xaa41('0x12')][_0x5cec87],_0x23eb50);}}}return _0x57ab80[_0xaa41('0x12')];};};Realtime['prototype']['initTelephones']=function(){var _0x267999=this;return function(_0x5673c){if(_0x5673c){freeIsNotKeySip(_0x5673c,_0x267999[_0xaa41('0x13')]);for(var _0x4e8d2e=0x0,_0xba115a={},_0x203d83={};_0x4e8d2e<_0x5673c[_0xaa41('0x40')];_0x4e8d2e+=0x1){_0xba115a=_0x5673c[_0x4e8d2e];if(_['isUndefined'](_0x267999[_0xaa41('0x13')][util[_0xaa41('0x2b')](_0xaa41('0x28'),_0xba115a[_0xaa41('0x29')])])){_0x267999['telephones'][util['format'](_0xaa41('0x28'),_0xba115a[_0xaa41('0x29')])]=new Telephone(_0xba115a);}else{_0x267999['mergeFromDatabase'](_0x267999[_0xaa41('0x13')][util['format'](_0xaa41('0x28'),_0xba115a[_0xaa41('0x29')])],_0xba115a);}}}return _0x267999[_0xaa41('0x13')];};};Realtime[_0xaa41('0x3e')][_0xaa41('0x42')]=function(){var _0x12ba1a=this;return function(_0x3ce95c){if(_0x3ce95c){freeIsNotKeySip(_0x3ce95c,_0x12ba1a[_0xaa41('0x14')]);for(var _0x5d9b22=0x0,_0x236ff4={},_0x2abf39={};_0x5d9b22<_0x3ce95c[_0xaa41('0x40')];_0x5d9b22+=0x1){_0x236ff4=_0x3ce95c[_0x5d9b22];if(_[_0xaa41('0x43')](_0x12ba1a[_0xaa41('0x14')][util[_0xaa41('0x2b')]('SIP/%s',_0x236ff4['name'])])){_0x12ba1a[_0xaa41('0x14')][util['format'](_0xaa41('0x28'),_0x236ff4[_0xaa41('0x29')])]=new Trunk(_0x236ff4);}else{_0x12ba1a[_0xaa41('0x3d')](_0x12ba1a[_0xaa41('0x14')][util[_0xaa41('0x2b')](_0xaa41('0x28'),_0x236ff4[_0xaa41('0x29')])],_0x236ff4);}}}return _0x12ba1a['trunks'];};};Realtime[_0xaa41('0x3e')]['initVoiceQueues']=function(){var _0x4dd842=this;return function(_0x361370){if(_0x361370){freeIsNotKey(_0x361370,_0x4dd842['voiceQueues'],'name');for(var _0x5274c9=0x0,_0x3bad48={},_0x525b09={};_0x5274c9<_0x361370[_0xaa41('0x40')];_0x5274c9+=0x1){_0x3bad48=_0x361370[_0x5274c9];if(_[_0xaa41('0x43')](_0x4dd842['voiceQueues'][_0x3bad48['name']])){_0x4dd842[_0xaa41('0x15')][_0x3bad48[_0xaa41('0x29')]]=new VoiceQueue(_0x3bad48);}else{_0x4dd842[_0xaa41('0x3d')](_0x4dd842[_0xaa41('0x15')][_0x3bad48[_0xaa41('0x29')]],_0x3bad48);}}}return _0x4dd842[_0xaa41('0x15')];};};Realtime[_0xaa41('0x3e')][_0xaa41('0x44')]=function(){var _0x2fa6ec=this;return function(_0x4e1ac4){if(_0x4e1ac4){freeIsNotKey(_0x4e1ac4,_0x2fa6ec[_0xaa41('0x16')],'id');for(var _0x22d512=0x0,_0x214ca4={},_0x429c1d={};_0x22d512<_0x4e1ac4[_0xaa41('0x40')];_0x22d512+=0x1){_0x214ca4=_0x4e1ac4[_0x22d512];if(_[_0xaa41('0x43')](_0x2fa6ec['triggers'][_0x214ca4['id']])){_0x2fa6ec[_0xaa41('0x16')][_0x214ca4['id']]=new Trigger(_0x214ca4);}else{_0x2fa6ec[_0xaa41('0x3d')](_0x2fa6ec[_0xaa41('0x16')][_0x214ca4['id']],_0x214ca4);}}}return _0x2fa6ec[_0xaa41('0x16')];};};Realtime['prototype'][_0xaa41('0x45')]=function(){var _0x5787f3=this;return function(_0x49fedd){if(_0x49fedd){freeIsNotKey(_0x49fedd,_0x5787f3[_0xaa41('0x17')],'id');for(var _0xe0eec0=0x0,_0x3e16ef={},_0x4ca114={};_0xe0eec0<_0x49fedd[_0xaa41('0x40')];_0xe0eec0+=0x1){_0x3e16ef=_0x49fedd[_0xe0eec0];if(_[_0xaa41('0x43')](_0x5787f3[_0xaa41('0x17')][_0x3e16ef['id']])){_0x5787f3['templates'][_0x3e16ef['id']]=new Template(_0x3e16ef);}else{_0x5787f3[_0xaa41('0x3d')](_0x5787f3[_0xaa41('0x17')][_0x3e16ef['id']],_0x3e16ef);}}}return _0x5787f3[_0xaa41('0x17')];};};Realtime[_0xaa41('0x3e')][_0xaa41('0x46')]=function(){var _0x237b8a=this;return function(_0x333a9f){if(_0x333a9f){freeIsNotKey(_0x333a9f,_0x237b8a[_0xaa41('0x1c')],'id');for(var _0x4eab60=0x0,_0x9f0a81={},_0x5bef5f={};_0x4eab60<_0x333a9f['length'];_0x4eab60+=0x1){_0x9f0a81=_0x333a9f[_0x4eab60];if(_[_0xaa41('0x43')](_0x237b8a[_0xaa41('0x1c')][_0x9f0a81['id']])){_0x237b8a[_0xaa41('0x1c')][_0x9f0a81['id']]=new ZendeskAccount(_0x9f0a81);}else{_0x237b8a[_0xaa41('0x3d')](_0x237b8a[_0xaa41('0x1c')][_0x9f0a81['id']],_0x9f0a81);}}}return _0x237b8a[_0xaa41('0x1c')];};};Realtime[_0xaa41('0x3e')][_0xaa41('0x47')]=function(){var _0x519e39=this;return function(_0xecb54){if(_0xecb54){freeIsNotKey(_0xecb54,_0x519e39[_0xaa41('0x1d')],'id');for(var _0x1d518f=0x0,_0x4f9e92={},_0x2e0f53={};_0x1d518f<_0xecb54[_0xaa41('0x40')];_0x1d518f+=0x1){_0x4f9e92=_0xecb54[_0x1d518f];if(_['isUndefined'](_0x519e39[_0xaa41('0x1d')][_0x4f9e92['id']])){_0x519e39[_0xaa41('0x1d')][_0x4f9e92['id']]=new SalesforceAccount(_0x4f9e92);}else{_0x519e39[_0xaa41('0x3d')](_0x519e39['salesforceAccounts'][_0x4f9e92['id']],_0x4f9e92);}}}return _0x519e39[_0xaa41('0x1d')];};};Realtime[_0xaa41('0x3e')]['initFreshdeskAccounts']=function(){var _0x49789a=this;return function(_0x3745ed){if(_0x3745ed){freeIsNotKey(_0x3745ed,_0x49789a[_0xaa41('0x48')],'id');for(var _0x3a29d2=0x0,_0x4d20c6={},_0x5a76b9={};_0x3a29d2<_0x3745ed[_0xaa41('0x40')];_0x3a29d2+=0x1){_0x4d20c6=_0x3745ed[_0x3a29d2];if(_[_0xaa41('0x43')](_0x49789a[_0xaa41('0x48')][_0x4d20c6['id']])){_0x49789a[_0xaa41('0x48')][_0x4d20c6['id']]=new FreshdeskAccount(_0x4d20c6);}else{_0x49789a['mergeFromDatabase'](_0x49789a[_0xaa41('0x48')][_0x4d20c6['id']],_0x4d20c6);}}}return _0x49789a['freshdeskAccounts'];};};Realtime['prototype'][_0xaa41('0x49')]=function(){var _0x52ae7f=this;return function(_0x3621c0){if(_0x3621c0){freeIsNotKey(_0x3621c0,_0x52ae7f[_0xaa41('0x1f')],'id');for(var _0x169ddf=0x0,_0x5e83e1={},_0x12ba1b={};_0x169ddf<_0x3621c0[_0xaa41('0x40')];_0x169ddf+=0x1){_0x5e83e1=_0x3621c0[_0x169ddf];if(_[_0xaa41('0x43')](_0x52ae7f[_0xaa41('0x1f')][_0x5e83e1['id']])){_0x52ae7f[_0xaa41('0x1f')][_0x5e83e1['id']]=new ZohoAccount(_0x5e83e1);}else{_0x52ae7f[_0xaa41('0x3d')](_0x52ae7f[_0xaa41('0x1f')][_0x5e83e1['id']],_0x5e83e1);}}}return _0x52ae7f[_0xaa41('0x1f')];};};Realtime[_0xaa41('0x3e')]['initDeskAccounts']=function(){var _0x35a09e=this;return function(_0x40cdfc){if(_0x40cdfc){freeIsNotKey(_0x40cdfc,_0x35a09e[_0xaa41('0x20')],'id');for(var _0x5a5a55=0x0,_0x3fe47a={},_0x2caf5c={};_0x5a5a55<_0x40cdfc[_0xaa41('0x40')];_0x5a5a55+=0x1){_0x3fe47a=_0x40cdfc[_0x5a5a55];if(_[_0xaa41('0x43')](_0x35a09e[_0xaa41('0x20')][_0x3fe47a['id']])){_0x35a09e[_0xaa41('0x20')][_0x3fe47a['id']]=new DeskAccount(_0x3fe47a);}else{_0x35a09e[_0xaa41('0x3d')](_0x35a09e['deskAccounts'][_0x3fe47a['id']],_0x3fe47a);}}}return _0x35a09e['deskAccounts'];};};Realtime['prototype']['initSugarcrmAccounts']=function(){var _0x4ec357=this;return function(_0x4a181a){if(_0x4a181a){freeIsNotKey(_0x4a181a,_0x4ec357[_0xaa41('0x1e')],'id');for(var _0x50b598=0x0,_0x576e6e={},_0x24c6f3={};_0x50b598<_0x4a181a[_0xaa41('0x40')];_0x50b598+=0x1){_0x576e6e=_0x4a181a[_0x50b598];if(_[_0xaa41('0x43')](_0x4ec357[_0xaa41('0x1e')][_0x576e6e['id']])){_0x4ec357['sugarcrmAccounts'][_0x576e6e['id']]=new SugarcrmAccount(_0x576e6e);}else{_0x4ec357[_0xaa41('0x3d')](_0x4ec357[_0xaa41('0x1e')][_0x576e6e['id']],_0x576e6e);}}}return _0x4ec357[_0xaa41('0x1e')];};};Realtime[_0xaa41('0x3e')][_0xaa41('0x4a')]=function(){var _0x41ca40=this;return function(_0x46ebcd){if(_0x46ebcd){freeIsNotKey(_0x46ebcd,_0x41ca40[_0xaa41('0x21')],'id');for(var _0x1795d1=0x0,_0x54344c={},_0x185600={};_0x1795d1<_0x46ebcd[_0xaa41('0x40')];_0x1795d1+=0x1){_0x54344c=_0x46ebcd[_0x1795d1];if(_['isUndefined'](_0x41ca40['vtigerAccounts'][_0x54344c['id']])){_0x41ca40['vtigerAccounts'][_0x54344c['id']]=new VtigerAccount(_0x54344c);}else{_0x41ca40[_0xaa41('0x3d')](_0x41ca40['vtigerAccounts'][_0x54344c['id']],_0x54344c);}}}return _0x41ca40[_0xaa41('0x21')];};};Realtime['prototype'][_0xaa41('0x4b')]=function(){var _0x18d18b=this;return function(_0x4b1ec4){if(_0x4b1ec4){freeIsNotKey(_0x4b1ec4,_0x18d18b[_0xaa41('0x22')],'id');for(var _0x33efc5=0x0,_0x3d150d={},_0x33f5c2={};_0x33efc5<_0x4b1ec4['length'];_0x33efc5+=0x1){_0x3d150d=_0x4b1ec4[_0x33efc5];if(_['isUndefined'](_0x18d18b[_0xaa41('0x22')][_0x3d150d['id']])){_0x18d18b[_0xaa41('0x22')][_0x3d150d['id']]=new ServicenowAccount(_0x3d150d);}else{_0x18d18b['mergeFromDatabase'](_0x18d18b['servicenowAccounts'][_0x3d150d['id']],_0x3d150d);}}}return _0x18d18b[_0xaa41('0x22')];};};Realtime[_0xaa41('0x3e')][_0xaa41('0x4c')]=function(){var _0xbeafb5=this;return function(_0x3dbe37){if(_0x3dbe37){freeIsNotKey(_0x3dbe37,_0xbeafb5['dynamics365Accounts'],'id');for(var _0x475ceb=0x0,_0x4c61d0={},_0x5062db={};_0x475ceb<_0x3dbe37['length'];_0x475ceb+=0x1){_0x4c61d0=_0x3dbe37[_0x475ceb];if(_[_0xaa41('0x43')](_0xbeafb5[_0xaa41('0x23')][_0x4c61d0['id']])){_0xbeafb5[_0xaa41('0x23')][_0x4c61d0['id']]=new Dynamics365Account(_0x4c61d0);}else{_0xbeafb5['mergeFromDatabase'](_0xbeafb5[_0xaa41('0x23')][_0x4c61d0['id']],_0x4c61d0);}}}return _0xbeafb5[_0xaa41('0x23')];};};Realtime[_0xaa41('0x3e')][_0xaa41('0x4d')]=function(){var _0x457515=this;return function(_0x3ffbf8){if(_0x3ffbf8){freeIsNotKey(_0x3ffbf8,_0x457515[_0xaa41('0x24')],'id');for(var _0x50a53b=0x0,_0x1d2978={},_0x3031e5={};_0x50a53b<_0x3ffbf8[_0xaa41('0x40')];_0x50a53b+=0x1){_0x1d2978=_0x3ffbf8[_0x50a53b];if(_[_0xaa41('0x43')](_0x457515['freshsalesAccounts'][_0x1d2978['id']])){_0x457515[_0xaa41('0x24')][_0x1d2978['id']]=new FreshsalesAccount(_0x1d2978);}else{_0x457515['mergeFromDatabase'](_0x457515[_0xaa41('0x24')][_0x1d2978['id']],_0x1d2978);}}}return _0x457515[_0xaa41('0x24')];};};Realtime[_0xaa41('0x3e')][_0xaa41('0x4e')]=function(){var _0x491cad=this;return function(_0xf456c1){for(var _0x1a4197=0x0;_0x1a4197<_0xf456c1[_0xaa41('0x40')];_0x1a4197+=0x1){_[_0xaa41('0x4f')](_0x491cad['voiceQueues'][_0xf456c1[_0x1a4197][_0xaa41('0x29')]],_0xf456c1[_0x1a4197]);}return _0x491cad['voiceQueues'];};};Realtime[_0xaa41('0x3e')][_0xaa41('0x50')]=function(){var _0x574316=this;return function(_0x1ac05e){clearVoiceQueues(_0x574316[_0xaa41('0x15')]);if(_0x1ac05e){_0x1ac05e=_[_0xaa41('0x51')](_0x1ac05e,_0xaa41('0x52'));for(var _0x1c5df8 in _0x1ac05e){if(_0x1ac05e[_0xaa41('0x27')](_0x1c5df8)){var _0x384aba={};for(var _0x297ec6=0x0;_0x297ec6<_0x1ac05e[_0x1c5df8][_0xaa41('0x40')];_0x297ec6+=0x1){var _0x3d4f1e=_0x1ac05e[_0x1c5df8][_0x297ec6][_0xaa41('0x53')];if(_0x574316['voiceQueues'][_0x3d4f1e]){if(_0x1ac05e[_0x1c5df8][_0x297ec6][_0xaa41('0x54')]){_0x574316[_0xaa41('0x15')][_0x3d4f1e][_0xaa41('0x32')]+=0x1;}if(_0x1ac05e[_0x1c5df8][_0x297ec6]['queuecallerabandon']){_0x574316['voiceQueues'][_0x3d4f1e][_0xaa41('0x33')]+=0x1;}_0x574316[_0xaa41('0x15')][_0x3d4f1e]['sumHoldTime']+=moment(_0x1ac05e[_0x1c5df8][_0x297ec6][_0xaa41('0x55')])[_0xaa41('0x56')](moment(_0x1ac05e[_0x1c5df8][_0x297ec6]['queuecallerjoinAt']),_0xaa41('0x57'))||0x0;if(_0x297ec6===_0x1ac05e[_0x1c5df8][_0xaa41('0x40')]-0x1){_0x574316[_0xaa41('0x15')][_0x3d4f1e][_0xaa41('0x2d')]+=moment(_0x1ac05e[_0x1c5df8][_0x297ec6][_0xaa41('0x58')]||_0x1ac05e[_0x1c5df8][_0x297ec6][_0xaa41('0x59')]||_0x1ac05e[_0x1c5df8][_0x297ec6][_0xaa41('0x5a')])[_0xaa41('0x56')](moment(_0x1ac05e[_0x1c5df8][_0x297ec6]['queuecallerjoinAt']),'seconds')||0x0;_0x574316[_0xaa41('0x15')][_0x3d4f1e]['total']+=0x1;if(_0x1ac05e[_0x1c5df8][_0x297ec6][_0xaa41('0x5b')]){_0x574316[_0xaa41('0x15')][_0x3d4f1e][_0xaa41('0x31')]+=0x1;_0x574316['voiceQueues'][_0x3d4f1e][_0xaa41('0x5c')]+=moment(_0x1ac05e[_0x1c5df8][_0x297ec6][_0xaa41('0x58')])[_0xaa41('0x56')](moment(_0x1ac05e[_0x1c5df8][_0x297ec6]['queuecallerleaveAt']),_0xaa41('0x57'))||0x0;}}else{_0x574316[_0xaa41('0x15')][_0x3d4f1e]['sumDuration']+=_0x574316[_0xaa41('0x15')][_0x3d4f1e]['sumHoldTime']||0x0;}}}}}}return _0x574316['voiceQueues'];};};Realtime[_0xaa41('0x3e')][_0xaa41('0x5d')]=function(){var _0x5eded3=this;return function(_0x5a8cb0){clearVoiceCallReports(_0x5eded3[_0xaa41('0x18')]);if(_0x5a8cb0){for(var _0x1726ec=0x0;_0x1726ec<_0x5a8cb0[_0xaa41('0x40')];_0x1726ec+=0x1){_0x5eded3[_0xaa41('0x18')]['total']+=0x1;_0x5eded3[_0xaa41('0x18')][_0xaa41('0x2d')]+=_0x5a8cb0[_0x1726ec][_0xaa41('0x5e')];if(_0x5a8cb0[_0x1726ec]['disposition']===_0xaa41('0x5f')){_0x5eded3[_0xaa41('0x18')][_0xaa41('0x31')]+=0x1;_0x5eded3['outbound'][_0xaa41('0x34')]+=_0x5a8cb0[_0x1726ec]['duration']-_0x5a8cb0[_0x1726ec]['billableseconds']||0x0;_0x5eded3[_0xaa41('0x18')][_0xaa41('0x5c')]+=_0x5a8cb0[_0x1726ec]['billableseconds'];}}}return _0x5eded3[_0xaa41('0x18')];};};Realtime[_0xaa41('0x3e')][_0xaa41('0x60')]=function(){var _0x531fd4=this;return function(_0x292384){if(_0x292384){freeIsNotKey(_0x292384,_0x531fd4[_0xaa41('0x61')],_0xaa41('0x29'));for(var _0x16dcac=0x0,_0x38f5d0={};_0x16dcac<_0x292384['length'];_0x16dcac+=0x1){_0x38f5d0=_0x292384[_0x16dcac];if(_[_0xaa41('0x43')](_0x531fd4['campaigns'][_0x38f5d0[_0xaa41('0x29')]])){_0x531fd4[_0xaa41('0x61')][_0x38f5d0[_0xaa41('0x29')]]=new Campaign(_0x38f5d0);}else{_0x531fd4[_0xaa41('0x3d')](_0x531fd4[_0xaa41('0x61')][_0x38f5d0[_0xaa41('0x29')]],_0x38f5d0);_0x531fd4[_0xaa41('0x61')][_0x38f5d0[_0xaa41('0x29')]][_0xaa41('0x62')]=_0x38f5d0[_0xaa41('0x63')]?_0x38f5d0[_0xaa41('0x63')]['name']:undefined;}}}return _0x531fd4[_0xaa41('0x61')];};};Realtime[_0xaa41('0x3e')]['initVoiceExtensions']=function(){var _0x2961bc=this;return function(_0x543ab4){if(_0x543ab4){freeIsNotKey(_0x543ab4,_0x2961bc[_0xaa41('0x64')],'id');for(var _0xb44b1f=0x0,_0x472eb3={};_0xb44b1f<_0x543ab4[_0xaa41('0x40')];_0xb44b1f+=0x1){_0x472eb3=_0x543ab4[_0xb44b1f];if(_[_0xaa41('0x43')](_0x2961bc[_0xaa41('0x64')][_0x472eb3['id']])){_0x2961bc[_0xaa41('0x64')][_0x472eb3['id']]=new VoiceExtension(_0x472eb3);}else{_0x2961bc['mergeFromDatabase'](_0x2961bc[_0xaa41('0x64')][_0x472eb3['id']],_0x472eb3);}}}return _0x2961bc[_0xaa41('0x64')];};};Realtime[_0xaa41('0x3e')][_0xaa41('0x65')]=function(){var _0x585ce7=this;return function(_0x2e4d3f){clearCampaigns(_0x585ce7['campaigns']);for(var _0x23d90e=0x0;_0x23d90e<_0x2e4d3f[_0xaa41('0x40')];_0x23d90e+=0x1){_[_0xaa41('0x4f')](_0x585ce7[_0xaa41('0x61')][_0x2e4d3f[_0x23d90e][_0xaa41('0x29')]],_0x2e4d3f[_0x23d90e]);}return _0x585ce7['campaigns'];};};Realtime[_0xaa41('0x3e')][_0xaa41('0x66')]=function(){var _0x5819ac=this;return function(_0x44743b){if(_0x44743b){freeIsNotKey(_0x44743b,_0x5819ac[_0xaa41('0x25')],'id');for(var _0x455571=0x0,_0x20184e={},_0x298533={};_0x455571<_0x44743b[_0xaa41('0x40')];_0x455571+=0x1){_0x20184e=_0x44743b[_0x455571];if(_[_0xaa41('0x43')](_0x5819ac[_0xaa41('0x25')][_0x20184e['id']])){_0x5819ac['faxAccounts'][_0x20184e['id']]=new FaxAccount(_0x20184e);}else{_0x5819ac[_0xaa41('0x3d')](_0x5819ac[_0xaa41('0x25')][_0x20184e['id']],_0x20184e);}}}return _0x5819ac[_0xaa41('0x25')];};};module[_0xaa41('0x67')]=Realtime;
\ No newline at end of file
+var _0xe5b3=['trunks','voiceQueues','campaigns','outbound','voiceExtensions','channels','queueChannels','outboundChannels','timers','settings','salesforceAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','freshsalesAccounts','mapKeys','hasOwnProperty','format','SIP/%s','name','isNil','interface','total','answered','sumHoldTime','sumDuration','sumBillable','isEmpty','ivrTotalCallsDays','unmanaged','abandoned','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','queueStatusComplete','prototype','initAgents','isUndefined','length','mergeFromDatabase','initTrunks','initVoiceQueues','initTriggers','triggers','initTemplates','templates','initZendeskAccounts','zendeskAccounts','initSalesforceAccounts','freshdeskAccounts','zohoAccounts','initDeskAccounts','initSugarcrmAccounts','sugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','initDynamics365Accounts','dynamics365Accounts','initFreshsalesAccounts','merge','groupBy','uniqueid','queue','queuecallerexit','queuecallerleaveAt','diff','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','queuecallercomplete','initVoiceCallReports','disposition','ANSWERED','duration','billableseconds','initCampaigns','SquareProject','initVoiceExtensions','initFaxAccounts','faxAccounts','exports','util','lodash','moment','../model/agent','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/voiceExtension','../model/salesforceAccount','../model/freshdeskAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/faxAccount','agents','telephones'];(function(_0x149724,_0x9986fe){var _0x13b0f1=function(_0x1a0c83){while(--_0x1a0c83){_0x149724['push'](_0x149724['shift']());}};_0x13b0f1(++_0x9986fe);}(_0xe5b3,0x133));var _0x3e5b=function(_0x5774af,_0x411c94){_0x5774af=_0x5774af-0x0;var _0x480589=_0xe5b3[_0x5774af];return _0x480589;};'use strict';var BPromise=require('bluebird');var util=require(_0x3e5b('0x0'));var _=require(_0x3e5b('0x1'));var moment=require(_0x3e5b('0x2'));var Agent=require(_0x3e5b('0x3'));var Telephone=require(_0x3e5b('0x4'));var Trunk=require(_0x3e5b('0x5'));var VoiceQueue=require(_0x3e5b('0x6'));var Trigger=require(_0x3e5b('0x7'));var Template=require(_0x3e5b('0x8'));var Campaign=require(_0x3e5b('0x9'));var VoiceExtension=require(_0x3e5b('0xa'));var ZendeskAccount=require('../model/zendeskAccount');var SalesforceAccount=require(_0x3e5b('0xb'));var FreshdeskAccount=require(_0x3e5b('0xc'));var SugarcrmAccount=require('../model/sugarcrmAccount');var ZohoAccount=require(_0x3e5b('0xd'));var DeskAccount=require(_0x3e5b('0xe'));var VtigerAccount=require(_0x3e5b('0xf'));var ServicenowAccount=require(_0x3e5b('0x10'));var Dynamics365Account=require('../model/dynamics365Account');var FreshsalesAccount=require('../model/freshsalesAccount');var FaxAccount=require(_0x3e5b('0x11'));var Realtime=function(){this[_0x3e5b('0x12')]={};this[_0x3e5b('0x13')]={};this[_0x3e5b('0x14')]={};this[_0x3e5b('0x15')]={};this['triggers']={};this[_0x3e5b('0x16')]={};this['templates']={};this[_0x3e5b('0x17')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x3e5b('0x18')]={};this[_0x3e5b('0x19')]={};this[_0x3e5b('0x1a')]={};this[_0x3e5b('0x1b')]={};this[_0x3e5b('0x1c')]={};this[_0x3e5b('0x1d')]={};this['zendeskAccounts']={};this[_0x3e5b('0x1e')]={};this['sugarcrmAccounts']={};this['freshdeskAccounts']={};this['zohoAccounts']={};this[_0x3e5b('0x1f')]={};this[_0x3e5b('0x20')]={};this[_0x3e5b('0x21')]={};this['dynamics365Accounts']={};this[_0x3e5b('0x22')]={};this['faxAccounts']={};};function freeIsNotKey(_0x56a453,_0x258d6a,_0x11b41b){var _0x5e2f83=_[_0x3e5b('0x23')](_0x56a453,function(_0x143040,_0x555002){return _0x143040[_0x11b41b];});for(var _0xc56a2a in _0x258d6a){if(_0x258d6a[_0x3e5b('0x24')](_0xc56a2a)){if(!_0x5e2f83[_0xc56a2a]){delete _0x258d6a[_0xc56a2a];}}}}function freeIsNotKeySip(_0x52696c,_0x4b189d){var _0x144fa7=_[_0x3e5b('0x23')](_0x52696c,function(_0x20b549,_0xff4aba){return util[_0x3e5b('0x25')](_0x3e5b('0x26'),_0x20b549[_0x3e5b('0x27')]);});for(var _0x21fc32 in _0x4b189d){if(_0x4b189d[_0x3e5b('0x24')](_0x21fc32)){if(!_0x144fa7[_0x21fc32]){delete _0x4b189d[_0x21fc32];}}}}function freeIsNotKeyAgent(_0x3d95f3,_0x2b977c){var _0x11e5cf=_[_0x3e5b('0x23')](_0x3d95f3,function(_0x402873,_0x5b46d4){var _0x433f9c=_[_0x3e5b('0x28')](_0x402873[_0x3e5b('0x29')])?util[_0x3e5b('0x25')]('SIP/%s',_0x402873[_0x3e5b('0x27')]):_0x402873['interface'];return _0x433f9c;});for(var _0x2f9e42 in _0x2b977c){if(_0x2b977c[_0x3e5b('0x24')](_0x2f9e42)){if(!_0x11e5cf[_0x2f9e42]){delete _0x2b977c[_0x2f9e42];}}}}function clearVoiceCallReports(_0x4d5e61){_0x4d5e61[_0x3e5b('0x2a')]=0x0;_0x4d5e61[_0x3e5b('0x2b')]=0x0;_0x4d5e61[_0x3e5b('0x2c')]=0x0;_0x4d5e61[_0x3e5b('0x2d')]=0x0;_0x4d5e61[_0x3e5b('0x2e')]=0x0;}function clearCampaigns(_0x26c7f2){if(!_[_0x3e5b('0x2f')](_0x26c7f2)){for(var _0x2ddf57 in _0x26c7f2){if(_0x26c7f2['hasOwnProperty'](_0x2ddf57)){_0x26c7f2[_0x2ddf57][_0x3e5b('0x30')]=0x0;_0x26c7f2[_0x2ddf57]['ivrAnswerCallsDay']=0x0;}}}}function clearVoiceQueues(_0xb70ab4){if(!_['isEmpty'](_0xb70ab4)){for(var _0x101653 in _0xb70ab4){if(_0xb70ab4[_0x3e5b('0x24')](_0x101653)){_0xb70ab4[_0x101653][_0x3e5b('0x2a')]=0x0;_0xb70ab4[_0x101653][_0x3e5b('0x2b')]=0x0;_0xb70ab4[_0x101653][_0x3e5b('0x31')]=0x0;_0xb70ab4[_0x101653][_0x3e5b('0x32')]=0x0;_0xb70ab4[_0x101653][_0x3e5b('0x2c')]=0x0;_0xb70ab4[_0x101653][_0x3e5b('0x2d')]=0x0;_0xb70ab4[_0x101653][_0x3e5b('0x2e')]=0x0;_0xb70ab4[_0x101653][_0x3e5b('0x33')]=0x0;_0xb70ab4[_0x101653][_0x3e5b('0x34')]=0x0;_0xb70ab4[_0x101653]['outboundBusyCallsDay']=0x0;_0xb70ab4[_0x101653][_0x3e5b('0x35')]=0x0;_0xb70ab4[_0x101653][_0x3e5b('0x36')]=0x0;_0xb70ab4[_0x101653][_0x3e5b('0x37')]=0x0;_0xb70ab4[_0x101653][_0x3e5b('0x38')]=0x0;_0xb70ab4[_0x101653][_0x3e5b('0x39')]=0x0;_0xb70ab4[_0x101653][_0x3e5b('0x3a')]=0x0;_0xb70ab4[_0x101653][_0x3e5b('0x3b')]=0x0;_0xb70ab4[_0x101653]['outboundRejectCallsDay']=0x0;_0xb70ab4[_0x101653][_0x3e5b('0x3c')]=0x0;_0xb70ab4[_0x101653]['outboundAnswerAgiCallsDay']=0x0;_0xb70ab4[_0x101653]['outboundAnswerCallsDay']=0x0;_0xb70ab4[_0x101653][_0x3e5b('0x3d')]=!![];}}}}Realtime[_0x3e5b('0x3e')]['mergeFromDatabase']=function(_0x40e37d,_0x2f7ff3){for(var _0x9d01c4 in _0x2f7ff3){if(_0x40e37d[_0x3e5b('0x24')](_0x9d01c4)){_0x40e37d[_0x9d01c4]=_0x2f7ff3[_0x9d01c4];}}};Realtime[_0x3e5b('0x3e')][_0x3e5b('0x3f')]=function(){var _0x3b3046=this;return function(_0x26c9ab){if(_0x26c9ab){freeIsNotKeyAgent(_0x26c9ab,_0x3b3046[_0x3e5b('0x12')]);for(var _0x7917ef=0x0,_0x3104e6={},_0x1506f5={};_0x7917ef<_0x26c9ab['length'];_0x7917ef+=0x1){_0x3104e6=_0x26c9ab[_0x7917ef];var _0x141b7e=_[_0x3e5b('0x28')](_0x3104e6['interface'])?util['format'](_0x3e5b('0x26'),_0x3104e6['name']):_0x3104e6[_0x3e5b('0x29')];if(_[_0x3e5b('0x40')](_0x3b3046[_0x3e5b('0x12')][_0x141b7e])){_0x3b3046[_0x3e5b('0x12')][_0x141b7e]=new Agent(_0x3104e6);}else{_0x3b3046['mergeFromDatabase'](_0x3b3046[_0x3e5b('0x12')][_0x141b7e],_0x3104e6);}}}return _0x3b3046['agents'];};};Realtime[_0x3e5b('0x3e')]['initTelephones']=function(){var _0x47f7c8=this;return function(_0x48f414){if(_0x48f414){freeIsNotKeySip(_0x48f414,_0x47f7c8[_0x3e5b('0x13')]);for(var _0x174ebf=0x0,_0x2eaa30={},_0x35cfcd={};_0x174ebf<_0x48f414[_0x3e5b('0x41')];_0x174ebf+=0x1){_0x2eaa30=_0x48f414[_0x174ebf];if(_[_0x3e5b('0x40')](_0x47f7c8['telephones'][util['format']('SIP/%s',_0x2eaa30['name'])])){_0x47f7c8['telephones'][util['format']('SIP/%s',_0x2eaa30[_0x3e5b('0x27')])]=new Telephone(_0x2eaa30);}else{_0x47f7c8[_0x3e5b('0x42')](_0x47f7c8[_0x3e5b('0x13')][util[_0x3e5b('0x25')](_0x3e5b('0x26'),_0x2eaa30[_0x3e5b('0x27')])],_0x2eaa30);}}}return _0x47f7c8[_0x3e5b('0x13')];};};Realtime[_0x3e5b('0x3e')][_0x3e5b('0x43')]=function(){var _0xbbc6b=this;return function(_0x391499){if(_0x391499){freeIsNotKeySip(_0x391499,_0xbbc6b['trunks']);for(var _0x28362c=0x0,_0x1d2fb4={},_0x1e8075={};_0x28362c<_0x391499[_0x3e5b('0x41')];_0x28362c+=0x1){_0x1d2fb4=_0x391499[_0x28362c];if(_[_0x3e5b('0x40')](_0xbbc6b[_0x3e5b('0x14')][util[_0x3e5b('0x25')](_0x3e5b('0x26'),_0x1d2fb4[_0x3e5b('0x27')])])){_0xbbc6b[_0x3e5b('0x14')][util[_0x3e5b('0x25')]('SIP/%s',_0x1d2fb4['name'])]=new Trunk(_0x1d2fb4);}else{_0xbbc6b['mergeFromDatabase'](_0xbbc6b['trunks'][util[_0x3e5b('0x25')](_0x3e5b('0x26'),_0x1d2fb4[_0x3e5b('0x27')])],_0x1d2fb4);}}}return _0xbbc6b[_0x3e5b('0x14')];};};Realtime[_0x3e5b('0x3e')][_0x3e5b('0x44')]=function(){var _0x12b486=this;return function(_0x158518){if(_0x158518){freeIsNotKey(_0x158518,_0x12b486[_0x3e5b('0x15')],_0x3e5b('0x27'));for(var _0x5d318a=0x0,_0x1392f8={},_0x28a105={};_0x5d318a<_0x158518[_0x3e5b('0x41')];_0x5d318a+=0x1){_0x1392f8=_0x158518[_0x5d318a];if(_[_0x3e5b('0x40')](_0x12b486[_0x3e5b('0x15')][_0x1392f8['name']])){_0x12b486['voiceQueues'][_0x1392f8['name']]=new VoiceQueue(_0x1392f8);}else{_0x12b486[_0x3e5b('0x42')](_0x12b486[_0x3e5b('0x15')][_0x1392f8[_0x3e5b('0x27')]],_0x1392f8);}}}return _0x12b486['voiceQueues'];};};Realtime['prototype'][_0x3e5b('0x45')]=function(){var _0x313c51=this;return function(_0x123947){if(_0x123947){freeIsNotKey(_0x123947,_0x313c51['triggers'],'id');for(var _0x514501=0x0,_0x467211={},_0x48ada0={};_0x514501<_0x123947[_0x3e5b('0x41')];_0x514501+=0x1){_0x467211=_0x123947[_0x514501];if(_[_0x3e5b('0x40')](_0x313c51[_0x3e5b('0x46')][_0x467211['id']])){_0x313c51[_0x3e5b('0x46')][_0x467211['id']]=new Trigger(_0x467211);}else{_0x313c51[_0x3e5b('0x42')](_0x313c51[_0x3e5b('0x46')][_0x467211['id']],_0x467211);}}}return _0x313c51[_0x3e5b('0x46')];};};Realtime[_0x3e5b('0x3e')][_0x3e5b('0x47')]=function(){var _0x4a2ae1=this;return function(_0x223185){if(_0x223185){freeIsNotKey(_0x223185,_0x4a2ae1['templates'],'id');for(var _0x51fd67=0x0,_0x2e7047={},_0x26e11e={};_0x51fd67<_0x223185[_0x3e5b('0x41')];_0x51fd67+=0x1){_0x2e7047=_0x223185[_0x51fd67];if(_[_0x3e5b('0x40')](_0x4a2ae1[_0x3e5b('0x48')][_0x2e7047['id']])){_0x4a2ae1[_0x3e5b('0x48')][_0x2e7047['id']]=new Template(_0x2e7047);}else{_0x4a2ae1[_0x3e5b('0x42')](_0x4a2ae1[_0x3e5b('0x48')][_0x2e7047['id']],_0x2e7047);}}}return _0x4a2ae1[_0x3e5b('0x48')];};};Realtime[_0x3e5b('0x3e')][_0x3e5b('0x49')]=function(){var _0x458058=this;return function(_0x59d311){if(_0x59d311){freeIsNotKey(_0x59d311,_0x458058[_0x3e5b('0x4a')],'id');for(var _0x181160=0x0,_0x2ca33b={},_0xfd37fb={};_0x181160<_0x59d311[_0x3e5b('0x41')];_0x181160+=0x1){_0x2ca33b=_0x59d311[_0x181160];if(_[_0x3e5b('0x40')](_0x458058['zendeskAccounts'][_0x2ca33b['id']])){_0x458058[_0x3e5b('0x4a')][_0x2ca33b['id']]=new ZendeskAccount(_0x2ca33b);}else{_0x458058[_0x3e5b('0x42')](_0x458058[_0x3e5b('0x4a')][_0x2ca33b['id']],_0x2ca33b);}}}return _0x458058[_0x3e5b('0x4a')];};};Realtime[_0x3e5b('0x3e')][_0x3e5b('0x4b')]=function(){var _0x216600=this;return function(_0x437430){if(_0x437430){freeIsNotKey(_0x437430,_0x216600['salesforceAccounts'],'id');for(var _0x1e6403=0x0,_0x5e702f={},_0x4bc555={};_0x1e6403<_0x437430[_0x3e5b('0x41')];_0x1e6403+=0x1){_0x5e702f=_0x437430[_0x1e6403];if(_['isUndefined'](_0x216600[_0x3e5b('0x1e')][_0x5e702f['id']])){_0x216600[_0x3e5b('0x1e')][_0x5e702f['id']]=new SalesforceAccount(_0x5e702f);}else{_0x216600[_0x3e5b('0x42')](_0x216600[_0x3e5b('0x1e')][_0x5e702f['id']],_0x5e702f);}}}return _0x216600['salesforceAccounts'];};};Realtime['prototype']['initFreshdeskAccounts']=function(){var _0x581b94=this;return function(_0x2ab5f3){if(_0x2ab5f3){freeIsNotKey(_0x2ab5f3,_0x581b94[_0x3e5b('0x4c')],'id');for(var _0x1ea02a=0x0,_0x4149c8={},_0x14aa11={};_0x1ea02a<_0x2ab5f3['length'];_0x1ea02a+=0x1){_0x4149c8=_0x2ab5f3[_0x1ea02a];if(_['isUndefined'](_0x581b94[_0x3e5b('0x4c')][_0x4149c8['id']])){_0x581b94[_0x3e5b('0x4c')][_0x4149c8['id']]=new FreshdeskAccount(_0x4149c8);}else{_0x581b94[_0x3e5b('0x42')](_0x581b94[_0x3e5b('0x4c')][_0x4149c8['id']],_0x4149c8);}}}return _0x581b94[_0x3e5b('0x4c')];};};Realtime['prototype']['initZohoAccounts']=function(){var _0x4abd65=this;return function(_0x4eaa6e){if(_0x4eaa6e){freeIsNotKey(_0x4eaa6e,_0x4abd65[_0x3e5b('0x4d')],'id');for(var _0x3e3115=0x0,_0x3088d4={},_0x80b4={};_0x3e3115<_0x4eaa6e[_0x3e5b('0x41')];_0x3e3115+=0x1){_0x3088d4=_0x4eaa6e[_0x3e3115];if(_[_0x3e5b('0x40')](_0x4abd65[_0x3e5b('0x4d')][_0x3088d4['id']])){_0x4abd65[_0x3e5b('0x4d')][_0x3088d4['id']]=new ZohoAccount(_0x3088d4);}else{_0x4abd65['mergeFromDatabase'](_0x4abd65[_0x3e5b('0x4d')][_0x3088d4['id']],_0x3088d4);}}}return _0x4abd65[_0x3e5b('0x4d')];};};Realtime[_0x3e5b('0x3e')][_0x3e5b('0x4e')]=function(){var _0x2d2c1e=this;return function(_0x5eb277){if(_0x5eb277){freeIsNotKey(_0x5eb277,_0x2d2c1e[_0x3e5b('0x1f')],'id');for(var _0x57ac70=0x0,_0x45ca16={},_0x1fd40c={};_0x57ac70<_0x5eb277['length'];_0x57ac70+=0x1){_0x45ca16=_0x5eb277[_0x57ac70];if(_['isUndefined'](_0x2d2c1e['deskAccounts'][_0x45ca16['id']])){_0x2d2c1e[_0x3e5b('0x1f')][_0x45ca16['id']]=new DeskAccount(_0x45ca16);}else{_0x2d2c1e['mergeFromDatabase'](_0x2d2c1e[_0x3e5b('0x1f')][_0x45ca16['id']],_0x45ca16);}}}return _0x2d2c1e[_0x3e5b('0x1f')];};};Realtime[_0x3e5b('0x3e')][_0x3e5b('0x4f')]=function(){var _0x14f187=this;return function(_0x4de129){if(_0x4de129){freeIsNotKey(_0x4de129,_0x14f187['sugarcrmAccounts'],'id');for(var _0x226f61=0x0,_0x13bc3b={},_0x3f7f71={};_0x226f61<_0x4de129['length'];_0x226f61+=0x1){_0x13bc3b=_0x4de129[_0x226f61];if(_[_0x3e5b('0x40')](_0x14f187[_0x3e5b('0x50')][_0x13bc3b['id']])){_0x14f187[_0x3e5b('0x50')][_0x13bc3b['id']]=new SugarcrmAccount(_0x13bc3b);}else{_0x14f187[_0x3e5b('0x42')](_0x14f187[_0x3e5b('0x50')][_0x13bc3b['id']],_0x13bc3b);}}}return _0x14f187[_0x3e5b('0x50')];};};Realtime[_0x3e5b('0x3e')][_0x3e5b('0x51')]=function(){var _0x3a11a8=this;return function(_0x52e98f){if(_0x52e98f){freeIsNotKey(_0x52e98f,_0x3a11a8[_0x3e5b('0x20')],'id');for(var _0x3f9b4b=0x0,_0x33bbb8={},_0xc1b0de={};_0x3f9b4b<_0x52e98f[_0x3e5b('0x41')];_0x3f9b4b+=0x1){_0x33bbb8=_0x52e98f[_0x3f9b4b];if(_[_0x3e5b('0x40')](_0x3a11a8[_0x3e5b('0x20')][_0x33bbb8['id']])){_0x3a11a8[_0x3e5b('0x20')][_0x33bbb8['id']]=new VtigerAccount(_0x33bbb8);}else{_0x3a11a8['mergeFromDatabase'](_0x3a11a8[_0x3e5b('0x20')][_0x33bbb8['id']],_0x33bbb8);}}}return _0x3a11a8[_0x3e5b('0x20')];};};Realtime['prototype'][_0x3e5b('0x52')]=function(){var _0x31ef31=this;return function(_0x561c78){if(_0x561c78){freeIsNotKey(_0x561c78,_0x31ef31['servicenowAccounts'],'id');for(var _0x4f67d1=0x0,_0x23edae={},_0x465826={};_0x4f67d1<_0x561c78['length'];_0x4f67d1+=0x1){_0x23edae=_0x561c78[_0x4f67d1];if(_[_0x3e5b('0x40')](_0x31ef31[_0x3e5b('0x21')][_0x23edae['id']])){_0x31ef31['servicenowAccounts'][_0x23edae['id']]=new ServicenowAccount(_0x23edae);}else{_0x31ef31[_0x3e5b('0x42')](_0x31ef31[_0x3e5b('0x21')][_0x23edae['id']],_0x23edae);}}}return _0x31ef31[_0x3e5b('0x21')];};};Realtime[_0x3e5b('0x3e')][_0x3e5b('0x53')]=function(){var _0x21c85a=this;return function(_0x5891fe){if(_0x5891fe){freeIsNotKey(_0x5891fe,_0x21c85a[_0x3e5b('0x54')],'id');for(var _0x3f2c6c=0x0,_0x589498={},_0x310238={};_0x3f2c6c<_0x5891fe[_0x3e5b('0x41')];_0x3f2c6c+=0x1){_0x589498=_0x5891fe[_0x3f2c6c];if(_[_0x3e5b('0x40')](_0x21c85a[_0x3e5b('0x54')][_0x589498['id']])){_0x21c85a[_0x3e5b('0x54')][_0x589498['id']]=new Dynamics365Account(_0x589498);}else{_0x21c85a[_0x3e5b('0x42')](_0x21c85a[_0x3e5b('0x54')][_0x589498['id']],_0x589498);}}}return _0x21c85a['dynamics365Accounts'];};};Realtime['prototype'][_0x3e5b('0x55')]=function(){var _0x3ee33c=this;return function(_0x4dd417){if(_0x4dd417){freeIsNotKey(_0x4dd417,_0x3ee33c[_0x3e5b('0x22')],'id');for(var _0x6e1c5=0x0,_0x35e3ef={},_0x1fd69c={};_0x6e1c5<_0x4dd417[_0x3e5b('0x41')];_0x6e1c5+=0x1){_0x35e3ef=_0x4dd417[_0x6e1c5];if(_[_0x3e5b('0x40')](_0x3ee33c[_0x3e5b('0x22')][_0x35e3ef['id']])){_0x3ee33c['freshsalesAccounts'][_0x35e3ef['id']]=new FreshsalesAccount(_0x35e3ef);}else{_0x3ee33c[_0x3e5b('0x42')](_0x3ee33c[_0x3e5b('0x22')][_0x35e3ef['id']],_0x35e3ef);}}}return _0x3ee33c['freshsalesAccounts'];};};Realtime['prototype']['initVoiceQueueHopperHistory']=function(){var _0x8d164e=this;return function(_0x141393){for(var _0x144738=0x0;_0x144738<_0x141393[_0x3e5b('0x41')];_0x144738+=0x1){_[_0x3e5b('0x56')](_0x8d164e[_0x3e5b('0x15')][_0x141393[_0x144738]['name']],_0x141393[_0x144738]);}return _0x8d164e[_0x3e5b('0x15')];};};Realtime[_0x3e5b('0x3e')]['initVoiceQueueReports']=function(){var _0x34098c=this;return function(_0x4da39d){clearVoiceQueues(_0x34098c['voiceQueues']);if(_0x4da39d){_0x4da39d=_[_0x3e5b('0x57')](_0x4da39d,_0x3e5b('0x58'));for(var _0x487caf in _0x4da39d){if(_0x4da39d[_0x3e5b('0x24')](_0x487caf)){var _0x26d28c={};for(var _0x5eb839=0x0;_0x5eb839<_0x4da39d[_0x487caf][_0x3e5b('0x41')];_0x5eb839+=0x1){var _0x185640=_0x4da39d[_0x487caf][_0x5eb839][_0x3e5b('0x59')];if(_0x34098c[_0x3e5b('0x15')][_0x185640]){if(_0x4da39d[_0x487caf][_0x5eb839][_0x3e5b('0x5a')]){_0x34098c[_0x3e5b('0x15')][_0x185640]['unmanaged']+=0x1;}if(_0x4da39d[_0x487caf][_0x5eb839]['queuecallerabandon']){_0x34098c[_0x3e5b('0x15')][_0x185640]['abandoned']+=0x1;}_0x34098c['voiceQueues'][_0x185640][_0x3e5b('0x2c')]+=moment(_0x4da39d[_0x487caf][_0x5eb839][_0x3e5b('0x5b')])[_0x3e5b('0x5c')](moment(_0x4da39d[_0x487caf][_0x5eb839]['queuecallerjoinAt']),_0x3e5b('0x5d'))||0x0;if(_0x5eb839===_0x4da39d[_0x487caf]['length']-0x1){_0x34098c[_0x3e5b('0x15')][_0x185640]['sumDuration']+=moment(_0x4da39d[_0x487caf][_0x5eb839][_0x3e5b('0x5e')]||_0x4da39d[_0x487caf][_0x5eb839][_0x3e5b('0x5f')]||_0x4da39d[_0x487caf][_0x5eb839][_0x3e5b('0x60')])[_0x3e5b('0x5c')](moment(_0x4da39d[_0x487caf][_0x5eb839]['queuecallerjoinAt']),_0x3e5b('0x5d'))||0x0;_0x34098c['voiceQueues'][_0x185640][_0x3e5b('0x2a')]+=0x1;if(_0x4da39d[_0x487caf][_0x5eb839][_0x3e5b('0x61')]){_0x34098c['voiceQueues'][_0x185640][_0x3e5b('0x2b')]+=0x1;_0x34098c[_0x3e5b('0x15')][_0x185640][_0x3e5b('0x2e')]+=moment(_0x4da39d[_0x487caf][_0x5eb839]['queuecallercompleteAt'])[_0x3e5b('0x5c')](moment(_0x4da39d[_0x487caf][_0x5eb839][_0x3e5b('0x5b')]),_0x3e5b('0x5d'))||0x0;}}else{_0x34098c['voiceQueues'][_0x185640][_0x3e5b('0x2d')]+=_0x34098c[_0x3e5b('0x15')][_0x185640]['sumHoldTime']||0x0;}}}}}}return _0x34098c[_0x3e5b('0x15')];};};Realtime[_0x3e5b('0x3e')][_0x3e5b('0x62')]=function(){var _0x5b2014=this;return function(_0x3b3306){clearVoiceCallReports(_0x5b2014[_0x3e5b('0x17')]);if(_0x3b3306){for(var _0x352f7e=0x0;_0x352f7e<_0x3b3306[_0x3e5b('0x41')];_0x352f7e+=0x1){_0x5b2014['outbound'][_0x3e5b('0x2a')]+=0x1;_0x5b2014['outbound'][_0x3e5b('0x2d')]+=_0x3b3306[_0x352f7e]['duration'];if(_0x3b3306[_0x352f7e][_0x3e5b('0x63')]===_0x3e5b('0x64')){_0x5b2014['outbound'][_0x3e5b('0x2b')]+=0x1;_0x5b2014[_0x3e5b('0x17')]['sumHoldTime']+=_0x3b3306[_0x352f7e][_0x3e5b('0x65')]-_0x3b3306[_0x352f7e][_0x3e5b('0x66')]||0x0;_0x5b2014[_0x3e5b('0x17')][_0x3e5b('0x2e')]+=_0x3b3306[_0x352f7e]['billableseconds'];}}}return _0x5b2014['outbound'];};};Realtime[_0x3e5b('0x3e')][_0x3e5b('0x67')]=function(){var _0x1ffb60=this;return function(_0x330a36){if(_0x330a36){freeIsNotKey(_0x330a36,_0x1ffb60[_0x3e5b('0x16')],_0x3e5b('0x27'));for(var _0x54bddf=0x0,_0x5d6aae={};_0x54bddf<_0x330a36[_0x3e5b('0x41')];_0x54bddf+=0x1){_0x5d6aae=_0x330a36[_0x54bddf];if(_[_0x3e5b('0x40')](_0x1ffb60[_0x3e5b('0x16')][_0x5d6aae[_0x3e5b('0x27')]])){_0x1ffb60[_0x3e5b('0x16')][_0x5d6aae[_0x3e5b('0x27')]]=new Campaign(_0x5d6aae);}else{_0x1ffb60[_0x3e5b('0x42')](_0x1ffb60[_0x3e5b('0x16')][_0x5d6aae['name']],_0x5d6aae);_0x1ffb60['campaigns'][_0x5d6aae[_0x3e5b('0x27')]]['dialQueueProject']=_0x5d6aae[_0x3e5b('0x68')]?_0x5d6aae[_0x3e5b('0x68')][_0x3e5b('0x27')]:undefined;}}}return _0x1ffb60[_0x3e5b('0x16')];};};Realtime[_0x3e5b('0x3e')][_0x3e5b('0x69')]=function(){var _0x150bdf=this;return function(_0x350bd7){if(_0x350bd7){freeIsNotKey(_0x350bd7,_0x150bdf[_0x3e5b('0x18')],'id');for(var _0x119ded=0x0,_0x1299ac={};_0x119ded<_0x350bd7[_0x3e5b('0x41')];_0x119ded+=0x1){_0x1299ac=_0x350bd7[_0x119ded];if(_[_0x3e5b('0x40')](_0x150bdf['voiceExtensions'][_0x1299ac['id']])){_0x150bdf['voiceExtensions'][_0x1299ac['id']]=new VoiceExtension(_0x1299ac);}else{_0x150bdf[_0x3e5b('0x42')](_0x150bdf[_0x3e5b('0x18')][_0x1299ac['id']],_0x1299ac);}}}return _0x150bdf[_0x3e5b('0x18')];};};Realtime[_0x3e5b('0x3e')]['initCampaignHopperHistory']=function(){var _0x1590ce=this;return function(_0x54487f){clearCampaigns(_0x1590ce[_0x3e5b('0x16')]);for(var _0x52c77d=0x0;_0x52c77d<_0x54487f[_0x3e5b('0x41')];_0x52c77d+=0x1){_[_0x3e5b('0x56')](_0x1590ce[_0x3e5b('0x16')][_0x54487f[_0x52c77d][_0x3e5b('0x27')]],_0x54487f[_0x52c77d]);}return _0x1590ce[_0x3e5b('0x16')];};};Realtime[_0x3e5b('0x3e')][_0x3e5b('0x6a')]=function(){var _0x17242b=this;return function(_0x94e765){if(_0x94e765){freeIsNotKey(_0x94e765,_0x17242b['faxAccounts'],'id');for(var _0x57819a=0x0,_0x2ee814={},_0x4c81dc={};_0x57819a<_0x94e765[_0x3e5b('0x41')];_0x57819a+=0x1){_0x2ee814=_0x94e765[_0x57819a];if(_[_0x3e5b('0x40')](_0x17242b[_0x3e5b('0x6b')][_0x2ee814['id']])){_0x17242b[_0x3e5b('0x6b')][_0x2ee814['id']]=new FaxAccount(_0x2ee814);}else{_0x17242b[_0x3e5b('0x42')](_0x17242b[_0x3e5b('0x6b')][_0x2ee814['id']],_0x2ee814);}}}return _0x17242b[_0x3e5b('0x6b')];};};module[_0x3e5b('0x6c')]=Realtime;
\ No newline at end of file