Built motion from commit (unavailable).|2.4.4
[motion2.git] / server / services / ami / realtime / index.js
index 28f7fb6..97932bc 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc8bf=['../model/zendeskAccount','../model/salesforceAccount','../model/sugarcrmAccount','../model/deskAccount','../model/servicenowAccount','../model/faxAccount','agents','telephones','trunks','triggers','templates','outbound','voiceExtensions','channels','queueChannels','outboundChannels','timers','zendeskAccounts','salesforceAccounts','freshdeskAccounts','zohoAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','faxAccounts','mapKeys','hasOwnProperty','format','SIP/%s','name','isNil','interface','total','isEmpty','ivrAnswerCallsDay','answered','abandoned','sumHoldTime','sumBillable','outboundAnswerAgiCallsDay','outboundCongestionCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundRejectCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','mergeFromDatabase','length','isUndefined','initTelephones','initTrunks','initVoiceQueues','voiceQueues','initTriggers','initTemplates','initZohoAccounts','initDeskAccounts','deskAccounts','initSugarcrmAccounts','sugarcrmAccounts','initServicenowAccounts','initDynamics365Accounts','initVoiceQueueHopperHistory','initVoiceQueueReports','uniqueid','queue','queuecallerexit','unmanaged','queuecallerleaveAt','diff','queuecallerjoinAt','sumDuration','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','seconds','queuecallercomplete','initVoiceCallReports','duration','ANSWERED','initCampaigns','campaigns','initVoiceExtensions','merge','initFaxAccounts','bluebird','util','lodash','moment','../model/agent','../model/telephone','../model/trunk','../model/voiceQueue','../model/template','../model/campaign','../model/voiceExtension'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xc8bf,0x181));var _0xfc8b=function(_0x46a981,_0x2f8126){_0x46a981=_0x46a981-0x0;var _0x1540cd=_0xc8bf[_0x46a981];return _0x1540cd;};'use strict';var BPromise=require(_0xfc8b('0x0'));var util=require(_0xfc8b('0x1'));var _=require(_0xfc8b('0x2'));var moment=require(_0xfc8b('0x3'));var Agent=require(_0xfc8b('0x4'));var Telephone=require(_0xfc8b('0x5'));var Trunk=require(_0xfc8b('0x6'));var VoiceQueue=require(_0xfc8b('0x7'));var Trigger=require('../model/trigger');var Template=require(_0xfc8b('0x8'));var Campaign=require(_0xfc8b('0x9'));var VoiceExtension=require(_0xfc8b('0xa'));var ZendeskAccount=require(_0xfc8b('0xb'));var SalesforceAccount=require(_0xfc8b('0xc'));var FreshdeskAccount=require('../model/freshdeskAccount');var SugarcrmAccount=require(_0xfc8b('0xd'));var ZohoAccount=require('../model/zohoAccount');var DeskAccount=require(_0xfc8b('0xe'));var VtigerAccount=require('../model/vtigerAccount');var ServicenowAccount=require(_0xfc8b('0xf'));var Dynamics365Account=require('../model/dynamics365Account');var FaxAccount=require(_0xfc8b('0x10'));var Realtime=function(){this[_0xfc8b('0x11')]={};this[_0xfc8b('0x12')]={};this[_0xfc8b('0x13')]={};this['voiceQueues']={};this[_0xfc8b('0x14')]={};this['campaigns']={};this[_0xfc8b('0x15')]={};this[_0xfc8b('0x16')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xfc8b('0x17')]={};this[_0xfc8b('0x18')]={};this[_0xfc8b('0x19')]={};this[_0xfc8b('0x1a')]={};this[_0xfc8b('0x1b')]={};this[_0xfc8b('0x1c')]={};this[_0xfc8b('0x1d')]={};this['sugarcrmAccounts']={};this[_0xfc8b('0x1e')]={};this[_0xfc8b('0x1f')]={};this['deskAccounts']={};this[_0xfc8b('0x20')]={};this[_0xfc8b('0x21')]={};this[_0xfc8b('0x22')]={};this[_0xfc8b('0x23')]={};};function freeIsNotKey(_0x206039,_0x1a32a0,_0x4bfee8){var _0xdc5cd=_[_0xfc8b('0x24')](_0x206039,function(_0x5e2916,_0x33a944){return _0x5e2916[_0x4bfee8];});for(var _0x3e4bc5 in _0x1a32a0){if(_0x1a32a0[_0xfc8b('0x25')](_0x3e4bc5)){if(!_0xdc5cd[_0x3e4bc5]){delete _0x1a32a0[_0x3e4bc5];}}}}function freeIsNotKeySip(_0x49a80f,_0x1957df){var _0x3ef7c5=_['mapKeys'](_0x49a80f,function(_0xe61295,_0x3f256e){return util[_0xfc8b('0x26')](_0xfc8b('0x27'),_0xe61295[_0xfc8b('0x28')]);});for(var _0x4ce263 in _0x1957df){if(_0x1957df['hasOwnProperty'](_0x4ce263)){if(!_0x3ef7c5[_0x4ce263]){delete _0x1957df[_0x4ce263];}}}}function freeIsNotKeyAgent(_0x8af353,_0x348b06){var _0x3e0998=_[_0xfc8b('0x24')](_0x8af353,function(_0x349999,_0xc7c726){var _0x1da466=_[_0xfc8b('0x29')](_0x349999['interface'])?util['format'](_0xfc8b('0x27'),_0x349999['name']):_0x349999[_0xfc8b('0x2a')];return _0x1da466;});for(var _0x416f04 in _0x348b06){if(_0x348b06[_0xfc8b('0x25')](_0x416f04)){if(!_0x3e0998[_0x416f04]){delete _0x348b06[_0x416f04];}}}}function clearVoiceCallReports(_0x5cd101){_0x5cd101[_0xfc8b('0x2b')]=0x0;_0x5cd101['answered']=0x0;_0x5cd101['sumHoldTime']=0x0;_0x5cd101['sumDuration']=0x0;_0x5cd101['sumBillable']=0x0;}function clearCampaigns(_0x5345ed){if(!_[_0xfc8b('0x2c')](_0x5345ed)){for(var _0x29e056 in _0x5345ed){if(_0x5345ed[_0xfc8b('0x25')](_0x29e056)){_0x5345ed[_0x29e056]['ivrTotalCallsDays']=0x0;_0x5345ed[_0x29e056][_0xfc8b('0x2d')]=0x0;}}}}function clearVoiceQueues(_0x242106){if(!_[_0xfc8b('0x2c')](_0x242106)){for(var _0x7204db in _0x242106){if(_0x242106['hasOwnProperty'](_0x7204db)){_0x242106[_0x7204db][_0xfc8b('0x2b')]=0x0;_0x242106[_0x7204db][_0xfc8b('0x2e')]=0x0;_0x242106[_0x7204db]['unmanaged']=0x0;_0x242106[_0x7204db][_0xfc8b('0x2f')]=0x0;_0x242106[_0x7204db][_0xfc8b('0x30')]=0x0;_0x242106[_0x7204db]['sumDuration']=0x0;_0x242106[_0x7204db][_0xfc8b('0x31')]=0x0;_0x242106[_0x7204db][_0xfc8b('0x32')]=0x0;_0x242106[_0x7204db]['outboundNoAnswerCallsDay']=0x0;_0x242106[_0x7204db]['outboundBusyCallsDay']=0x0;_0x242106[_0x7204db][_0xfc8b('0x33')]=0x0;_0x242106[_0x7204db]['outboundNoSuchCallsDay']=0x0;_0x242106[_0x7204db][_0xfc8b('0x34')]=0x0;_0x242106[_0x7204db][_0xfc8b('0x35')]=0x0;_0x242106[_0x7204db][_0xfc8b('0x36')]=0x0;_0x242106[_0x7204db][_0xfc8b('0x37')]=0x0;_0x242106[_0x7204db]['outboundOriginateFailureCallsDay']=0x0;_0x242106[_0x7204db][_0xfc8b('0x38')]=0x0;_0x242106[_0x7204db]['outboundReCallsDay']=0x0;_0x242106[_0x7204db][_0xfc8b('0x32')]=0x0;_0x242106[_0x7204db][_0xfc8b('0x39')]=0x0;_0x242106[_0x7204db][_0xfc8b('0x3a')]=!![];}}}}Realtime[_0xfc8b('0x3b')][_0xfc8b('0x3c')]=function(_0x1cbb09,_0x4dcd68){for(var _0x51963a in _0x4dcd68){if(_0x1cbb09[_0xfc8b('0x25')](_0x51963a)){_0x1cbb09[_0x51963a]=_0x4dcd68[_0x51963a];}}};Realtime[_0xfc8b('0x3b')]['initAgents']=function(){var _0x117f45=this;return function(_0x5b62cf){if(_0x5b62cf){freeIsNotKeyAgent(_0x5b62cf,_0x117f45[_0xfc8b('0x11')]);for(var _0x591030=0x0,_0x134600={},_0x11c972={};_0x591030<_0x5b62cf[_0xfc8b('0x3d')];_0x591030+=0x1){_0x134600=_0x5b62cf[_0x591030];var _0x36f3a4=_[_0xfc8b('0x29')](_0x134600[_0xfc8b('0x2a')])?util[_0xfc8b('0x26')](_0xfc8b('0x27'),_0x134600['name']):_0x134600[_0xfc8b('0x2a')];if(_[_0xfc8b('0x3e')](_0x117f45['agents'][_0x36f3a4])){_0x117f45[_0xfc8b('0x11')][_0x36f3a4]=new Agent(_0x134600);}else{_0x117f45[_0xfc8b('0x3c')](_0x117f45[_0xfc8b('0x11')][_0x36f3a4],_0x134600);}}}return _0x117f45['agents'];};};Realtime['prototype'][_0xfc8b('0x3f')]=function(){var _0x2ca818=this;return function(_0x1a1019){if(_0x1a1019){freeIsNotKeySip(_0x1a1019,_0x2ca818['telephones']);for(var _0x32bd86=0x0,_0x11fb3b={},_0x16b11c={};_0x32bd86<_0x1a1019[_0xfc8b('0x3d')];_0x32bd86+=0x1){_0x11fb3b=_0x1a1019[_0x32bd86];if(_['isUndefined'](_0x2ca818[_0xfc8b('0x12')][util[_0xfc8b('0x26')](_0xfc8b('0x27'),_0x11fb3b[_0xfc8b('0x28')])])){_0x2ca818[_0xfc8b('0x12')][util[_0xfc8b('0x26')]('SIP/%s',_0x11fb3b[_0xfc8b('0x28')])]=new Telephone(_0x11fb3b);}else{_0x2ca818['mergeFromDatabase'](_0x2ca818[_0xfc8b('0x12')][util[_0xfc8b('0x26')](_0xfc8b('0x27'),_0x11fb3b['name'])],_0x11fb3b);}}}return _0x2ca818[_0xfc8b('0x12')];};};Realtime['prototype'][_0xfc8b('0x40')]=function(){var _0x4ffc3d=this;return function(_0x493074){if(_0x493074){freeIsNotKeySip(_0x493074,_0x4ffc3d[_0xfc8b('0x13')]);for(var _0x2eb0d5=0x0,_0x5f4718={},_0x4ca744={};_0x2eb0d5<_0x493074[_0xfc8b('0x3d')];_0x2eb0d5+=0x1){_0x5f4718=_0x493074[_0x2eb0d5];if(_[_0xfc8b('0x3e')](_0x4ffc3d[_0xfc8b('0x13')][util[_0xfc8b('0x26')](_0xfc8b('0x27'),_0x5f4718[_0xfc8b('0x28')])])){_0x4ffc3d[_0xfc8b('0x13')][util['format'](_0xfc8b('0x27'),_0x5f4718['name'])]=new Trunk(_0x5f4718);}else{_0x4ffc3d[_0xfc8b('0x3c')](_0x4ffc3d[_0xfc8b('0x13')][util['format'](_0xfc8b('0x27'),_0x5f4718[_0xfc8b('0x28')])],_0x5f4718);}}}return _0x4ffc3d['trunks'];};};Realtime['prototype'][_0xfc8b('0x41')]=function(){var _0x298c8d=this;return function(_0x4ce14b){if(_0x4ce14b){freeIsNotKey(_0x4ce14b,_0x298c8d['voiceQueues'],_0xfc8b('0x28'));for(var _0x29e612=0x0,_0xe193f5={},_0x3be527={};_0x29e612<_0x4ce14b[_0xfc8b('0x3d')];_0x29e612+=0x1){_0xe193f5=_0x4ce14b[_0x29e612];if(_[_0xfc8b('0x3e')](_0x298c8d[_0xfc8b('0x42')][_0xe193f5[_0xfc8b('0x28')]])){_0x298c8d['voiceQueues'][_0xe193f5[_0xfc8b('0x28')]]=new VoiceQueue(_0xe193f5);}else{_0x298c8d['mergeFromDatabase'](_0x298c8d[_0xfc8b('0x42')][_0xe193f5[_0xfc8b('0x28')]],_0xe193f5);}}}return _0x298c8d[_0xfc8b('0x42')];};};Realtime[_0xfc8b('0x3b')][_0xfc8b('0x43')]=function(){var _0x55470f=this;return function(_0x5807e6){if(_0x5807e6){freeIsNotKey(_0x5807e6,_0x55470f[_0xfc8b('0x14')],'id');for(var _0xd1a4a0=0x0,_0x4d7ac={},_0x2a858a={};_0xd1a4a0<_0x5807e6['length'];_0xd1a4a0+=0x1){_0x4d7ac=_0x5807e6[_0xd1a4a0];if(_[_0xfc8b('0x3e')](_0x55470f['triggers'][_0x4d7ac['id']])){_0x55470f[_0xfc8b('0x14')][_0x4d7ac['id']]=new Trigger(_0x4d7ac);}else{_0x55470f['mergeFromDatabase'](_0x55470f[_0xfc8b('0x14')][_0x4d7ac['id']],_0x4d7ac);}}}return _0x55470f[_0xfc8b('0x14')];};};Realtime[_0xfc8b('0x3b')][_0xfc8b('0x44')]=function(){var _0x178b6a=this;return function(_0x19146a){if(_0x19146a){freeIsNotKey(_0x19146a,_0x178b6a[_0xfc8b('0x15')],'id');for(var _0x102ffc=0x0,_0x542466={},_0x4aa1fa={};_0x102ffc<_0x19146a[_0xfc8b('0x3d')];_0x102ffc+=0x1){_0x542466=_0x19146a[_0x102ffc];if(_[_0xfc8b('0x3e')](_0x178b6a[_0xfc8b('0x15')][_0x542466['id']])){_0x178b6a[_0xfc8b('0x15')][_0x542466['id']]=new Template(_0x542466);}else{_0x178b6a[_0xfc8b('0x3c')](_0x178b6a[_0xfc8b('0x15')][_0x542466['id']],_0x542466);}}}return _0x178b6a[_0xfc8b('0x15')];};};Realtime[_0xfc8b('0x3b')]['initZendeskAccounts']=function(){var _0x20fc8b=this;return function(_0x48056f){if(_0x48056f){freeIsNotKey(_0x48056f,_0x20fc8b[_0xfc8b('0x1c')],'id');for(var _0x235ecd=0x0,_0x28c8a2={},_0x4acbb7={};_0x235ecd<_0x48056f[_0xfc8b('0x3d')];_0x235ecd+=0x1){_0x28c8a2=_0x48056f[_0x235ecd];if(_['isUndefined'](_0x20fc8b[_0xfc8b('0x1c')][_0x28c8a2['id']])){_0x20fc8b[_0xfc8b('0x1c')][_0x28c8a2['id']]=new ZendeskAccount(_0x28c8a2);}else{_0x20fc8b['mergeFromDatabase'](_0x20fc8b['zendeskAccounts'][_0x28c8a2['id']],_0x28c8a2);}}}return _0x20fc8b[_0xfc8b('0x1c')];};};Realtime[_0xfc8b('0x3b')]['initSalesforceAccounts']=function(){var _0x1fa50b=this;return function(_0x5b73c9){if(_0x5b73c9){freeIsNotKey(_0x5b73c9,_0x1fa50b[_0xfc8b('0x1d')],'id');for(var _0x33c606=0x0,_0x234b5e={},_0x5d92bf={};_0x33c606<_0x5b73c9[_0xfc8b('0x3d')];_0x33c606+=0x1){_0x234b5e=_0x5b73c9[_0x33c606];if(_['isUndefined'](_0x1fa50b[_0xfc8b('0x1d')][_0x234b5e['id']])){_0x1fa50b[_0xfc8b('0x1d')][_0x234b5e['id']]=new SalesforceAccount(_0x234b5e);}else{_0x1fa50b['mergeFromDatabase'](_0x1fa50b[_0xfc8b('0x1d')][_0x234b5e['id']],_0x234b5e);}}}return _0x1fa50b[_0xfc8b('0x1d')];};};Realtime[_0xfc8b('0x3b')]['initFreshdeskAccounts']=function(){var _0x3a4efb=this;return function(_0x1e25d6){if(_0x1e25d6){freeIsNotKey(_0x1e25d6,_0x3a4efb['freshdeskAccounts'],'id');for(var _0x4440d7=0x0,_0x5853d8={},_0x54c7c0={};_0x4440d7<_0x1e25d6[_0xfc8b('0x3d')];_0x4440d7+=0x1){_0x5853d8=_0x1e25d6[_0x4440d7];if(_['isUndefined'](_0x3a4efb[_0xfc8b('0x1e')][_0x5853d8['id']])){_0x3a4efb[_0xfc8b('0x1e')][_0x5853d8['id']]=new FreshdeskAccount(_0x5853d8);}else{_0x3a4efb[_0xfc8b('0x3c')](_0x3a4efb[_0xfc8b('0x1e')][_0x5853d8['id']],_0x5853d8);}}}return _0x3a4efb[_0xfc8b('0x1e')];};};Realtime['prototype'][_0xfc8b('0x45')]=function(){var _0xf33845=this;return function(_0x31ba99){if(_0x31ba99){freeIsNotKey(_0x31ba99,_0xf33845[_0xfc8b('0x1f')],'id');for(var _0x2bdbf2=0x0,_0x20a0a5={},_0x342612={};_0x2bdbf2<_0x31ba99[_0xfc8b('0x3d')];_0x2bdbf2+=0x1){_0x20a0a5=_0x31ba99[_0x2bdbf2];if(_[_0xfc8b('0x3e')](_0xf33845[_0xfc8b('0x1f')][_0x20a0a5['id']])){_0xf33845[_0xfc8b('0x1f')][_0x20a0a5['id']]=new ZohoAccount(_0x20a0a5);}else{_0xf33845[_0xfc8b('0x3c')](_0xf33845[_0xfc8b('0x1f')][_0x20a0a5['id']],_0x20a0a5);}}}return _0xf33845[_0xfc8b('0x1f')];};};Realtime[_0xfc8b('0x3b')][_0xfc8b('0x46')]=function(){var _0x70816e=this;return function(_0x32a9f8){if(_0x32a9f8){freeIsNotKey(_0x32a9f8,_0x70816e['deskAccounts'],'id');for(var _0x5183c=0x0,_0x388e0a={},_0x5bb06e={};_0x5183c<_0x32a9f8[_0xfc8b('0x3d')];_0x5183c+=0x1){_0x388e0a=_0x32a9f8[_0x5183c];if(_[_0xfc8b('0x3e')](_0x70816e[_0xfc8b('0x47')][_0x388e0a['id']])){_0x70816e[_0xfc8b('0x47')][_0x388e0a['id']]=new DeskAccount(_0x388e0a);}else{_0x70816e['mergeFromDatabase'](_0x70816e[_0xfc8b('0x47')][_0x388e0a['id']],_0x388e0a);}}}return _0x70816e[_0xfc8b('0x47')];};};Realtime['prototype'][_0xfc8b('0x48')]=function(){var _0x32e078=this;return function(_0x48185c){if(_0x48185c){freeIsNotKey(_0x48185c,_0x32e078[_0xfc8b('0x49')],'id');for(var _0x581f71=0x0,_0xd26530={},_0x5eb58f={};_0x581f71<_0x48185c[_0xfc8b('0x3d')];_0x581f71+=0x1){_0xd26530=_0x48185c[_0x581f71];if(_[_0xfc8b('0x3e')](_0x32e078[_0xfc8b('0x49')][_0xd26530['id']])){_0x32e078['sugarcrmAccounts'][_0xd26530['id']]=new SugarcrmAccount(_0xd26530);}else{_0x32e078['mergeFromDatabase'](_0x32e078[_0xfc8b('0x49')][_0xd26530['id']],_0xd26530);}}}return _0x32e078[_0xfc8b('0x49')];};};Realtime[_0xfc8b('0x3b')]['initVtigerAccounts']=function(){var _0x37858e=this;return function(_0x589e12){if(_0x589e12){freeIsNotKey(_0x589e12,_0x37858e['vtigerAccounts'],'id');for(var _0x41e161=0x0,_0x7870c0={},_0x409fb5={};_0x41e161<_0x589e12[_0xfc8b('0x3d')];_0x41e161+=0x1){_0x7870c0=_0x589e12[_0x41e161];if(_['isUndefined'](_0x37858e['vtigerAccounts'][_0x7870c0['id']])){_0x37858e[_0xfc8b('0x20')][_0x7870c0['id']]=new VtigerAccount(_0x7870c0);}else{_0x37858e[_0xfc8b('0x3c')](_0x37858e['vtigerAccounts'][_0x7870c0['id']],_0x7870c0);}}}return _0x37858e[_0xfc8b('0x20')];};};Realtime[_0xfc8b('0x3b')][_0xfc8b('0x4a')]=function(){var _0x2aa5dc=this;return function(_0x4d4db7){if(_0x4d4db7){freeIsNotKey(_0x4d4db7,_0x2aa5dc[_0xfc8b('0x21')],'id');for(var _0xc46689=0x0,_0x27c2a8={},_0x1f4d41={};_0xc46689<_0x4d4db7['length'];_0xc46689+=0x1){_0x27c2a8=_0x4d4db7[_0xc46689];if(_[_0xfc8b('0x3e')](_0x2aa5dc[_0xfc8b('0x21')][_0x27c2a8['id']])){_0x2aa5dc[_0xfc8b('0x21')][_0x27c2a8['id']]=new ServicenowAccount(_0x27c2a8);}else{_0x2aa5dc[_0xfc8b('0x3c')](_0x2aa5dc['servicenowAccounts'][_0x27c2a8['id']],_0x27c2a8);}}}return _0x2aa5dc['servicenowAccounts'];};};Realtime[_0xfc8b('0x3b')][_0xfc8b('0x4b')]=function(){var _0x6b42a=this;return function(_0x3a389a){if(_0x3a389a){freeIsNotKey(_0x3a389a,_0x6b42a[_0xfc8b('0x22')],'id');for(var _0x9084a4=0x0,_0x33f4a0={},_0x289eaa={};_0x9084a4<_0x3a389a[_0xfc8b('0x3d')];_0x9084a4+=0x1){_0x33f4a0=_0x3a389a[_0x9084a4];if(_[_0xfc8b('0x3e')](_0x6b42a[_0xfc8b('0x22')][_0x33f4a0['id']])){_0x6b42a[_0xfc8b('0x22')][_0x33f4a0['id']]=new Dynamics365Account(_0x33f4a0);}else{_0x6b42a[_0xfc8b('0x3c')](_0x6b42a[_0xfc8b('0x22')][_0x33f4a0['id']],_0x33f4a0);}}}return _0x6b42a[_0xfc8b('0x22')];};};Realtime[_0xfc8b('0x3b')][_0xfc8b('0x4c')]=function(){var _0x575c5=this;return function(_0x9c8908){for(var _0x19532d=0x0;_0x19532d<_0x9c8908['length'];_0x19532d+=0x1){_['merge'](_0x575c5[_0xfc8b('0x42')][_0x9c8908[_0x19532d][_0xfc8b('0x28')]],_0x9c8908[_0x19532d]);}return _0x575c5[_0xfc8b('0x42')];};};Realtime['prototype'][_0xfc8b('0x4d')]=function(){var _0x47a294=this;return function(_0xc30672){clearVoiceQueues(_0x47a294[_0xfc8b('0x42')]);if(_0xc30672){_0xc30672=_['groupBy'](_0xc30672,_0xfc8b('0x4e'));for(var _0x1607ed in _0xc30672){if(_0xc30672['hasOwnProperty'](_0x1607ed)){var _0x5108d4={};for(var _0x524585=0x0;_0x524585<_0xc30672[_0x1607ed][_0xfc8b('0x3d')];_0x524585+=0x1){var _0x3b1473=_0xc30672[_0x1607ed][_0x524585][_0xfc8b('0x4f')];if(_0x47a294[_0xfc8b('0x42')][_0x3b1473]){if(_0xc30672[_0x1607ed][_0x524585][_0xfc8b('0x50')]){_0x47a294[_0xfc8b('0x42')][_0x3b1473][_0xfc8b('0x51')]+=0x1;}if(_0xc30672[_0x1607ed][_0x524585]['queuecallerabandon']){_0x47a294[_0xfc8b('0x42')][_0x3b1473]['abandoned']+=0x1;}_0x47a294[_0xfc8b('0x42')][_0x3b1473][_0xfc8b('0x30')]+=moment(_0xc30672[_0x1607ed][_0x524585][_0xfc8b('0x52')])[_0xfc8b('0x53')](moment(_0xc30672[_0x1607ed][_0x524585][_0xfc8b('0x54')]),'seconds')||0x0;if(_0x524585===_0xc30672[_0x1607ed][_0xfc8b('0x3d')]-0x1){_0x47a294[_0xfc8b('0x42')][_0x3b1473][_0xfc8b('0x55')]+=moment(_0xc30672[_0x1607ed][_0x524585][_0xfc8b('0x56')]||_0xc30672[_0x1607ed][_0x524585][_0xfc8b('0x57')]||_0xc30672[_0x1607ed][_0x524585][_0xfc8b('0x58')])[_0xfc8b('0x53')](moment(_0xc30672[_0x1607ed][_0x524585][_0xfc8b('0x54')]),_0xfc8b('0x59'))||0x0;_0x47a294[_0xfc8b('0x42')][_0x3b1473][_0xfc8b('0x2b')]+=0x1;if(_0xc30672[_0x1607ed][_0x524585][_0xfc8b('0x5a')]){_0x47a294[_0xfc8b('0x42')][_0x3b1473][_0xfc8b('0x2e')]+=0x1;_0x47a294[_0xfc8b('0x42')][_0x3b1473][_0xfc8b('0x31')]+=moment(_0xc30672[_0x1607ed][_0x524585][_0xfc8b('0x56')])[_0xfc8b('0x53')](moment(_0xc30672[_0x1607ed][_0x524585]['queuecallerleaveAt']),'seconds')||0x0;}}else{_0x47a294[_0xfc8b('0x42')][_0x3b1473]['sumDuration']+=_0x47a294[_0xfc8b('0x42')][_0x3b1473][_0xfc8b('0x30')]||0x0;}}}}}}return _0x47a294[_0xfc8b('0x42')];};};Realtime[_0xfc8b('0x3b')][_0xfc8b('0x5b')]=function(){var _0x5bcbb9=this;return function(_0x302894){clearVoiceCallReports(_0x5bcbb9[_0xfc8b('0x16')]);if(_0x302894){for(var _0x4656fe=0x0;_0x4656fe<_0x302894[_0xfc8b('0x3d')];_0x4656fe+=0x1){_0x5bcbb9[_0xfc8b('0x16')]['total']+=0x1;_0x5bcbb9[_0xfc8b('0x16')]['sumDuration']+=_0x302894[_0x4656fe][_0xfc8b('0x5c')];if(_0x302894[_0x4656fe]['disposition']===_0xfc8b('0x5d')){_0x5bcbb9[_0xfc8b('0x16')][_0xfc8b('0x2e')]+=0x1;_0x5bcbb9[_0xfc8b('0x16')][_0xfc8b('0x30')]+=_0x302894[_0x4656fe][_0xfc8b('0x5c')]-_0x302894[_0x4656fe]['billableseconds']||0x0;_0x5bcbb9[_0xfc8b('0x16')]['sumBillable']+=_0x302894[_0x4656fe]['billableseconds'];}}}return _0x5bcbb9[_0xfc8b('0x16')];};};Realtime['prototype'][_0xfc8b('0x5e')]=function(){var _0x906f42=this;return function(_0x4a9c0c){if(_0x4a9c0c){freeIsNotKey(_0x4a9c0c,_0x906f42['campaigns'],_0xfc8b('0x28'));for(var _0x1e7cb4=0x0,_0x22c935={};_0x1e7cb4<_0x4a9c0c[_0xfc8b('0x3d')];_0x1e7cb4+=0x1){_0x22c935=_0x4a9c0c[_0x1e7cb4];if(_[_0xfc8b('0x3e')](_0x906f42[_0xfc8b('0x5f')][_0x22c935['name']])){_0x906f42[_0xfc8b('0x5f')][_0x22c935[_0xfc8b('0x28')]]=new Campaign(_0x22c935);}else{_0x906f42[_0xfc8b('0x3c')](_0x906f42['campaigns'][_0x22c935[_0xfc8b('0x28')]],_0x22c935);}}}return _0x906f42[_0xfc8b('0x5f')];};};Realtime['prototype'][_0xfc8b('0x60')]=function(){var _0x1813ab=this;return function(_0x13b65e){if(_0x13b65e){freeIsNotKey(_0x13b65e,_0x1813ab['voiceExtensions'],'id');for(var _0x3b33ab=0x0,_0x33b9c2={};_0x3b33ab<_0x13b65e['length'];_0x3b33ab+=0x1){_0x33b9c2=_0x13b65e[_0x3b33ab];if(_[_0xfc8b('0x3e')](_0x1813ab[_0xfc8b('0x17')][_0x33b9c2['id']])){_0x1813ab[_0xfc8b('0x17')][_0x33b9c2['id']]=new VoiceExtension(_0x33b9c2);}else{_0x1813ab[_0xfc8b('0x3c')](_0x1813ab[_0xfc8b('0x17')][_0x33b9c2['id']],_0x33b9c2);}}}return _0x1813ab[_0xfc8b('0x17')];};};Realtime[_0xfc8b('0x3b')]['initCampaignHopperHistory']=function(){var _0x3578d5=this;return function(_0x5ab672){clearCampaigns(_0x3578d5['campaigns']);for(var _0x1fbb2b=0x0;_0x1fbb2b<_0x5ab672['length'];_0x1fbb2b+=0x1){_[_0xfc8b('0x61')](_0x3578d5[_0xfc8b('0x5f')][_0x5ab672[_0x1fbb2b][_0xfc8b('0x28')]],_0x5ab672[_0x1fbb2b]);}return _0x3578d5['campaigns'];};};Realtime[_0xfc8b('0x3b')][_0xfc8b('0x62')]=function(){var _0x59d33d=this;return function(_0x5e1df6){if(_0x5e1df6){freeIsNotKey(_0x5e1df6,_0x59d33d[_0xfc8b('0x23')],'id');for(var _0x3615d6=0x0,_0x494c6f={},_0x5c4fe9={};_0x3615d6<_0x5e1df6[_0xfc8b('0x3d')];_0x3615d6+=0x1){_0x494c6f=_0x5e1df6[_0x3615d6];if(_[_0xfc8b('0x3e')](_0x59d33d[_0xfc8b('0x23')][_0x494c6f['id']])){_0x59d33d[_0xfc8b('0x23')][_0x494c6f['id']]=new FaxAccount(_0x494c6f);}else{_0x59d33d[_0xfc8b('0x3c')](_0x59d33d['faxAccounts'][_0x494c6f['id']],_0x494c6f);}}}return _0x59d33d[_0xfc8b('0x23')];};};module['exports']=Realtime;
\ No newline at end of file
+var _0x35bc=['sumBillable','isEmpty','ivrAnswerCallsDay','total','unmanaged','abandoned','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','prototype','mergeFromDatabase','initAgents','length','isUndefined','initTrunks','initVoiceQueues','initTriggers','triggers','initTemplates','initSalesforceAccounts','initFreshdeskAccounts','initZohoAccounts','zohoAccounts','initDeskAccounts','deskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','servicenowAccounts','initDynamics365Accounts','initVoiceQueueHopperHistory','merge','groupBy','queue','queuecallerexit','queuecallerabandon','sumHoldTime','queuecallerleaveAt','queuecallerjoinAt','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','diff','seconds','queuecallercomplete','outbound','disposition','ANSWERED','duration','billableseconds','initVoiceExtensions','initCampaignHopperHistory','bluebird','util','lodash','moment','../model/agent','../model/telephone','../model/trunk','../model/voiceQueue','../model/template','../model/campaign','../model/zendeskAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/faxAccount','agents','telephones','trunks','voiceQueues','campaigns','templates','voiceExtensions','channels','queueChannels','outboundChannels','timers','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','vtigerAccounts','dynamics365Accounts','faxAccounts','mapKeys','hasOwnProperty','format','SIP/%s','name','isNil','interface','answered','sumDuration'];(function(_0x5ecba6,_0x48111e){var _0xbbca0c=function(_0x45ed9d){while(--_0x45ed9d){_0x5ecba6['push'](_0x5ecba6['shift']());}};_0xbbca0c(++_0x48111e);}(_0x35bc,0xa5));var _0xc35b=function(_0x57bb3a,_0x237ede){_0x57bb3a=_0x57bb3a-0x0;var _0x5decaa=_0x35bc[_0x57bb3a];return _0x5decaa;};'use strict';var BPromise=require(_0xc35b('0x0'));var util=require(_0xc35b('0x1'));var _=require(_0xc35b('0x2'));var moment=require(_0xc35b('0x3'));var Agent=require(_0xc35b('0x4'));var Telephone=require(_0xc35b('0x5'));var Trunk=require(_0xc35b('0x6'));var VoiceQueue=require(_0xc35b('0x7'));var Trigger=require('../model/trigger');var Template=require(_0xc35b('0x8'));var Campaign=require(_0xc35b('0x9'));var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require(_0xc35b('0xa'));var SalesforceAccount=require('../model/salesforceAccount');var FreshdeskAccount=require('../model/freshdeskAccount');var SugarcrmAccount=require('../model/sugarcrmAccount');var ZohoAccount=require('../model/zohoAccount');var DeskAccount=require(_0xc35b('0xb'));var VtigerAccount=require(_0xc35b('0xc'));var ServicenowAccount=require(_0xc35b('0xd'));var Dynamics365Account=require(_0xc35b('0xe'));var FaxAccount=require(_0xc35b('0xf'));var Realtime=function(){this[_0xc35b('0x10')]={};this[_0xc35b('0x11')]={};this[_0xc35b('0x12')]={};this[_0xc35b('0x13')]={};this['triggers']={};this[_0xc35b('0x14')]={};this[_0xc35b('0x15')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xc35b('0x16')]={};this[_0xc35b('0x17')]={};this[_0xc35b('0x18')]={};this[_0xc35b('0x19')]={};this[_0xc35b('0x1a')]={};this[_0xc35b('0x1b')]={};this[_0xc35b('0x1c')]={};this[_0xc35b('0x1d')]={};this[_0xc35b('0x1e')]={};this['zohoAccounts']={};this['deskAccounts']={};this[_0xc35b('0x1f')]={};this['servicenowAccounts']={};this[_0xc35b('0x20')]={};this[_0xc35b('0x21')]={};};function freeIsNotKey(_0x513f74,_0x4250d9,_0x5b71e3){var _0x3eaadf=_[_0xc35b('0x22')](_0x513f74,function(_0x7c34b9,_0x4fdbf1){return _0x7c34b9[_0x5b71e3];});for(var _0x554680 in _0x4250d9){if(_0x4250d9[_0xc35b('0x23')](_0x554680)){if(!_0x3eaadf[_0x554680]){delete _0x4250d9[_0x554680];}}}}function freeIsNotKeySip(_0x143b83,_0x304697){var _0x2d32a1=_[_0xc35b('0x22')](_0x143b83,function(_0x26f09d,_0x17df58){return util[_0xc35b('0x24')](_0xc35b('0x25'),_0x26f09d[_0xc35b('0x26')]);});for(var _0x56cb90 in _0x304697){if(_0x304697[_0xc35b('0x23')](_0x56cb90)){if(!_0x2d32a1[_0x56cb90]){delete _0x304697[_0x56cb90];}}}}function freeIsNotKeyAgent(_0x2ba1b5,_0x42a483){var _0x55a3e7=_['mapKeys'](_0x2ba1b5,function(_0x5565c0,_0x5898ea){var _0x44cb53=_[_0xc35b('0x27')](_0x5565c0[_0xc35b('0x28')])?util[_0xc35b('0x24')](_0xc35b('0x25'),_0x5565c0[_0xc35b('0x26')]):_0x5565c0[_0xc35b('0x28')];return _0x44cb53;});for(var _0x1bf224 in _0x42a483){if(_0x42a483[_0xc35b('0x23')](_0x1bf224)){if(!_0x55a3e7[_0x1bf224]){delete _0x42a483[_0x1bf224];}}}}function clearVoiceCallReports(_0x3a3f00){_0x3a3f00['total']=0x0;_0x3a3f00[_0xc35b('0x29')]=0x0;_0x3a3f00['sumHoldTime']=0x0;_0x3a3f00[_0xc35b('0x2a')]=0x0;_0x3a3f00[_0xc35b('0x2b')]=0x0;}function clearCampaigns(_0x2fe29e){if(!_[_0xc35b('0x2c')](_0x2fe29e)){for(var _0xd9b739 in _0x2fe29e){if(_0x2fe29e[_0xc35b('0x23')](_0xd9b739)){_0x2fe29e[_0xd9b739]['ivrTotalCallsDays']=0x0;_0x2fe29e[_0xd9b739][_0xc35b('0x2d')]=0x0;}}}}function clearVoiceQueues(_0x2ebcae){if(!_[_0xc35b('0x2c')](_0x2ebcae)){for(var _0x2b655c in _0x2ebcae){if(_0x2ebcae['hasOwnProperty'](_0x2b655c)){_0x2ebcae[_0x2b655c][_0xc35b('0x2e')]=0x0;_0x2ebcae[_0x2b655c]['answered']=0x0;_0x2ebcae[_0x2b655c][_0xc35b('0x2f')]=0x0;_0x2ebcae[_0x2b655c][_0xc35b('0x30')]=0x0;_0x2ebcae[_0x2b655c]['sumHoldTime']=0x0;_0x2ebcae[_0x2b655c][_0xc35b('0x2a')]=0x0;_0x2ebcae[_0x2b655c][_0xc35b('0x2b')]=0x0;_0x2ebcae[_0x2b655c][_0xc35b('0x31')]=0x0;_0x2ebcae[_0x2b655c][_0xc35b('0x32')]=0x0;_0x2ebcae[_0x2b655c][_0xc35b('0x33')]=0x0;_0x2ebcae[_0x2b655c][_0xc35b('0x34')]=0x0;_0x2ebcae[_0x2b655c]['outboundNoSuchCallsDay']=0x0;_0x2ebcae[_0x2b655c][_0xc35b('0x35')]=0x0;_0x2ebcae[_0x2b655c][_0xc35b('0x36')]=0x0;_0x2ebcae[_0x2b655c][_0xc35b('0x37')]=0x0;_0x2ebcae[_0x2b655c][_0xc35b('0x38')]=0x0;_0x2ebcae[_0x2b655c][_0xc35b('0x39')]=0x0;_0x2ebcae[_0x2b655c][_0xc35b('0x3a')]=0x0;_0x2ebcae[_0x2b655c][_0xc35b('0x3b')]=0x0;_0x2ebcae[_0x2b655c][_0xc35b('0x31')]=0x0;_0x2ebcae[_0x2b655c][_0xc35b('0x3c')]=0x0;_0x2ebcae[_0x2b655c]['queueStatusComplete']=!![];}}}}Realtime[_0xc35b('0x3d')][_0xc35b('0x3e')]=function(_0x41f424,_0x3fa26b){for(var _0x386f7e in _0x3fa26b){if(_0x41f424['hasOwnProperty'](_0x386f7e)){_0x41f424[_0x386f7e]=_0x3fa26b[_0x386f7e];}}};Realtime[_0xc35b('0x3d')][_0xc35b('0x3f')]=function(){var _0x13d9f7=this;return function(_0x54cb1b){if(_0x54cb1b){freeIsNotKeyAgent(_0x54cb1b,_0x13d9f7['agents']);for(var _0x49b7b1=0x0,_0x13a660={},_0x3fe14c={};_0x49b7b1<_0x54cb1b[_0xc35b('0x40')];_0x49b7b1+=0x1){_0x13a660=_0x54cb1b[_0x49b7b1];var _0x2d4906=_[_0xc35b('0x27')](_0x13a660[_0xc35b('0x28')])?util['format'](_0xc35b('0x25'),_0x13a660[_0xc35b('0x26')]):_0x13a660[_0xc35b('0x28')];if(_[_0xc35b('0x41')](_0x13d9f7[_0xc35b('0x10')][_0x2d4906])){_0x13d9f7[_0xc35b('0x10')][_0x2d4906]=new Agent(_0x13a660);}else{_0x13d9f7[_0xc35b('0x3e')](_0x13d9f7[_0xc35b('0x10')][_0x2d4906],_0x13a660);}}}return _0x13d9f7[_0xc35b('0x10')];};};Realtime[_0xc35b('0x3d')]['initTelephones']=function(){var _0x28081b=this;return function(_0x52e5dd){if(_0x52e5dd){freeIsNotKeySip(_0x52e5dd,_0x28081b[_0xc35b('0x11')]);for(var _0x3c9c76=0x0,_0x2df8b8={},_0x49050f={};_0x3c9c76<_0x52e5dd[_0xc35b('0x40')];_0x3c9c76+=0x1){_0x2df8b8=_0x52e5dd[_0x3c9c76];if(_['isUndefined'](_0x28081b[_0xc35b('0x11')][util['format'](_0xc35b('0x25'),_0x2df8b8[_0xc35b('0x26')])])){_0x28081b[_0xc35b('0x11')][util[_0xc35b('0x24')](_0xc35b('0x25'),_0x2df8b8[_0xc35b('0x26')])]=new Telephone(_0x2df8b8);}else{_0x28081b[_0xc35b('0x3e')](_0x28081b[_0xc35b('0x11')][util[_0xc35b('0x24')](_0xc35b('0x25'),_0x2df8b8[_0xc35b('0x26')])],_0x2df8b8);}}}return _0x28081b['telephones'];};};Realtime[_0xc35b('0x3d')][_0xc35b('0x42')]=function(){var _0x3c91a0=this;return function(_0x537f72){if(_0x537f72){freeIsNotKeySip(_0x537f72,_0x3c91a0[_0xc35b('0x12')]);for(var _0x200e61=0x0,_0x2d6550={},_0x17df19={};_0x200e61<_0x537f72['length'];_0x200e61+=0x1){_0x2d6550=_0x537f72[_0x200e61];if(_[_0xc35b('0x41')](_0x3c91a0['trunks'][util[_0xc35b('0x24')](_0xc35b('0x25'),_0x2d6550['name'])])){_0x3c91a0[_0xc35b('0x12')][util[_0xc35b('0x24')](_0xc35b('0x25'),_0x2d6550[_0xc35b('0x26')])]=new Trunk(_0x2d6550);}else{_0x3c91a0[_0xc35b('0x3e')](_0x3c91a0[_0xc35b('0x12')][util[_0xc35b('0x24')](_0xc35b('0x25'),_0x2d6550[_0xc35b('0x26')])],_0x2d6550);}}}return _0x3c91a0[_0xc35b('0x12')];};};Realtime[_0xc35b('0x3d')][_0xc35b('0x43')]=function(){var _0x4cc5f4=this;return function(_0xda2349){if(_0xda2349){freeIsNotKey(_0xda2349,_0x4cc5f4[_0xc35b('0x13')],_0xc35b('0x26'));for(var _0x1e42ac=0x0,_0x2f4dfe={},_0x2d2632={};_0x1e42ac<_0xda2349['length'];_0x1e42ac+=0x1){_0x2f4dfe=_0xda2349[_0x1e42ac];if(_[_0xc35b('0x41')](_0x4cc5f4[_0xc35b('0x13')][_0x2f4dfe[_0xc35b('0x26')]])){_0x4cc5f4[_0xc35b('0x13')][_0x2f4dfe[_0xc35b('0x26')]]=new VoiceQueue(_0x2f4dfe);}else{_0x4cc5f4[_0xc35b('0x3e')](_0x4cc5f4[_0xc35b('0x13')][_0x2f4dfe[_0xc35b('0x26')]],_0x2f4dfe);}}}return _0x4cc5f4['voiceQueues'];};};Realtime[_0xc35b('0x3d')][_0xc35b('0x44')]=function(){var _0x8ba8e8=this;return function(_0x1bf55c){if(_0x1bf55c){freeIsNotKey(_0x1bf55c,_0x8ba8e8[_0xc35b('0x45')],'id');for(var _0x3b9ceb=0x0,_0x5db5a8={},_0x31acdc={};_0x3b9ceb<_0x1bf55c['length'];_0x3b9ceb+=0x1){_0x5db5a8=_0x1bf55c[_0x3b9ceb];if(_[_0xc35b('0x41')](_0x8ba8e8[_0xc35b('0x45')][_0x5db5a8['id']])){_0x8ba8e8[_0xc35b('0x45')][_0x5db5a8['id']]=new Trigger(_0x5db5a8);}else{_0x8ba8e8[_0xc35b('0x3e')](_0x8ba8e8[_0xc35b('0x45')][_0x5db5a8['id']],_0x5db5a8);}}}return _0x8ba8e8['triggers'];};};Realtime[_0xc35b('0x3d')][_0xc35b('0x46')]=function(){var _0x5486a4=this;return function(_0xc0b1c1){if(_0xc0b1c1){freeIsNotKey(_0xc0b1c1,_0x5486a4[_0xc35b('0x15')],'id');for(var _0x52552f=0x0,_0x7fc46e={},_0x5e01f3={};_0x52552f<_0xc0b1c1[_0xc35b('0x40')];_0x52552f+=0x1){_0x7fc46e=_0xc0b1c1[_0x52552f];if(_[_0xc35b('0x41')](_0x5486a4[_0xc35b('0x15')][_0x7fc46e['id']])){_0x5486a4['templates'][_0x7fc46e['id']]=new Template(_0x7fc46e);}else{_0x5486a4[_0xc35b('0x3e')](_0x5486a4[_0xc35b('0x15')][_0x7fc46e['id']],_0x7fc46e);}}}return _0x5486a4[_0xc35b('0x15')];};};Realtime[_0xc35b('0x3d')]['initZendeskAccounts']=function(){var _0x39a800=this;return function(_0x3e4c11){if(_0x3e4c11){freeIsNotKey(_0x3e4c11,_0x39a800[_0xc35b('0x1b')],'id');for(var _0x2c0f58=0x0,_0x3de8a1={},_0x260fa4={};_0x2c0f58<_0x3e4c11[_0xc35b('0x40')];_0x2c0f58+=0x1){_0x3de8a1=_0x3e4c11[_0x2c0f58];if(_['isUndefined'](_0x39a800[_0xc35b('0x1b')][_0x3de8a1['id']])){_0x39a800['zendeskAccounts'][_0x3de8a1['id']]=new ZendeskAccount(_0x3de8a1);}else{_0x39a800[_0xc35b('0x3e')](_0x39a800[_0xc35b('0x1b')][_0x3de8a1['id']],_0x3de8a1);}}}return _0x39a800[_0xc35b('0x1b')];};};Realtime['prototype'][_0xc35b('0x47')]=function(){var _0x5ec247=this;return function(_0x2bca3f){if(_0x2bca3f){freeIsNotKey(_0x2bca3f,_0x5ec247[_0xc35b('0x1c')],'id');for(var _0x58359e=0x0,_0x575bbd={},_0x5c8c53={};_0x58359e<_0x2bca3f['length'];_0x58359e+=0x1){_0x575bbd=_0x2bca3f[_0x58359e];if(_[_0xc35b('0x41')](_0x5ec247[_0xc35b('0x1c')][_0x575bbd['id']])){_0x5ec247[_0xc35b('0x1c')][_0x575bbd['id']]=new SalesforceAccount(_0x575bbd);}else{_0x5ec247[_0xc35b('0x3e')](_0x5ec247[_0xc35b('0x1c')][_0x575bbd['id']],_0x575bbd);}}}return _0x5ec247['salesforceAccounts'];};};Realtime[_0xc35b('0x3d')][_0xc35b('0x48')]=function(){var _0x319610=this;return function(_0x5b5673){if(_0x5b5673){freeIsNotKey(_0x5b5673,_0x319610[_0xc35b('0x1e')],'id');for(var _0xe22f6f=0x0,_0x391c99={},_0x37ee9={};_0xe22f6f<_0x5b5673[_0xc35b('0x40')];_0xe22f6f+=0x1){_0x391c99=_0x5b5673[_0xe22f6f];if(_[_0xc35b('0x41')](_0x319610['freshdeskAccounts'][_0x391c99['id']])){_0x319610[_0xc35b('0x1e')][_0x391c99['id']]=new FreshdeskAccount(_0x391c99);}else{_0x319610[_0xc35b('0x3e')](_0x319610[_0xc35b('0x1e')][_0x391c99['id']],_0x391c99);}}}return _0x319610[_0xc35b('0x1e')];};};Realtime['prototype'][_0xc35b('0x49')]=function(){var _0x4cd8e8=this;return function(_0x17ff0b){if(_0x17ff0b){freeIsNotKey(_0x17ff0b,_0x4cd8e8[_0xc35b('0x4a')],'id');for(var _0x2a97c7=0x0,_0x361366={},_0xe1b8ea={};_0x2a97c7<_0x17ff0b[_0xc35b('0x40')];_0x2a97c7+=0x1){_0x361366=_0x17ff0b[_0x2a97c7];if(_['isUndefined'](_0x4cd8e8[_0xc35b('0x4a')][_0x361366['id']])){_0x4cd8e8['zohoAccounts'][_0x361366['id']]=new ZohoAccount(_0x361366);}else{_0x4cd8e8[_0xc35b('0x3e')](_0x4cd8e8[_0xc35b('0x4a')][_0x361366['id']],_0x361366);}}}return _0x4cd8e8[_0xc35b('0x4a')];};};Realtime[_0xc35b('0x3d')][_0xc35b('0x4b')]=function(){var _0x27b5b0=this;return function(_0x44f0a9){if(_0x44f0a9){freeIsNotKey(_0x44f0a9,_0x27b5b0[_0xc35b('0x4c')],'id');for(var _0x3fcb0f=0x0,_0x115e4b={},_0x4b33db={};_0x3fcb0f<_0x44f0a9[_0xc35b('0x40')];_0x3fcb0f+=0x1){_0x115e4b=_0x44f0a9[_0x3fcb0f];if(_[_0xc35b('0x41')](_0x27b5b0['deskAccounts'][_0x115e4b['id']])){_0x27b5b0[_0xc35b('0x4c')][_0x115e4b['id']]=new DeskAccount(_0x115e4b);}else{_0x27b5b0[_0xc35b('0x3e')](_0x27b5b0[_0xc35b('0x4c')][_0x115e4b['id']],_0x115e4b);}}}return _0x27b5b0[_0xc35b('0x4c')];};};Realtime[_0xc35b('0x3d')][_0xc35b('0x4d')]=function(){var _0x2e1a18=this;return function(_0x758620){if(_0x758620){freeIsNotKey(_0x758620,_0x2e1a18[_0xc35b('0x1d')],'id');for(var _0x2a3744=0x0,_0x19a1de={},_0x4ed3dd={};_0x2a3744<_0x758620['length'];_0x2a3744+=0x1){_0x19a1de=_0x758620[_0x2a3744];if(_[_0xc35b('0x41')](_0x2e1a18[_0xc35b('0x1d')][_0x19a1de['id']])){_0x2e1a18[_0xc35b('0x1d')][_0x19a1de['id']]=new SugarcrmAccount(_0x19a1de);}else{_0x2e1a18[_0xc35b('0x3e')](_0x2e1a18[_0xc35b('0x1d')][_0x19a1de['id']],_0x19a1de);}}}return _0x2e1a18['sugarcrmAccounts'];};};Realtime[_0xc35b('0x3d')][_0xc35b('0x4e')]=function(){var _0x40d15b=this;return function(_0x2c954a){if(_0x2c954a){freeIsNotKey(_0x2c954a,_0x40d15b[_0xc35b('0x1f')],'id');for(var _0x171a5d=0x0,_0x46fe8a={},_0x4107dc={};_0x171a5d<_0x2c954a[_0xc35b('0x40')];_0x171a5d+=0x1){_0x46fe8a=_0x2c954a[_0x171a5d];if(_[_0xc35b('0x41')](_0x40d15b[_0xc35b('0x1f')][_0x46fe8a['id']])){_0x40d15b[_0xc35b('0x1f')][_0x46fe8a['id']]=new VtigerAccount(_0x46fe8a);}else{_0x40d15b[_0xc35b('0x3e')](_0x40d15b[_0xc35b('0x1f')][_0x46fe8a['id']],_0x46fe8a);}}}return _0x40d15b[_0xc35b('0x1f')];};};Realtime[_0xc35b('0x3d')][_0xc35b('0x4f')]=function(){var _0xe1a84e=this;return function(_0x300b59){if(_0x300b59){freeIsNotKey(_0x300b59,_0xe1a84e[_0xc35b('0x50')],'id');for(var _0x58c67b=0x0,_0x2ce344={},_0x244c51={};_0x58c67b<_0x300b59['length'];_0x58c67b+=0x1){_0x2ce344=_0x300b59[_0x58c67b];if(_[_0xc35b('0x41')](_0xe1a84e[_0xc35b('0x50')][_0x2ce344['id']])){_0xe1a84e[_0xc35b('0x50')][_0x2ce344['id']]=new ServicenowAccount(_0x2ce344);}else{_0xe1a84e['mergeFromDatabase'](_0xe1a84e['servicenowAccounts'][_0x2ce344['id']],_0x2ce344);}}}return _0xe1a84e[_0xc35b('0x50')];};};Realtime['prototype'][_0xc35b('0x51')]=function(){var _0x575e0c=this;return function(_0x4322e8){if(_0x4322e8){freeIsNotKey(_0x4322e8,_0x575e0c[_0xc35b('0x20')],'id');for(var _0x33ec4e=0x0,_0xe13917={},_0xdef1fe={};_0x33ec4e<_0x4322e8[_0xc35b('0x40')];_0x33ec4e+=0x1){_0xe13917=_0x4322e8[_0x33ec4e];if(_[_0xc35b('0x41')](_0x575e0c['dynamics365Accounts'][_0xe13917['id']])){_0x575e0c[_0xc35b('0x20')][_0xe13917['id']]=new Dynamics365Account(_0xe13917);}else{_0x575e0c['mergeFromDatabase'](_0x575e0c[_0xc35b('0x20')][_0xe13917['id']],_0xe13917);}}}return _0x575e0c[_0xc35b('0x20')];};};Realtime['prototype'][_0xc35b('0x52')]=function(){var _0x2a9dad=this;return function(_0x2de63a){for(var _0x5468b0=0x0;_0x5468b0<_0x2de63a[_0xc35b('0x40')];_0x5468b0+=0x1){_[_0xc35b('0x53')](_0x2a9dad[_0xc35b('0x13')][_0x2de63a[_0x5468b0][_0xc35b('0x26')]],_0x2de63a[_0x5468b0]);}return _0x2a9dad[_0xc35b('0x13')];};};Realtime['prototype']['initVoiceQueueReports']=function(){var _0x219755=this;return function(_0x5c41dc){clearVoiceQueues(_0x219755['voiceQueues']);if(_0x5c41dc){_0x5c41dc=_[_0xc35b('0x54')](_0x5c41dc,'uniqueid');for(var _0x2a69cc in _0x5c41dc){if(_0x5c41dc[_0xc35b('0x23')](_0x2a69cc)){var _0x34b4be={};for(var _0x32f171=0x0;_0x32f171<_0x5c41dc[_0x2a69cc][_0xc35b('0x40')];_0x32f171+=0x1){var _0x457c73=_0x5c41dc[_0x2a69cc][_0x32f171][_0xc35b('0x55')];if(_0x219755[_0xc35b('0x13')][_0x457c73]){if(_0x5c41dc[_0x2a69cc][_0x32f171][_0xc35b('0x56')]){_0x219755[_0xc35b('0x13')][_0x457c73][_0xc35b('0x2f')]+=0x1;}if(_0x5c41dc[_0x2a69cc][_0x32f171][_0xc35b('0x57')]){_0x219755[_0xc35b('0x13')][_0x457c73][_0xc35b('0x30')]+=0x1;}_0x219755[_0xc35b('0x13')][_0x457c73][_0xc35b('0x58')]+=moment(_0x5c41dc[_0x2a69cc][_0x32f171][_0xc35b('0x59')])['diff'](moment(_0x5c41dc[_0x2a69cc][_0x32f171][_0xc35b('0x5a')]),'seconds')||0x0;if(_0x32f171===_0x5c41dc[_0x2a69cc][_0xc35b('0x40')]-0x1){_0x219755['voiceQueues'][_0x457c73][_0xc35b('0x2a')]+=moment(_0x5c41dc[_0x2a69cc][_0x32f171][_0xc35b('0x5b')]||_0x5c41dc[_0x2a69cc][_0x32f171][_0xc35b('0x5c')]||_0x5c41dc[_0x2a69cc][_0x32f171][_0xc35b('0x5d')])[_0xc35b('0x5e')](moment(_0x5c41dc[_0x2a69cc][_0x32f171][_0xc35b('0x5a')]),_0xc35b('0x5f'))||0x0;_0x219755[_0xc35b('0x13')][_0x457c73][_0xc35b('0x2e')]+=0x1;if(_0x5c41dc[_0x2a69cc][_0x32f171][_0xc35b('0x60')]){_0x219755[_0xc35b('0x13')][_0x457c73][_0xc35b('0x29')]+=0x1;_0x219755[_0xc35b('0x13')][_0x457c73][_0xc35b('0x2b')]+=moment(_0x5c41dc[_0x2a69cc][_0x32f171]['queuecallercompleteAt'])[_0xc35b('0x5e')](moment(_0x5c41dc[_0x2a69cc][_0x32f171][_0xc35b('0x59')]),'seconds')||0x0;}}else{_0x219755['voiceQueues'][_0x457c73][_0xc35b('0x2a')]+=_0x219755[_0xc35b('0x13')][_0x457c73][_0xc35b('0x58')]||0x0;}}}}}}return _0x219755['voiceQueues'];};};Realtime['prototype']['initVoiceCallReports']=function(){var _0x5e0cff=this;return function(_0x199084){clearVoiceCallReports(_0x5e0cff[_0xc35b('0x61')]);if(_0x199084){for(var _0x503e65=0x0;_0x503e65<_0x199084[_0xc35b('0x40')];_0x503e65+=0x1){_0x5e0cff['outbound'][_0xc35b('0x2e')]+=0x1;_0x5e0cff[_0xc35b('0x61')]['sumDuration']+=_0x199084[_0x503e65]['duration'];if(_0x199084[_0x503e65][_0xc35b('0x62')]===_0xc35b('0x63')){_0x5e0cff[_0xc35b('0x61')][_0xc35b('0x29')]+=0x1;_0x5e0cff[_0xc35b('0x61')][_0xc35b('0x58')]+=_0x199084[_0x503e65][_0xc35b('0x64')]-_0x199084[_0x503e65][_0xc35b('0x65')]||0x0;_0x5e0cff['outbound'][_0xc35b('0x2b')]+=_0x199084[_0x503e65]['billableseconds'];}}}return _0x5e0cff[_0xc35b('0x61')];};};Realtime[_0xc35b('0x3d')]['initCampaigns']=function(){var _0x2f0203=this;return function(_0x582991){if(_0x582991){freeIsNotKey(_0x582991,_0x2f0203['campaigns'],'name');for(var _0x165da3=0x0,_0x21fc34={};_0x165da3<_0x582991['length'];_0x165da3+=0x1){_0x21fc34=_0x582991[_0x165da3];if(_[_0xc35b('0x41')](_0x2f0203[_0xc35b('0x14')][_0x21fc34[_0xc35b('0x26')]])){_0x2f0203[_0xc35b('0x14')][_0x21fc34[_0xc35b('0x26')]]=new Campaign(_0x21fc34);}else{_0x2f0203[_0xc35b('0x3e')](_0x2f0203[_0xc35b('0x14')][_0x21fc34[_0xc35b('0x26')]],_0x21fc34);}}}return _0x2f0203['campaigns'];};};Realtime[_0xc35b('0x3d')][_0xc35b('0x66')]=function(){var _0x3854e5=this;return function(_0x3fa59b){if(_0x3fa59b){freeIsNotKey(_0x3fa59b,_0x3854e5[_0xc35b('0x16')],'id');for(var _0x5c2c9d=0x0,_0x1fb36b={};_0x5c2c9d<_0x3fa59b[_0xc35b('0x40')];_0x5c2c9d+=0x1){_0x1fb36b=_0x3fa59b[_0x5c2c9d];if(_[_0xc35b('0x41')](_0x3854e5[_0xc35b('0x16')][_0x1fb36b['id']])){_0x3854e5[_0xc35b('0x16')][_0x1fb36b['id']]=new VoiceExtension(_0x1fb36b);}else{_0x3854e5[_0xc35b('0x3e')](_0x3854e5[_0xc35b('0x16')][_0x1fb36b['id']],_0x1fb36b);}}}return _0x3854e5['voiceExtensions'];};};Realtime['prototype'][_0xc35b('0x67')]=function(){var _0x28e69e=this;return function(_0x3a5b40){clearCampaigns(_0x28e69e[_0xc35b('0x14')]);for(var _0x3511f0=0x0;_0x3511f0<_0x3a5b40[_0xc35b('0x40')];_0x3511f0+=0x1){_[_0xc35b('0x53')](_0x28e69e[_0xc35b('0x14')][_0x3a5b40[_0x3511f0][_0xc35b('0x26')]],_0x3a5b40[_0x3511f0]);}return _0x28e69e['campaigns'];};};Realtime[_0xc35b('0x3d')]['initFaxAccounts']=function(){var _0x57d357=this;return function(_0x42095c){if(_0x42095c){freeIsNotKey(_0x42095c,_0x57d357[_0xc35b('0x21')],'id');for(var _0x30808a=0x0,_0x384835={},_0x272ff8={};_0x30808a<_0x42095c[_0xc35b('0x40')];_0x30808a+=0x1){_0x384835=_0x42095c[_0x30808a];if(_['isUndefined'](_0x57d357[_0xc35b('0x21')][_0x384835['id']])){_0x57d357[_0xc35b('0x21')][_0x384835['id']]=new FaxAccount(_0x384835);}else{_0x57d357[_0xc35b('0x3e')](_0x57d357[_0xc35b('0x21')][_0x384835['id']],_0x384835);}}}return _0x57d357[_0xc35b('0x21')];};};module['exports']=Realtime;
\ No newline at end of file