Built motion from commit 19a84241.|2.5.34
[motion2.git] / server / services / ami / realtime / index.js
index f47c4b7..2121c53 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc1f7=['../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/zendeskAccount','../model/salesforceAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','agents','triggers','campaigns','templates','queueChannels','outboundChannels','timers','sugarcrmAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','mapKeys','hasOwnProperty','isNil','interface','format','SIP/%s','total','answered','sumHoldTime','sumDuration','sumBillable','isEmpty','ivrTotalCallsDays','unmanaged','abandoned','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','queueStatusComplete','prototype','mergeFromDatabase','initAgents','name','isUndefined','telephones','length','initTrunks','trunks','initVoiceQueues','voiceQueues','initTriggers','initTemplates','initZendeskAccounts','zendeskAccounts','initSalesforceAccounts','salesforceAccounts','freshdeskAccounts','initZohoAccounts','zohoAccounts','initDeskAccounts','deskAccounts','initVtigerAccounts','initServicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','merge','groupBy','uniqueid','queue','queuecallerexit','queuecallerabandon','diff','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','queuecallercomplete','queuecallerleaveAt','initVoiceCallReports','outbound','duration','ANSWERED','initCampaigns','dialQueueProject','SquareProject','initVoiceExtensions','voiceExtensions','initCampaignHopperHistory','faxAccounts','exports','bluebird','util'];(function(_0x13b7d2,_0x46c7c5){var _0x279e13=function(_0x5e4f05){while(--_0x5e4f05){_0x13b7d2['push'](_0x13b7d2['shift']());}};_0x279e13(++_0x46c7c5);}(_0xc1f7,0x13f));var _0x7c1f=function(_0x4ccab6,_0x2094d9){_0x4ccab6=_0x4ccab6-0x0;var _0x4e7f19=_0xc1f7[_0x4ccab6];return _0x4e7f19;};'use strict';var BPromise=require(_0x7c1f('0x0'));var util=require(_0x7c1f('0x1'));var _=require('lodash');var moment=require('moment');var Agent=require('../model/agent');var Telephone=require(_0x7c1f('0x2'));var Trunk=require(_0x7c1f('0x3'));var VoiceQueue=require(_0x7c1f('0x4'));var Trigger=require(_0x7c1f('0x5'));var Template=require(_0x7c1f('0x6'));var Campaign=require(_0x7c1f('0x7'));var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require(_0x7c1f('0x8'));var SalesforceAccount=require(_0x7c1f('0x9'));var FreshdeskAccount=require('../model/freshdeskAccount');var SugarcrmAccount=require('../model/sugarcrmAccount');var ZohoAccount=require(_0x7c1f('0xa'));var DeskAccount=require(_0x7c1f('0xb'));var VtigerAccount=require(_0x7c1f('0xc'));var ServicenowAccount=require(_0x7c1f('0xd'));var Dynamics365Account=require(_0x7c1f('0xe'));var FreshsalesAccount=require(_0x7c1f('0xf'));var FaxAccount=require('../model/faxAccount');var Realtime=function(){this[_0x7c1f('0x10')]={};this['telephones']={};this['trunks']={};this['voiceQueues']={};this[_0x7c1f('0x11')]={};this[_0x7c1f('0x12')]={};this[_0x7c1f('0x13')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this['channels']={};this[_0x7c1f('0x14')]={};this[_0x7c1f('0x15')]={};this[_0x7c1f('0x16')]={};this['settings']={};this['zendeskAccounts']={};this['salesforceAccounts']={};this[_0x7c1f('0x17')]={};this['freshdeskAccounts']={};this['zohoAccounts']={};this['deskAccounts']={};this[_0x7c1f('0x18')]={};this[_0x7c1f('0x19')]={};this[_0x7c1f('0x1a')]={};this[_0x7c1f('0x1b')]={};this['faxAccounts']={};};function freeIsNotKey(_0x510c3c,_0x11d04e,_0x3ae9f6){var _0x2985a3=_[_0x7c1f('0x1c')](_0x510c3c,function(_0x3f2808,_0x5b29cb){return _0x3f2808[_0x3ae9f6];});for(var _0x1e2202 in _0x11d04e){if(_0x11d04e['hasOwnProperty'](_0x1e2202)){if(!_0x2985a3[_0x1e2202]){delete _0x11d04e[_0x1e2202];}}}}function freeIsNotKeySip(_0x1379c4,_0x4b58e8){var _0x4dbd57=_[_0x7c1f('0x1c')](_0x1379c4,function(_0x16ad02,_0x384205){return util['format']('SIP/%s',_0x16ad02['name']);});for(var _0x555310 in _0x4b58e8){if(_0x4b58e8[_0x7c1f('0x1d')](_0x555310)){if(!_0x4dbd57[_0x555310]){delete _0x4b58e8[_0x555310];}}}}function freeIsNotKeyAgent(_0xea7da5,_0x5784bd){var _0x5b59d8=_[_0x7c1f('0x1c')](_0xea7da5,function(_0xacb426,_0x110524){var _0x121ce=_[_0x7c1f('0x1e')](_0xacb426[_0x7c1f('0x1f')])?util[_0x7c1f('0x20')](_0x7c1f('0x21'),_0xacb426['name']):_0xacb426[_0x7c1f('0x1f')];return _0x121ce;});for(var _0x4781fa in _0x5784bd){if(_0x5784bd[_0x7c1f('0x1d')](_0x4781fa)){if(!_0x5b59d8[_0x4781fa]){delete _0x5784bd[_0x4781fa];}}}}function clearVoiceCallReports(_0x39df2f){_0x39df2f[_0x7c1f('0x22')]=0x0;_0x39df2f[_0x7c1f('0x23')]=0x0;_0x39df2f[_0x7c1f('0x24')]=0x0;_0x39df2f[_0x7c1f('0x25')]=0x0;_0x39df2f[_0x7c1f('0x26')]=0x0;}function clearCampaigns(_0x42d416){if(!_[_0x7c1f('0x27')](_0x42d416)){for(var _0x53817d in _0x42d416){if(_0x42d416[_0x7c1f('0x1d')](_0x53817d)){_0x42d416[_0x53817d][_0x7c1f('0x28')]=0x0;_0x42d416[_0x53817d]['ivrAnswerCallsDay']=0x0;}}}}function clearVoiceQueues(_0x5b517c){if(!_[_0x7c1f('0x27')](_0x5b517c)){for(var _0x19d6ba in _0x5b517c){if(_0x5b517c[_0x7c1f('0x1d')](_0x19d6ba)){_0x5b517c[_0x19d6ba]['total']=0x0;_0x5b517c[_0x19d6ba]['answered']=0x0;_0x5b517c[_0x19d6ba][_0x7c1f('0x29')]=0x0;_0x5b517c[_0x19d6ba][_0x7c1f('0x2a')]=0x0;_0x5b517c[_0x19d6ba][_0x7c1f('0x24')]=0x0;_0x5b517c[_0x19d6ba]['sumDuration']=0x0;_0x5b517c[_0x19d6ba][_0x7c1f('0x26')]=0x0;_0x5b517c[_0x19d6ba][_0x7c1f('0x2b')]=0x0;_0x5b517c[_0x19d6ba][_0x7c1f('0x2c')]=0x0;_0x5b517c[_0x19d6ba]['outboundBusyCallsDay']=0x0;_0x5b517c[_0x19d6ba][_0x7c1f('0x2d')]=0x0;_0x5b517c[_0x19d6ba][_0x7c1f('0x2e')]=0x0;_0x5b517c[_0x19d6ba][_0x7c1f('0x2f')]=0x0;_0x5b517c[_0x19d6ba][_0x7c1f('0x30')]=0x0;_0x5b517c[_0x19d6ba][_0x7c1f('0x31')]=0x0;_0x5b517c[_0x19d6ba][_0x7c1f('0x32')]=0x0;_0x5b517c[_0x19d6ba][_0x7c1f('0x33')]=0x0;_0x5b517c[_0x19d6ba][_0x7c1f('0x34')]=0x0;_0x5b517c[_0x19d6ba]['outboundReCallsDay']=0x0;_0x5b517c[_0x19d6ba][_0x7c1f('0x2b')]=0x0;_0x5b517c[_0x19d6ba]['outboundAnswerCallsDay']=0x0;_0x5b517c[_0x19d6ba][_0x7c1f('0x35')]=!![];}}}}Realtime[_0x7c1f('0x36')][_0x7c1f('0x37')]=function(_0x18c4b3,_0x218828){for(var _0x7c2780 in _0x218828){if(_0x18c4b3['hasOwnProperty'](_0x7c2780)){_0x18c4b3[_0x7c2780]=_0x218828[_0x7c2780];}}};Realtime['prototype'][_0x7c1f('0x38')]=function(){var _0x4a1bd5=this;return function(_0x2313c9){if(_0x2313c9){freeIsNotKeyAgent(_0x2313c9,_0x4a1bd5[_0x7c1f('0x10')]);for(var _0x8ff940=0x0,_0x8d51ad={},_0x58fdd7={};_0x8ff940<_0x2313c9['length'];_0x8ff940+=0x1){_0x8d51ad=_0x2313c9[_0x8ff940];var _0x5a1b3a=_[_0x7c1f('0x1e')](_0x8d51ad[_0x7c1f('0x1f')])?util[_0x7c1f('0x20')](_0x7c1f('0x21'),_0x8d51ad[_0x7c1f('0x39')]):_0x8d51ad['interface'];if(_[_0x7c1f('0x3a')](_0x4a1bd5[_0x7c1f('0x10')][_0x5a1b3a])){_0x4a1bd5[_0x7c1f('0x10')][_0x5a1b3a]=new Agent(_0x8d51ad);}else{_0x4a1bd5['mergeFromDatabase'](_0x4a1bd5[_0x7c1f('0x10')][_0x5a1b3a],_0x8d51ad);}}}return _0x4a1bd5[_0x7c1f('0x10')];};};Realtime[_0x7c1f('0x36')]['initTelephones']=function(){var _0x100baa=this;return function(_0x2e9316){if(_0x2e9316){freeIsNotKeySip(_0x2e9316,_0x100baa[_0x7c1f('0x3b')]);for(var _0xd89da5=0x0,_0x3c6259={},_0x4aef27={};_0xd89da5<_0x2e9316[_0x7c1f('0x3c')];_0xd89da5+=0x1){_0x3c6259=_0x2e9316[_0xd89da5];if(_[_0x7c1f('0x3a')](_0x100baa[_0x7c1f('0x3b')][util['format'](_0x7c1f('0x21'),_0x3c6259[_0x7c1f('0x39')])])){_0x100baa[_0x7c1f('0x3b')][util['format'](_0x7c1f('0x21'),_0x3c6259[_0x7c1f('0x39')])]=new Telephone(_0x3c6259);}else{_0x100baa[_0x7c1f('0x37')](_0x100baa[_0x7c1f('0x3b')][util['format'](_0x7c1f('0x21'),_0x3c6259[_0x7c1f('0x39')])],_0x3c6259);}}}return _0x100baa[_0x7c1f('0x3b')];};};Realtime['prototype'][_0x7c1f('0x3d')]=function(){var _0xe61d3a=this;return function(_0x1fe7c8){if(_0x1fe7c8){freeIsNotKeySip(_0x1fe7c8,_0xe61d3a[_0x7c1f('0x3e')]);for(var _0x3b7154=0x0,_0x2079a1={},_0x58f181={};_0x3b7154<_0x1fe7c8[_0x7c1f('0x3c')];_0x3b7154+=0x1){_0x2079a1=_0x1fe7c8[_0x3b7154];if(_[_0x7c1f('0x3a')](_0xe61d3a[_0x7c1f('0x3e')][util[_0x7c1f('0x20')](_0x7c1f('0x21'),_0x2079a1[_0x7c1f('0x39')])])){_0xe61d3a[_0x7c1f('0x3e')][util['format'](_0x7c1f('0x21'),_0x2079a1[_0x7c1f('0x39')])]=new Trunk(_0x2079a1);}else{_0xe61d3a['mergeFromDatabase'](_0xe61d3a[_0x7c1f('0x3e')][util[_0x7c1f('0x20')](_0x7c1f('0x21'),_0x2079a1[_0x7c1f('0x39')])],_0x2079a1);}}}return _0xe61d3a[_0x7c1f('0x3e')];};};Realtime[_0x7c1f('0x36')][_0x7c1f('0x3f')]=function(){var _0x1548d9=this;return function(_0x4b4e85){if(_0x4b4e85){freeIsNotKey(_0x4b4e85,_0x1548d9[_0x7c1f('0x40')],_0x7c1f('0x39'));for(var _0x108d8a=0x0,_0x3f6ae9={},_0x599a1c={};_0x108d8a<_0x4b4e85['length'];_0x108d8a+=0x1){_0x3f6ae9=_0x4b4e85[_0x108d8a];if(_[_0x7c1f('0x3a')](_0x1548d9[_0x7c1f('0x40')][_0x3f6ae9[_0x7c1f('0x39')]])){_0x1548d9[_0x7c1f('0x40')][_0x3f6ae9[_0x7c1f('0x39')]]=new VoiceQueue(_0x3f6ae9);}else{_0x1548d9['mergeFromDatabase'](_0x1548d9[_0x7c1f('0x40')][_0x3f6ae9[_0x7c1f('0x39')]],_0x3f6ae9);}}}return _0x1548d9[_0x7c1f('0x40')];};};Realtime[_0x7c1f('0x36')][_0x7c1f('0x41')]=function(){var _0x1b94f5=this;return function(_0x26c04f){if(_0x26c04f){freeIsNotKey(_0x26c04f,_0x1b94f5[_0x7c1f('0x11')],'id');for(var _0x5cef17=0x0,_0x2df6e5={},_0x8061be={};_0x5cef17<_0x26c04f['length'];_0x5cef17+=0x1){_0x2df6e5=_0x26c04f[_0x5cef17];if(_[_0x7c1f('0x3a')](_0x1b94f5[_0x7c1f('0x11')][_0x2df6e5['id']])){_0x1b94f5[_0x7c1f('0x11')][_0x2df6e5['id']]=new Trigger(_0x2df6e5);}else{_0x1b94f5[_0x7c1f('0x37')](_0x1b94f5[_0x7c1f('0x11')][_0x2df6e5['id']],_0x2df6e5);}}}return _0x1b94f5[_0x7c1f('0x11')];};};Realtime[_0x7c1f('0x36')][_0x7c1f('0x42')]=function(){var _0x18f821=this;return function(_0x36e649){if(_0x36e649){freeIsNotKey(_0x36e649,_0x18f821[_0x7c1f('0x13')],'id');for(var _0x1fcd0b=0x0,_0x193e61={},_0x17a6f5={};_0x1fcd0b<_0x36e649[_0x7c1f('0x3c')];_0x1fcd0b+=0x1){_0x193e61=_0x36e649[_0x1fcd0b];if(_['isUndefined'](_0x18f821['templates'][_0x193e61['id']])){_0x18f821[_0x7c1f('0x13')][_0x193e61['id']]=new Template(_0x193e61);}else{_0x18f821[_0x7c1f('0x37')](_0x18f821[_0x7c1f('0x13')][_0x193e61['id']],_0x193e61);}}}return _0x18f821['templates'];};};Realtime[_0x7c1f('0x36')][_0x7c1f('0x43')]=function(){var _0x8a4360=this;return function(_0x12fb65){if(_0x12fb65){freeIsNotKey(_0x12fb65,_0x8a4360['zendeskAccounts'],'id');for(var _0x5ef104=0x0,_0x387cb4={},_0x4df0bf={};_0x5ef104<_0x12fb65[_0x7c1f('0x3c')];_0x5ef104+=0x1){_0x387cb4=_0x12fb65[_0x5ef104];if(_['isUndefined'](_0x8a4360[_0x7c1f('0x44')][_0x387cb4['id']])){_0x8a4360[_0x7c1f('0x44')][_0x387cb4['id']]=new ZendeskAccount(_0x387cb4);}else{_0x8a4360['mergeFromDatabase'](_0x8a4360[_0x7c1f('0x44')][_0x387cb4['id']],_0x387cb4);}}}return _0x8a4360['zendeskAccounts'];};};Realtime['prototype'][_0x7c1f('0x45')]=function(){var _0x2d8232=this;return function(_0x2244fe){if(_0x2244fe){freeIsNotKey(_0x2244fe,_0x2d8232[_0x7c1f('0x46')],'id');for(var _0x2dc7eb=0x0,_0x53cb1f={},_0x277ccc={};_0x2dc7eb<_0x2244fe[_0x7c1f('0x3c')];_0x2dc7eb+=0x1){_0x53cb1f=_0x2244fe[_0x2dc7eb];if(_[_0x7c1f('0x3a')](_0x2d8232[_0x7c1f('0x46')][_0x53cb1f['id']])){_0x2d8232[_0x7c1f('0x46')][_0x53cb1f['id']]=new SalesforceAccount(_0x53cb1f);}else{_0x2d8232[_0x7c1f('0x37')](_0x2d8232[_0x7c1f('0x46')][_0x53cb1f['id']],_0x53cb1f);}}}return _0x2d8232['salesforceAccounts'];};};Realtime[_0x7c1f('0x36')]['initFreshdeskAccounts']=function(){var _0x3a251d=this;return function(_0x49e0e4){if(_0x49e0e4){freeIsNotKey(_0x49e0e4,_0x3a251d['freshdeskAccounts'],'id');for(var _0x39eac8=0x0,_0x1edacd={},_0x172bd2={};_0x39eac8<_0x49e0e4['length'];_0x39eac8+=0x1){_0x1edacd=_0x49e0e4[_0x39eac8];if(_['isUndefined'](_0x3a251d[_0x7c1f('0x47')][_0x1edacd['id']])){_0x3a251d[_0x7c1f('0x47')][_0x1edacd['id']]=new FreshdeskAccount(_0x1edacd);}else{_0x3a251d[_0x7c1f('0x37')](_0x3a251d[_0x7c1f('0x47')][_0x1edacd['id']],_0x1edacd);}}}return _0x3a251d[_0x7c1f('0x47')];};};Realtime[_0x7c1f('0x36')][_0x7c1f('0x48')]=function(){var _0x471c6b=this;return function(_0x1f0456){if(_0x1f0456){freeIsNotKey(_0x1f0456,_0x471c6b[_0x7c1f('0x49')],'id');for(var _0x5a3aed=0x0,_0x3a9c79={},_0xceeb47={};_0x5a3aed<_0x1f0456[_0x7c1f('0x3c')];_0x5a3aed+=0x1){_0x3a9c79=_0x1f0456[_0x5a3aed];if(_[_0x7c1f('0x3a')](_0x471c6b['zohoAccounts'][_0x3a9c79['id']])){_0x471c6b['zohoAccounts'][_0x3a9c79['id']]=new ZohoAccount(_0x3a9c79);}else{_0x471c6b[_0x7c1f('0x37')](_0x471c6b[_0x7c1f('0x49')][_0x3a9c79['id']],_0x3a9c79);}}}return _0x471c6b['zohoAccounts'];};};Realtime['prototype'][_0x7c1f('0x4a')]=function(){var _0x3e1854=this;return function(_0xabff73){if(_0xabff73){freeIsNotKey(_0xabff73,_0x3e1854[_0x7c1f('0x4b')],'id');for(var _0x51da05=0x0,_0xab7ad7={},_0x1528b4={};_0x51da05<_0xabff73[_0x7c1f('0x3c')];_0x51da05+=0x1){_0xab7ad7=_0xabff73[_0x51da05];if(_[_0x7c1f('0x3a')](_0x3e1854['deskAccounts'][_0xab7ad7['id']])){_0x3e1854[_0x7c1f('0x4b')][_0xab7ad7['id']]=new DeskAccount(_0xab7ad7);}else{_0x3e1854[_0x7c1f('0x37')](_0x3e1854[_0x7c1f('0x4b')][_0xab7ad7['id']],_0xab7ad7);}}}return _0x3e1854[_0x7c1f('0x4b')];};};Realtime[_0x7c1f('0x36')]['initSugarcrmAccounts']=function(){var _0x1a738d=this;return function(_0x4355f9){if(_0x4355f9){freeIsNotKey(_0x4355f9,_0x1a738d['sugarcrmAccounts'],'id');for(var _0x5b0b0e=0x0,_0x368edd={},_0x2ada1d={};_0x5b0b0e<_0x4355f9['length'];_0x5b0b0e+=0x1){_0x368edd=_0x4355f9[_0x5b0b0e];if(_[_0x7c1f('0x3a')](_0x1a738d[_0x7c1f('0x17')][_0x368edd['id']])){_0x1a738d[_0x7c1f('0x17')][_0x368edd['id']]=new SugarcrmAccount(_0x368edd);}else{_0x1a738d[_0x7c1f('0x37')](_0x1a738d[_0x7c1f('0x17')][_0x368edd['id']],_0x368edd);}}}return _0x1a738d['sugarcrmAccounts'];};};Realtime[_0x7c1f('0x36')][_0x7c1f('0x4c')]=function(){var _0x2b2463=this;return function(_0x869672){if(_0x869672){freeIsNotKey(_0x869672,_0x2b2463['vtigerAccounts'],'id');for(var _0x2e5f83=0x0,_0x44eeaf={},_0x40a7e1={};_0x2e5f83<_0x869672['length'];_0x2e5f83+=0x1){_0x44eeaf=_0x869672[_0x2e5f83];if(_[_0x7c1f('0x3a')](_0x2b2463[_0x7c1f('0x18')][_0x44eeaf['id']])){_0x2b2463['vtigerAccounts'][_0x44eeaf['id']]=new VtigerAccount(_0x44eeaf);}else{_0x2b2463[_0x7c1f('0x37')](_0x2b2463[_0x7c1f('0x18')][_0x44eeaf['id']],_0x44eeaf);}}}return _0x2b2463[_0x7c1f('0x18')];};};Realtime['prototype'][_0x7c1f('0x4d')]=function(){var _0x3ee8ac=this;return function(_0x2e93f0){if(_0x2e93f0){freeIsNotKey(_0x2e93f0,_0x3ee8ac['servicenowAccounts'],'id');for(var _0x271bb5=0x0,_0x4dd782={},_0x55b591={};_0x271bb5<_0x2e93f0[_0x7c1f('0x3c')];_0x271bb5+=0x1){_0x4dd782=_0x2e93f0[_0x271bb5];if(_[_0x7c1f('0x3a')](_0x3ee8ac[_0x7c1f('0x19')][_0x4dd782['id']])){_0x3ee8ac[_0x7c1f('0x19')][_0x4dd782['id']]=new ServicenowAccount(_0x4dd782);}else{_0x3ee8ac[_0x7c1f('0x37')](_0x3ee8ac['servicenowAccounts'][_0x4dd782['id']],_0x4dd782);}}}return _0x3ee8ac[_0x7c1f('0x19')];};};Realtime[_0x7c1f('0x36')][_0x7c1f('0x4e')]=function(){var _0x46c159=this;return function(_0x11ac2e){if(_0x11ac2e){freeIsNotKey(_0x11ac2e,_0x46c159[_0x7c1f('0x1a')],'id');for(var _0x48c3da=0x0,_0x18d346={},_0x1064b6={};_0x48c3da<_0x11ac2e[_0x7c1f('0x3c')];_0x48c3da+=0x1){_0x18d346=_0x11ac2e[_0x48c3da];if(_[_0x7c1f('0x3a')](_0x46c159[_0x7c1f('0x1a')][_0x18d346['id']])){_0x46c159[_0x7c1f('0x1a')][_0x18d346['id']]=new Dynamics365Account(_0x18d346);}else{_0x46c159['mergeFromDatabase'](_0x46c159[_0x7c1f('0x1a')][_0x18d346['id']],_0x18d346);}}}return _0x46c159[_0x7c1f('0x1a')];};};Realtime[_0x7c1f('0x36')][_0x7c1f('0x4f')]=function(){var _0x2006b6=this;return function(_0x31e34c){if(_0x31e34c){freeIsNotKey(_0x31e34c,_0x2006b6[_0x7c1f('0x1b')],'id');for(var _0x46851e=0x0,_0x35891c={},_0x2fa22c={};_0x46851e<_0x31e34c[_0x7c1f('0x3c')];_0x46851e+=0x1){_0x35891c=_0x31e34c[_0x46851e];if(_[_0x7c1f('0x3a')](_0x2006b6[_0x7c1f('0x1b')][_0x35891c['id']])){_0x2006b6[_0x7c1f('0x1b')][_0x35891c['id']]=new FreshsalesAccount(_0x35891c);}else{_0x2006b6[_0x7c1f('0x37')](_0x2006b6['freshsalesAccounts'][_0x35891c['id']],_0x35891c);}}}return _0x2006b6[_0x7c1f('0x1b')];};};Realtime[_0x7c1f('0x36')][_0x7c1f('0x50')]=function(){var _0x4380ea=this;return function(_0x2cd106){for(var _0x8dfbd9=0x0;_0x8dfbd9<_0x2cd106[_0x7c1f('0x3c')];_0x8dfbd9+=0x1){_[_0x7c1f('0x51')](_0x4380ea[_0x7c1f('0x40')][_0x2cd106[_0x8dfbd9]['name']],_0x2cd106[_0x8dfbd9]);}return _0x4380ea[_0x7c1f('0x40')];};};Realtime[_0x7c1f('0x36')]['initVoiceQueueReports']=function(){var _0x4d699e=this;return function(_0xe9f805){clearVoiceQueues(_0x4d699e[_0x7c1f('0x40')]);if(_0xe9f805){_0xe9f805=_[_0x7c1f('0x52')](_0xe9f805,_0x7c1f('0x53'));for(var _0x1d0788 in _0xe9f805){if(_0xe9f805[_0x7c1f('0x1d')](_0x1d0788)){var _0x1cce25={};for(var _0x50828f=0x0;_0x50828f<_0xe9f805[_0x1d0788]['length'];_0x50828f+=0x1){var _0xe83eaa=_0xe9f805[_0x1d0788][_0x50828f][_0x7c1f('0x54')];if(_0x4d699e[_0x7c1f('0x40')][_0xe83eaa]){if(_0xe9f805[_0x1d0788][_0x50828f][_0x7c1f('0x55')]){_0x4d699e[_0x7c1f('0x40')][_0xe83eaa][_0x7c1f('0x29')]+=0x1;}if(_0xe9f805[_0x1d0788][_0x50828f][_0x7c1f('0x56')]){_0x4d699e['voiceQueues'][_0xe83eaa][_0x7c1f('0x2a')]+=0x1;}_0x4d699e[_0x7c1f('0x40')][_0xe83eaa]['sumHoldTime']+=moment(_0xe9f805[_0x1d0788][_0x50828f]['queuecallerleaveAt'])[_0x7c1f('0x57')](moment(_0xe9f805[_0x1d0788][_0x50828f][_0x7c1f('0x58')]),_0x7c1f('0x59'))||0x0;if(_0x50828f===_0xe9f805[_0x1d0788][_0x7c1f('0x3c')]-0x1){_0x4d699e[_0x7c1f('0x40')][_0xe83eaa][_0x7c1f('0x25')]+=moment(_0xe9f805[_0x1d0788][_0x50828f][_0x7c1f('0x5a')]||_0xe9f805[_0x1d0788][_0x50828f][_0x7c1f('0x5b')]||_0xe9f805[_0x1d0788][_0x50828f][_0x7c1f('0x5c')])['diff'](moment(_0xe9f805[_0x1d0788][_0x50828f][_0x7c1f('0x58')]),_0x7c1f('0x59'))||0x0;_0x4d699e['voiceQueues'][_0xe83eaa][_0x7c1f('0x22')]+=0x1;if(_0xe9f805[_0x1d0788][_0x50828f][_0x7c1f('0x5d')]){_0x4d699e[_0x7c1f('0x40')][_0xe83eaa][_0x7c1f('0x23')]+=0x1;_0x4d699e['voiceQueues'][_0xe83eaa][_0x7c1f('0x26')]+=moment(_0xe9f805[_0x1d0788][_0x50828f]['queuecallercompleteAt'])['diff'](moment(_0xe9f805[_0x1d0788][_0x50828f][_0x7c1f('0x5e')]),'seconds')||0x0;}}else{_0x4d699e[_0x7c1f('0x40')][_0xe83eaa][_0x7c1f('0x25')]+=_0x4d699e[_0x7c1f('0x40')][_0xe83eaa]['sumHoldTime']||0x0;}}}}}}return _0x4d699e['voiceQueues'];};};Realtime[_0x7c1f('0x36')][_0x7c1f('0x5f')]=function(){var _0x4f8b31=this;return function(_0x27955b){clearVoiceCallReports(_0x4f8b31[_0x7c1f('0x60')]);if(_0x27955b){for(var _0x3be262=0x0;_0x3be262<_0x27955b[_0x7c1f('0x3c')];_0x3be262+=0x1){_0x4f8b31[_0x7c1f('0x60')][_0x7c1f('0x22')]+=0x1;_0x4f8b31[_0x7c1f('0x60')][_0x7c1f('0x25')]+=_0x27955b[_0x3be262][_0x7c1f('0x61')];if(_0x27955b[_0x3be262]['disposition']===_0x7c1f('0x62')){_0x4f8b31[_0x7c1f('0x60')][_0x7c1f('0x23')]+=0x1;_0x4f8b31[_0x7c1f('0x60')][_0x7c1f('0x24')]+=_0x27955b[_0x3be262]['duration']-_0x27955b[_0x3be262]['billableseconds']||0x0;_0x4f8b31[_0x7c1f('0x60')][_0x7c1f('0x26')]+=_0x27955b[_0x3be262]['billableseconds'];}}}return _0x4f8b31[_0x7c1f('0x60')];};};Realtime[_0x7c1f('0x36')][_0x7c1f('0x63')]=function(){var _0x1cd98f=this;return function(_0x1d233d){if(_0x1d233d){freeIsNotKey(_0x1d233d,_0x1cd98f[_0x7c1f('0x12')],_0x7c1f('0x39'));for(var _0x54bc9f=0x0,_0xcd4117={};_0x54bc9f<_0x1d233d[_0x7c1f('0x3c')];_0x54bc9f+=0x1){_0xcd4117=_0x1d233d[_0x54bc9f];if(_[_0x7c1f('0x3a')](_0x1cd98f[_0x7c1f('0x12')][_0xcd4117['name']])){_0x1cd98f['campaigns'][_0xcd4117[_0x7c1f('0x39')]]=new Campaign(_0xcd4117);}else{_0x1cd98f[_0x7c1f('0x37')](_0x1cd98f['campaigns'][_0xcd4117['name']],_0xcd4117);_0x1cd98f[_0x7c1f('0x12')][_0xcd4117[_0x7c1f('0x39')]][_0x7c1f('0x64')]=_0xcd4117[_0x7c1f('0x65')]?_0xcd4117['SquareProject']['name']:undefined;}}}return _0x1cd98f['campaigns'];};};Realtime[_0x7c1f('0x36')][_0x7c1f('0x66')]=function(){var _0x3ff8fc=this;return function(_0x2fa772){if(_0x2fa772){freeIsNotKey(_0x2fa772,_0x3ff8fc['voiceExtensions'],'id');for(var _0x375f70=0x0,_0x8c9152={};_0x375f70<_0x2fa772[_0x7c1f('0x3c')];_0x375f70+=0x1){_0x8c9152=_0x2fa772[_0x375f70];if(_[_0x7c1f('0x3a')](_0x3ff8fc['voiceExtensions'][_0x8c9152['id']])){_0x3ff8fc['voiceExtensions'][_0x8c9152['id']]=new VoiceExtension(_0x8c9152);}else{_0x3ff8fc[_0x7c1f('0x37')](_0x3ff8fc['voiceExtensions'][_0x8c9152['id']],_0x8c9152);}}}return _0x3ff8fc[_0x7c1f('0x67')];};};Realtime[_0x7c1f('0x36')][_0x7c1f('0x68')]=function(){var _0x5ea4f4=this;return function(_0x5e2445){clearCampaigns(_0x5ea4f4[_0x7c1f('0x12')]);for(var _0x5ee1d3=0x0;_0x5ee1d3<_0x5e2445[_0x7c1f('0x3c')];_0x5ee1d3+=0x1){_[_0x7c1f('0x51')](_0x5ea4f4[_0x7c1f('0x12')][_0x5e2445[_0x5ee1d3][_0x7c1f('0x39')]],_0x5e2445[_0x5ee1d3]);}return _0x5ea4f4['campaigns'];};};Realtime[_0x7c1f('0x36')]['initFaxAccounts']=function(){var _0x148223=this;return function(_0x389542){if(_0x389542){freeIsNotKey(_0x389542,_0x148223[_0x7c1f('0x69')],'id');for(var _0x2b9c2b=0x0,_0x2b912c={},_0x805a87={};_0x2b9c2b<_0x389542['length'];_0x2b9c2b+=0x1){_0x2b912c=_0x389542[_0x2b9c2b];if(_[_0x7c1f('0x3a')](_0x148223[_0x7c1f('0x69')][_0x2b912c['id']])){_0x148223[_0x7c1f('0x69')][_0x2b912c['id']]=new FaxAccount(_0x2b912c);}else{_0x148223['mergeFromDatabase'](_0x148223[_0x7c1f('0x69')][_0x2b912c['id']],_0x2b912c);}}}return _0x148223[_0x7c1f('0x69')];};};module[_0x7c1f('0x6a')]=Realtime;
\ No newline at end of file
+var _0x20f1=['queuecallerexit','queuecallerleaveAt','diff','seconds','queuecallerexitAt','queuecallerjoinAt','queuecallercomplete','outbound','duration','disposition','ANSWERED','billableseconds','initCampaigns','campaigns','SquareProject','initVoiceExtensions','initCampaignHopperHistory','bluebird','util','lodash','../model/telephone','../model/trunk','../model/voiceQueue','../model/template','../model/voiceExtension','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/vtigerAccount','../model/dynamics365Account','../model/faxAccount','agents','voiceQueues','templates','voiceExtensions','channels','queueChannels','outboundChannels','zendeskAccounts','sugarcrmAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty','SIP/%s','name','isNil','interface','format','total','answered','sumHoldTime','sumDuration','isEmpty','ivrTotalCallsDays','unmanaged','abandoned','sumBillable','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','prototype','length','isUndefined','mergeFromDatabase','telephones','initTrunks','trunks','initVoiceQueues','triggers','initTemplates','initZendeskAccounts','initSalesforceAccounts','salesforceAccounts','initFreshdeskAccounts','freshdeskAccounts','initZohoAccounts','zohoAccounts','initDeskAccounts','deskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','initFreshsalesAccounts','initVoiceQueueReports','queue'];(function(_0x339ec8,_0x10c64c){var _0x56a11f=function(_0x9ea856){while(--_0x9ea856){_0x339ec8['push'](_0x339ec8['shift']());}};_0x56a11f(++_0x10c64c);}(_0x20f1,0x73));var _0x120f=function(_0x5ad556,_0x4225cf){_0x5ad556=_0x5ad556-0x0;var _0x1b3a01=_0x20f1[_0x5ad556];return _0x1b3a01;};'use strict';var BPromise=require(_0x120f('0x0'));var util=require(_0x120f('0x1'));var _=require(_0x120f('0x2'));var moment=require('moment');var Agent=require('../model/agent');var Telephone=require(_0x120f('0x3'));var Trunk=require(_0x120f('0x4'));var VoiceQueue=require(_0x120f('0x5'));var Trigger=require('../model/trigger');var Template=require(_0x120f('0x6'));var Campaign=require('../model/campaign');var VoiceExtension=require(_0x120f('0x7'));var ZendeskAccount=require('../model/zendeskAccount');var SalesforceAccount=require(_0x120f('0x8'));var FreshdeskAccount=require(_0x120f('0x9'));var SugarcrmAccount=require(_0x120f('0xa'));var ZohoAccount=require(_0x120f('0xb'));var DeskAccount=require('../model/deskAccount');var VtigerAccount=require(_0x120f('0xc'));var ServicenowAccount=require('../model/servicenowAccount');var Dynamics365Account=require(_0x120f('0xd'));var FreshsalesAccount=require('../model/freshsalesAccount');var FaxAccount=require(_0x120f('0xe'));var Realtime=function(){this[_0x120f('0xf')]={};this['telephones']={};this['trunks']={};this[_0x120f('0x10')]={};this['triggers']={};this['campaigns']={};this[_0x120f('0x11')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x120f('0x12')]={};this[_0x120f('0x13')]={};this[_0x120f('0x14')]={};this[_0x120f('0x15')]={};this['timers']={};this['settings']={};this[_0x120f('0x16')]={};this['salesforceAccounts']={};this[_0x120f('0x17')]={};this['freshdeskAccounts']={};this['zohoAccounts']={};this['deskAccounts']={};this[_0x120f('0x18')]={};this[_0x120f('0x19')]={};this[_0x120f('0x1a')]={};this[_0x120f('0x1b')]={};this[_0x120f('0x1c')]={};};function freeIsNotKey(_0x511b86,_0x3169c0,_0x307fb3){var _0x545f87=_[_0x120f('0x1d')](_0x511b86,function(_0x35616c,_0x5ca8cb){return _0x35616c[_0x307fb3];});for(var _0x33845b in _0x3169c0){if(_0x3169c0[_0x120f('0x1e')](_0x33845b)){if(!_0x545f87[_0x33845b]){delete _0x3169c0[_0x33845b];}}}}function freeIsNotKeySip(_0x555307,_0x43961b){var _0x42716c=_[_0x120f('0x1d')](_0x555307,function(_0x4dbcd1,_0x9155db){return util['format'](_0x120f('0x1f'),_0x4dbcd1[_0x120f('0x20')]);});for(var _0x16ee3a in _0x43961b){if(_0x43961b[_0x120f('0x1e')](_0x16ee3a)){if(!_0x42716c[_0x16ee3a]){delete _0x43961b[_0x16ee3a];}}}}function freeIsNotKeyAgent(_0x263e95,_0x9e4d6b){var _0x3c3c0d=_[_0x120f('0x1d')](_0x263e95,function(_0x5d96d0,_0x24eb6d){var _0x1d7b6f=_[_0x120f('0x21')](_0x5d96d0[_0x120f('0x22')])?util[_0x120f('0x23')]('SIP/%s',_0x5d96d0['name']):_0x5d96d0[_0x120f('0x22')];return _0x1d7b6f;});for(var _0x239e79 in _0x9e4d6b){if(_0x9e4d6b['hasOwnProperty'](_0x239e79)){if(!_0x3c3c0d[_0x239e79]){delete _0x9e4d6b[_0x239e79];}}}}function clearVoiceCallReports(_0x51c6ee){_0x51c6ee[_0x120f('0x24')]=0x0;_0x51c6ee[_0x120f('0x25')]=0x0;_0x51c6ee[_0x120f('0x26')]=0x0;_0x51c6ee[_0x120f('0x27')]=0x0;_0x51c6ee['sumBillable']=0x0;}function clearCampaigns(_0x17b579){if(!_[_0x120f('0x28')](_0x17b579)){for(var _0x306af2 in _0x17b579){if(_0x17b579[_0x120f('0x1e')](_0x306af2)){_0x17b579[_0x306af2][_0x120f('0x29')]=0x0;_0x17b579[_0x306af2]['ivrAnswerCallsDay']=0x0;}}}}function clearVoiceQueues(_0x518ea7){if(!_['isEmpty'](_0x518ea7)){for(var _0x3448b7 in _0x518ea7){if(_0x518ea7[_0x120f('0x1e')](_0x3448b7)){_0x518ea7[_0x3448b7][_0x120f('0x24')]=0x0;_0x518ea7[_0x3448b7][_0x120f('0x25')]=0x0;_0x518ea7[_0x3448b7][_0x120f('0x2a')]=0x0;_0x518ea7[_0x3448b7][_0x120f('0x2b')]=0x0;_0x518ea7[_0x3448b7]['sumHoldTime']=0x0;_0x518ea7[_0x3448b7][_0x120f('0x27')]=0x0;_0x518ea7[_0x3448b7][_0x120f('0x2c')]=0x0;_0x518ea7[_0x3448b7][_0x120f('0x2d')]=0x0;_0x518ea7[_0x3448b7][_0x120f('0x2e')]=0x0;_0x518ea7[_0x3448b7][_0x120f('0x2f')]=0x0;_0x518ea7[_0x3448b7][_0x120f('0x30')]=0x0;_0x518ea7[_0x3448b7]['outboundNoSuchCallsDay']=0x0;_0x518ea7[_0x3448b7]['outboundUnknownCallsDay']=0x0;_0x518ea7[_0x3448b7][_0x120f('0x31')]=0x0;_0x518ea7[_0x3448b7][_0x120f('0x32')]=0x0;_0x518ea7[_0x3448b7][_0x120f('0x33')]=0x0;_0x518ea7[_0x3448b7][_0x120f('0x34')]=0x0;_0x518ea7[_0x3448b7][_0x120f('0x35')]=0x0;_0x518ea7[_0x3448b7][_0x120f('0x36')]=0x0;_0x518ea7[_0x3448b7][_0x120f('0x2d')]=0x0;_0x518ea7[_0x3448b7][_0x120f('0x37')]=0x0;_0x518ea7[_0x3448b7]['queueStatusComplete']=!![];}}}}Realtime[_0x120f('0x38')]['mergeFromDatabase']=function(_0x42b7d6,_0x156263){for(var _0x2df0be in _0x156263){if(_0x42b7d6[_0x120f('0x1e')](_0x2df0be)){_0x42b7d6[_0x2df0be]=_0x156263[_0x2df0be];}}};Realtime[_0x120f('0x38')]['initAgents']=function(){var _0x3d2c71=this;return function(_0x15620a){if(_0x15620a){freeIsNotKeyAgent(_0x15620a,_0x3d2c71[_0x120f('0xf')]);for(var _0x1ccd05=0x0,_0x2149dd={},_0x4b6537={};_0x1ccd05<_0x15620a[_0x120f('0x39')];_0x1ccd05+=0x1){_0x2149dd=_0x15620a[_0x1ccd05];var _0x4d6914=_[_0x120f('0x21')](_0x2149dd[_0x120f('0x22')])?util['format'](_0x120f('0x1f'),_0x2149dd['name']):_0x2149dd['interface'];if(_[_0x120f('0x3a')](_0x3d2c71[_0x120f('0xf')][_0x4d6914])){_0x3d2c71[_0x120f('0xf')][_0x4d6914]=new Agent(_0x2149dd);}else{_0x3d2c71[_0x120f('0x3b')](_0x3d2c71[_0x120f('0xf')][_0x4d6914],_0x2149dd);}}}return _0x3d2c71[_0x120f('0xf')];};};Realtime[_0x120f('0x38')]['initTelephones']=function(){var _0x1a0ed3=this;return function(_0x237a17){if(_0x237a17){freeIsNotKeySip(_0x237a17,_0x1a0ed3['telephones']);for(var _0x55aa2c=0x0,_0x13ba3d={},_0x43c1b7={};_0x55aa2c<_0x237a17[_0x120f('0x39')];_0x55aa2c+=0x1){_0x13ba3d=_0x237a17[_0x55aa2c];if(_[_0x120f('0x3a')](_0x1a0ed3[_0x120f('0x3c')][util[_0x120f('0x23')](_0x120f('0x1f'),_0x13ba3d[_0x120f('0x20')])])){_0x1a0ed3[_0x120f('0x3c')][util[_0x120f('0x23')](_0x120f('0x1f'),_0x13ba3d[_0x120f('0x20')])]=new Telephone(_0x13ba3d);}else{_0x1a0ed3[_0x120f('0x3b')](_0x1a0ed3['telephones'][util['format'](_0x120f('0x1f'),_0x13ba3d['name'])],_0x13ba3d);}}}return _0x1a0ed3[_0x120f('0x3c')];};};Realtime[_0x120f('0x38')][_0x120f('0x3d')]=function(){var _0x47e3c9=this;return function(_0x15cd20){if(_0x15cd20){freeIsNotKeySip(_0x15cd20,_0x47e3c9[_0x120f('0x3e')]);for(var _0x55c645=0x0,_0x48b805={},_0x393e99={};_0x55c645<_0x15cd20[_0x120f('0x39')];_0x55c645+=0x1){_0x48b805=_0x15cd20[_0x55c645];if(_['isUndefined'](_0x47e3c9[_0x120f('0x3e')][util[_0x120f('0x23')]('SIP/%s',_0x48b805[_0x120f('0x20')])])){_0x47e3c9[_0x120f('0x3e')][util['format'](_0x120f('0x1f'),_0x48b805[_0x120f('0x20')])]=new Trunk(_0x48b805);}else{_0x47e3c9[_0x120f('0x3b')](_0x47e3c9[_0x120f('0x3e')][util[_0x120f('0x23')](_0x120f('0x1f'),_0x48b805['name'])],_0x48b805);}}}return _0x47e3c9[_0x120f('0x3e')];};};Realtime['prototype'][_0x120f('0x3f')]=function(){var _0x2adf9a=this;return function(_0x3931fa){if(_0x3931fa){freeIsNotKey(_0x3931fa,_0x2adf9a[_0x120f('0x10')],'name');for(var _0x3df692=0x0,_0x5228e7={},_0x294a44={};_0x3df692<_0x3931fa[_0x120f('0x39')];_0x3df692+=0x1){_0x5228e7=_0x3931fa[_0x3df692];if(_[_0x120f('0x3a')](_0x2adf9a[_0x120f('0x10')][_0x5228e7[_0x120f('0x20')]])){_0x2adf9a[_0x120f('0x10')][_0x5228e7[_0x120f('0x20')]]=new VoiceQueue(_0x5228e7);}else{_0x2adf9a[_0x120f('0x3b')](_0x2adf9a['voiceQueues'][_0x5228e7[_0x120f('0x20')]],_0x5228e7);}}}return _0x2adf9a['voiceQueues'];};};Realtime[_0x120f('0x38')]['initTriggers']=function(){var _0x59583f=this;return function(_0x20fe7d){if(_0x20fe7d){freeIsNotKey(_0x20fe7d,_0x59583f[_0x120f('0x40')],'id');for(var _0xcd7f9=0x0,_0x3efca6={},_0x5119c9={};_0xcd7f9<_0x20fe7d['length'];_0xcd7f9+=0x1){_0x3efca6=_0x20fe7d[_0xcd7f9];if(_[_0x120f('0x3a')](_0x59583f[_0x120f('0x40')][_0x3efca6['id']])){_0x59583f['triggers'][_0x3efca6['id']]=new Trigger(_0x3efca6);}else{_0x59583f[_0x120f('0x3b')](_0x59583f[_0x120f('0x40')][_0x3efca6['id']],_0x3efca6);}}}return _0x59583f['triggers'];};};Realtime[_0x120f('0x38')][_0x120f('0x41')]=function(){var _0x1dafc9=this;return function(_0x2a8a12){if(_0x2a8a12){freeIsNotKey(_0x2a8a12,_0x1dafc9['templates'],'id');for(var _0x144839=0x0,_0x108ee7={},_0x5da107={};_0x144839<_0x2a8a12[_0x120f('0x39')];_0x144839+=0x1){_0x108ee7=_0x2a8a12[_0x144839];if(_[_0x120f('0x3a')](_0x1dafc9['templates'][_0x108ee7['id']])){_0x1dafc9[_0x120f('0x11')][_0x108ee7['id']]=new Template(_0x108ee7);}else{_0x1dafc9[_0x120f('0x3b')](_0x1dafc9[_0x120f('0x11')][_0x108ee7['id']],_0x108ee7);}}}return _0x1dafc9[_0x120f('0x11')];};};Realtime[_0x120f('0x38')][_0x120f('0x42')]=function(){var _0x615249=this;return function(_0x44945c){if(_0x44945c){freeIsNotKey(_0x44945c,_0x615249[_0x120f('0x16')],'id');for(var _0x16f396=0x0,_0x3b2e3f={},_0x43934d={};_0x16f396<_0x44945c['length'];_0x16f396+=0x1){_0x3b2e3f=_0x44945c[_0x16f396];if(_[_0x120f('0x3a')](_0x615249[_0x120f('0x16')][_0x3b2e3f['id']])){_0x615249[_0x120f('0x16')][_0x3b2e3f['id']]=new ZendeskAccount(_0x3b2e3f);}else{_0x615249[_0x120f('0x3b')](_0x615249[_0x120f('0x16')][_0x3b2e3f['id']],_0x3b2e3f);}}}return _0x615249['zendeskAccounts'];};};Realtime[_0x120f('0x38')][_0x120f('0x43')]=function(){var _0x1076f6=this;return function(_0x3ee78f){if(_0x3ee78f){freeIsNotKey(_0x3ee78f,_0x1076f6['salesforceAccounts'],'id');for(var _0x4c96b7=0x0,_0x4e1be4={},_0x50cbcb={};_0x4c96b7<_0x3ee78f[_0x120f('0x39')];_0x4c96b7+=0x1){_0x4e1be4=_0x3ee78f[_0x4c96b7];if(_[_0x120f('0x3a')](_0x1076f6[_0x120f('0x44')][_0x4e1be4['id']])){_0x1076f6[_0x120f('0x44')][_0x4e1be4['id']]=new SalesforceAccount(_0x4e1be4);}else{_0x1076f6[_0x120f('0x3b')](_0x1076f6[_0x120f('0x44')][_0x4e1be4['id']],_0x4e1be4);}}}return _0x1076f6[_0x120f('0x44')];};};Realtime[_0x120f('0x38')][_0x120f('0x45')]=function(){var _0x458151=this;return function(_0x2d8c3b){if(_0x2d8c3b){freeIsNotKey(_0x2d8c3b,_0x458151[_0x120f('0x46')],'id');for(var _0xe2f0f4=0x0,_0x166fcd={},_0x2b71c9={};_0xe2f0f4<_0x2d8c3b[_0x120f('0x39')];_0xe2f0f4+=0x1){_0x166fcd=_0x2d8c3b[_0xe2f0f4];if(_[_0x120f('0x3a')](_0x458151['freshdeskAccounts'][_0x166fcd['id']])){_0x458151[_0x120f('0x46')][_0x166fcd['id']]=new FreshdeskAccount(_0x166fcd);}else{_0x458151['mergeFromDatabase'](_0x458151['freshdeskAccounts'][_0x166fcd['id']],_0x166fcd);}}}return _0x458151[_0x120f('0x46')];};};Realtime[_0x120f('0x38')][_0x120f('0x47')]=function(){var _0x3b518e=this;return function(_0x206d10){if(_0x206d10){freeIsNotKey(_0x206d10,_0x3b518e[_0x120f('0x48')],'id');for(var _0x348e84=0x0,_0x5a2544={},_0x2abcb8={};_0x348e84<_0x206d10[_0x120f('0x39')];_0x348e84+=0x1){_0x5a2544=_0x206d10[_0x348e84];if(_['isUndefined'](_0x3b518e['zohoAccounts'][_0x5a2544['id']])){_0x3b518e['zohoAccounts'][_0x5a2544['id']]=new ZohoAccount(_0x5a2544);}else{_0x3b518e['mergeFromDatabase'](_0x3b518e[_0x120f('0x48')][_0x5a2544['id']],_0x5a2544);}}}return _0x3b518e[_0x120f('0x48')];};};Realtime['prototype'][_0x120f('0x49')]=function(){var _0x1ed94b=this;return function(_0x4f03fc){if(_0x4f03fc){freeIsNotKey(_0x4f03fc,_0x1ed94b['deskAccounts'],'id');for(var _0x2b25f6=0x0,_0x2bf6ed={},_0xed0c22={};_0x2b25f6<_0x4f03fc[_0x120f('0x39')];_0x2b25f6+=0x1){_0x2bf6ed=_0x4f03fc[_0x2b25f6];if(_[_0x120f('0x3a')](_0x1ed94b[_0x120f('0x4a')][_0x2bf6ed['id']])){_0x1ed94b[_0x120f('0x4a')][_0x2bf6ed['id']]=new DeskAccount(_0x2bf6ed);}else{_0x1ed94b[_0x120f('0x3b')](_0x1ed94b[_0x120f('0x4a')][_0x2bf6ed['id']],_0x2bf6ed);}}}return _0x1ed94b['deskAccounts'];};};Realtime[_0x120f('0x38')][_0x120f('0x4b')]=function(){var _0x36186d=this;return function(_0x3f52df){if(_0x3f52df){freeIsNotKey(_0x3f52df,_0x36186d[_0x120f('0x17')],'id');for(var _0x2f7cc8=0x0,_0x5dcc09={},_0x19cd69={};_0x2f7cc8<_0x3f52df[_0x120f('0x39')];_0x2f7cc8+=0x1){_0x5dcc09=_0x3f52df[_0x2f7cc8];if(_['isUndefined'](_0x36186d[_0x120f('0x17')][_0x5dcc09['id']])){_0x36186d[_0x120f('0x17')][_0x5dcc09['id']]=new SugarcrmAccount(_0x5dcc09);}else{_0x36186d[_0x120f('0x3b')](_0x36186d[_0x120f('0x17')][_0x5dcc09['id']],_0x5dcc09);}}}return _0x36186d[_0x120f('0x17')];};};Realtime[_0x120f('0x38')][_0x120f('0x4c')]=function(){var _0x300fec=this;return function(_0x471e79){if(_0x471e79){freeIsNotKey(_0x471e79,_0x300fec[_0x120f('0x18')],'id');for(var _0x298e89=0x0,_0x287ab5={},_0x2628ee={};_0x298e89<_0x471e79['length'];_0x298e89+=0x1){_0x287ab5=_0x471e79[_0x298e89];if(_['isUndefined'](_0x300fec[_0x120f('0x18')][_0x287ab5['id']])){_0x300fec['vtigerAccounts'][_0x287ab5['id']]=new VtigerAccount(_0x287ab5);}else{_0x300fec[_0x120f('0x3b')](_0x300fec['vtigerAccounts'][_0x287ab5['id']],_0x287ab5);}}}return _0x300fec[_0x120f('0x18')];};};Realtime[_0x120f('0x38')][_0x120f('0x4d')]=function(){var _0x348a87=this;return function(_0x1c13bf){if(_0x1c13bf){freeIsNotKey(_0x1c13bf,_0x348a87['servicenowAccounts'],'id');for(var _0xfc805=0x0,_0x2825fe={},_0x1871c3={};_0xfc805<_0x1c13bf[_0x120f('0x39')];_0xfc805+=0x1){_0x2825fe=_0x1c13bf[_0xfc805];if(_[_0x120f('0x3a')](_0x348a87['servicenowAccounts'][_0x2825fe['id']])){_0x348a87['servicenowAccounts'][_0x2825fe['id']]=new ServicenowAccount(_0x2825fe);}else{_0x348a87[_0x120f('0x3b')](_0x348a87[_0x120f('0x19')][_0x2825fe['id']],_0x2825fe);}}}return _0x348a87[_0x120f('0x19')];};};Realtime['prototype']['initDynamics365Accounts']=function(){var _0x3d4a54=this;return function(_0x47e3ee){if(_0x47e3ee){freeIsNotKey(_0x47e3ee,_0x3d4a54[_0x120f('0x1a')],'id');for(var _0x509ee7=0x0,_0x52183c={},_0x2d16fe={};_0x509ee7<_0x47e3ee[_0x120f('0x39')];_0x509ee7+=0x1){_0x52183c=_0x47e3ee[_0x509ee7];if(_[_0x120f('0x3a')](_0x3d4a54[_0x120f('0x1a')][_0x52183c['id']])){_0x3d4a54[_0x120f('0x1a')][_0x52183c['id']]=new Dynamics365Account(_0x52183c);}else{_0x3d4a54[_0x120f('0x3b')](_0x3d4a54[_0x120f('0x1a')][_0x52183c['id']],_0x52183c);}}}return _0x3d4a54[_0x120f('0x1a')];};};Realtime['prototype'][_0x120f('0x4e')]=function(){var _0x534f18=this;return function(_0x10b6bb){if(_0x10b6bb){freeIsNotKey(_0x10b6bb,_0x534f18[_0x120f('0x1b')],'id');for(var _0x4c2963=0x0,_0xc2ca88={},_0x37b44c={};_0x4c2963<_0x10b6bb['length'];_0x4c2963+=0x1){_0xc2ca88=_0x10b6bb[_0x4c2963];if(_[_0x120f('0x3a')](_0x534f18['freshsalesAccounts'][_0xc2ca88['id']])){_0x534f18[_0x120f('0x1b')][_0xc2ca88['id']]=new FreshsalesAccount(_0xc2ca88);}else{_0x534f18['mergeFromDatabase'](_0x534f18['freshsalesAccounts'][_0xc2ca88['id']],_0xc2ca88);}}}return _0x534f18[_0x120f('0x1b')];};};Realtime[_0x120f('0x38')]['initVoiceQueueHopperHistory']=function(){var _0x69f361=this;return function(_0x4f748d){for(var _0x165d39=0x0;_0x165d39<_0x4f748d[_0x120f('0x39')];_0x165d39+=0x1){_['merge'](_0x69f361[_0x120f('0x10')][_0x4f748d[_0x165d39]['name']],_0x4f748d[_0x165d39]);}return _0x69f361['voiceQueues'];};};Realtime[_0x120f('0x38')][_0x120f('0x4f')]=function(){var _0x19a513=this;return function(_0x30d2ca){clearVoiceQueues(_0x19a513[_0x120f('0x10')]);if(_0x30d2ca){_0x30d2ca=_['groupBy'](_0x30d2ca,'uniqueid');for(var _0x41c40a in _0x30d2ca){if(_0x30d2ca[_0x120f('0x1e')](_0x41c40a)){var _0x53c1ed={};for(var _0x55c16d=0x0;_0x55c16d<_0x30d2ca[_0x41c40a][_0x120f('0x39')];_0x55c16d+=0x1){var _0x58e159=_0x30d2ca[_0x41c40a][_0x55c16d][_0x120f('0x50')];if(_0x19a513['voiceQueues'][_0x58e159]){if(_0x30d2ca[_0x41c40a][_0x55c16d][_0x120f('0x51')]){_0x19a513[_0x120f('0x10')][_0x58e159]['unmanaged']+=0x1;}if(_0x30d2ca[_0x41c40a][_0x55c16d]['queuecallerabandon']){_0x19a513[_0x120f('0x10')][_0x58e159][_0x120f('0x2b')]+=0x1;}_0x19a513[_0x120f('0x10')][_0x58e159][_0x120f('0x26')]+=moment(_0x30d2ca[_0x41c40a][_0x55c16d][_0x120f('0x52')])[_0x120f('0x53')](moment(_0x30d2ca[_0x41c40a][_0x55c16d]['queuecallerjoinAt']),_0x120f('0x54'))||0x0;if(_0x55c16d===_0x30d2ca[_0x41c40a][_0x120f('0x39')]-0x1){_0x19a513[_0x120f('0x10')][_0x58e159][_0x120f('0x27')]+=moment(_0x30d2ca[_0x41c40a][_0x55c16d]['queuecallercompleteAt']||_0x30d2ca[_0x41c40a][_0x55c16d]['queuecallerabandonAt']||_0x30d2ca[_0x41c40a][_0x55c16d][_0x120f('0x55')])[_0x120f('0x53')](moment(_0x30d2ca[_0x41c40a][_0x55c16d][_0x120f('0x56')]),_0x120f('0x54'))||0x0;_0x19a513[_0x120f('0x10')][_0x58e159]['total']+=0x1;if(_0x30d2ca[_0x41c40a][_0x55c16d][_0x120f('0x57')]){_0x19a513['voiceQueues'][_0x58e159]['answered']+=0x1;_0x19a513[_0x120f('0x10')][_0x58e159][_0x120f('0x2c')]+=moment(_0x30d2ca[_0x41c40a][_0x55c16d]['queuecallercompleteAt'])[_0x120f('0x53')](moment(_0x30d2ca[_0x41c40a][_0x55c16d]['queuecallerleaveAt']),_0x120f('0x54'))||0x0;}}else{_0x19a513[_0x120f('0x10')][_0x58e159][_0x120f('0x27')]+=_0x19a513[_0x120f('0x10')][_0x58e159]['sumHoldTime']||0x0;}}}}}}return _0x19a513[_0x120f('0x10')];};};Realtime['prototype']['initVoiceCallReports']=function(){var _0x766b8f=this;return function(_0x3a7310){clearVoiceCallReports(_0x766b8f['outbound']);if(_0x3a7310){for(var _0x4260ba=0x0;_0x4260ba<_0x3a7310[_0x120f('0x39')];_0x4260ba+=0x1){_0x766b8f['outbound'][_0x120f('0x24')]+=0x1;_0x766b8f[_0x120f('0x58')][_0x120f('0x27')]+=_0x3a7310[_0x4260ba][_0x120f('0x59')];if(_0x3a7310[_0x4260ba][_0x120f('0x5a')]===_0x120f('0x5b')){_0x766b8f[_0x120f('0x58')][_0x120f('0x25')]+=0x1;_0x766b8f['outbound'][_0x120f('0x26')]+=_0x3a7310[_0x4260ba][_0x120f('0x59')]-_0x3a7310[_0x4260ba][_0x120f('0x5c')]||0x0;_0x766b8f[_0x120f('0x58')][_0x120f('0x2c')]+=_0x3a7310[_0x4260ba][_0x120f('0x5c')];}}}return _0x766b8f['outbound'];};};Realtime['prototype'][_0x120f('0x5d')]=function(){var _0x4539fb=this;return function(_0x48a39f){if(_0x48a39f){freeIsNotKey(_0x48a39f,_0x4539fb[_0x120f('0x5e')],_0x120f('0x20'));for(var _0x492837=0x0,_0x490e96={};_0x492837<_0x48a39f[_0x120f('0x39')];_0x492837+=0x1){_0x490e96=_0x48a39f[_0x492837];if(_[_0x120f('0x3a')](_0x4539fb[_0x120f('0x5e')][_0x490e96['name']])){_0x4539fb[_0x120f('0x5e')][_0x490e96[_0x120f('0x20')]]=new Campaign(_0x490e96);}else{_0x4539fb[_0x120f('0x3b')](_0x4539fb[_0x120f('0x5e')][_0x490e96[_0x120f('0x20')]],_0x490e96);_0x4539fb[_0x120f('0x5e')][_0x490e96[_0x120f('0x20')]]['dialQueueProject']=_0x490e96['SquareProject']?_0x490e96[_0x120f('0x5f')][_0x120f('0x20')]:undefined;}}}return _0x4539fb[_0x120f('0x5e')];};};Realtime['prototype'][_0x120f('0x60')]=function(){var _0x30abe1=this;return function(_0x1e223c){if(_0x1e223c){freeIsNotKey(_0x1e223c,_0x30abe1['voiceExtensions'],'id');for(var _0x4c0056=0x0,_0x49210e={};_0x4c0056<_0x1e223c['length'];_0x4c0056+=0x1){_0x49210e=_0x1e223c[_0x4c0056];if(_[_0x120f('0x3a')](_0x30abe1[_0x120f('0x12')][_0x49210e['id']])){_0x30abe1[_0x120f('0x12')][_0x49210e['id']]=new VoiceExtension(_0x49210e);}else{_0x30abe1['mergeFromDatabase'](_0x30abe1[_0x120f('0x12')][_0x49210e['id']],_0x49210e);}}}return _0x30abe1[_0x120f('0x12')];};};Realtime[_0x120f('0x38')][_0x120f('0x61')]=function(){var _0x3d5afc=this;return function(_0xa7a8fc){clearCampaigns(_0x3d5afc['campaigns']);for(var _0x10a798=0x0;_0x10a798<_0xa7a8fc[_0x120f('0x39')];_0x10a798+=0x1){_['merge'](_0x3d5afc[_0x120f('0x5e')][_0xa7a8fc[_0x10a798][_0x120f('0x20')]],_0xa7a8fc[_0x10a798]);}return _0x3d5afc['campaigns'];};};Realtime[_0x120f('0x38')]['initFaxAccounts']=function(){var _0x35c858=this;return function(_0x4c6e17){if(_0x4c6e17){freeIsNotKey(_0x4c6e17,_0x35c858[_0x120f('0x1c')],'id');for(var _0x4bb101=0x0,_0xbdae16={},_0x5a8051={};_0x4bb101<_0x4c6e17[_0x120f('0x39')];_0x4bb101+=0x1){_0xbdae16=_0x4c6e17[_0x4bb101];if(_[_0x120f('0x3a')](_0x35c858[_0x120f('0x1c')][_0xbdae16['id']])){_0x35c858[_0x120f('0x1c')][_0xbdae16['id']]=new FaxAccount(_0xbdae16);}else{_0x35c858[_0x120f('0x3b')](_0x35c858[_0x120f('0x1c')][_0xbdae16['id']],_0xbdae16);}}}return _0x35c858[_0x120f('0x1c')];};};module['exports']=Realtime;
\ No newline at end of file