Built motion from commit 43538d75.|2.5.35
[motion2.git] / server / services / ami / realtime / index.js
index 2121c53..f2cf31f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-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
+var _0x5c86=['answered','sumDuration','sumBillable','isEmpty','total','unmanaged','abandoned','sumHoldTime','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundOriginateFailureCallsDay','outboundRejectCallsDay','queueStatusComplete','prototype','initAgents','agents','length','isUndefined','telephones','mergeFromDatabase','initTrunks','trunks','initTriggers','initTemplates','zendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','initZohoAccounts','initSugarcrmAccounts','initVtigerAccounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','groupBy','queue','queuecallerexit','queuecallerabandon','queuecallerleaveAt','diff','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','queuecallerjoinAt','seconds','queuecallercomplete','initVoiceCallReports','duration','disposition','ANSWERED','billableseconds','dialQueueProject','SquareProject','initVoiceExtensions','initCampaignHopperHistory','initFaxAccounts','exports','bluebird','lodash','moment','../model/agent','../model/trunk','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/zendeskAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/faxAccount','voiceQueues','triggers','campaigns','templates','outbound','voiceExtensions','channels','timers','settings','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty','format','SIP/%s','name','isNil','interface'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x5c86,0x1e1));var _0x65c8=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x5c86[_0x1facfa];return _0x9ec701;};'use strict';var BPromise=require(_0x65c8('0x0'));var util=require('util');var _=require(_0x65c8('0x1'));var moment=require(_0x65c8('0x2'));var Agent=require(_0x65c8('0x3'));var Telephone=require('../model/telephone');var Trunk=require(_0x65c8('0x4'));var VoiceQueue=require(_0x65c8('0x5'));var Trigger=require(_0x65c8('0x6'));var Template=require(_0x65c8('0x7'));var Campaign=require(_0x65c8('0x8'));var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require(_0x65c8('0x9'));var SalesforceAccount=require('../model/salesforceAccount');var FreshdeskAccount=require(_0x65c8('0xa'));var SugarcrmAccount=require(_0x65c8('0xb'));var ZohoAccount=require(_0x65c8('0xc'));var DeskAccount=require(_0x65c8('0xd'));var VtigerAccount=require(_0x65c8('0xe'));var ServicenowAccount=require(_0x65c8('0xf'));var Dynamics365Account=require(_0x65c8('0x10'));var FreshsalesAccount=require('../model/freshsalesAccount');var FaxAccount=require(_0x65c8('0x11'));var Realtime=function(){this['agents']={};this['telephones']={};this['trunks']={};this[_0x65c8('0x12')]={};this[_0x65c8('0x13')]={};this[_0x65c8('0x14')]={};this[_0x65c8('0x15')]={};this[_0x65c8('0x16')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x65c8('0x17')]={};this[_0x65c8('0x18')]={};this['queueChannels']={};this['outboundChannels']={};this[_0x65c8('0x19')]={};this[_0x65c8('0x1a')]={};this['zendeskAccounts']={};this[_0x65c8('0x1b')]={};this[_0x65c8('0x1c')]={};this[_0x65c8('0x1d')]={};this[_0x65c8('0x1e')]={};this[_0x65c8('0x1f')]={};this[_0x65c8('0x20')]={};this[_0x65c8('0x21')]={};this[_0x65c8('0x22')]={};this[_0x65c8('0x23')]={};this[_0x65c8('0x24')]={};};function freeIsNotKey(_0x40e9d0,_0xc9e503,_0x1cfb34){var _0x352c02=_[_0x65c8('0x25')](_0x40e9d0,function(_0x5d5a1b,_0x5ae98a){return _0x5d5a1b[_0x1cfb34];});for(var _0x246126 in _0xc9e503){if(_0xc9e503[_0x65c8('0x26')](_0x246126)){if(!_0x352c02[_0x246126]){delete _0xc9e503[_0x246126];}}}}function freeIsNotKeySip(_0x3d0ea9,_0x256c95){var _0xbe7ab2=_[_0x65c8('0x25')](_0x3d0ea9,function(_0xc51063,_0x25868a){return util[_0x65c8('0x27')](_0x65c8('0x28'),_0xc51063[_0x65c8('0x29')]);});for(var _0x9de8c1 in _0x256c95){if(_0x256c95[_0x65c8('0x26')](_0x9de8c1)){if(!_0xbe7ab2[_0x9de8c1]){delete _0x256c95[_0x9de8c1];}}}}function freeIsNotKeyAgent(_0x497956,_0x22dafe){var _0x38e9a9=_[_0x65c8('0x25')](_0x497956,function(_0x24c03e,_0x29e7f0){var _0x19aae8=_[_0x65c8('0x2a')](_0x24c03e[_0x65c8('0x2b')])?util[_0x65c8('0x27')](_0x65c8('0x28'),_0x24c03e[_0x65c8('0x29')]):_0x24c03e[_0x65c8('0x2b')];return _0x19aae8;});for(var _0x23bee5 in _0x22dafe){if(_0x22dafe[_0x65c8('0x26')](_0x23bee5)){if(!_0x38e9a9[_0x23bee5]){delete _0x22dafe[_0x23bee5];}}}}function clearVoiceCallReports(_0x5acb0b){_0x5acb0b['total']=0x0;_0x5acb0b[_0x65c8('0x2c')]=0x0;_0x5acb0b['sumHoldTime']=0x0;_0x5acb0b[_0x65c8('0x2d')]=0x0;_0x5acb0b[_0x65c8('0x2e')]=0x0;}function clearCampaigns(_0xd8e0e1){if(!_[_0x65c8('0x2f')](_0xd8e0e1)){for(var _0x5aa0b3 in _0xd8e0e1){if(_0xd8e0e1[_0x65c8('0x26')](_0x5aa0b3)){_0xd8e0e1[_0x5aa0b3]['ivrTotalCallsDays']=0x0;_0xd8e0e1[_0x5aa0b3]['ivrAnswerCallsDay']=0x0;}}}}function clearVoiceQueues(_0x238f0e){if(!_[_0x65c8('0x2f')](_0x238f0e)){for(var _0x26906e in _0x238f0e){if(_0x238f0e[_0x65c8('0x26')](_0x26906e)){_0x238f0e[_0x26906e][_0x65c8('0x30')]=0x0;_0x238f0e[_0x26906e][_0x65c8('0x2c')]=0x0;_0x238f0e[_0x26906e][_0x65c8('0x31')]=0x0;_0x238f0e[_0x26906e][_0x65c8('0x32')]=0x0;_0x238f0e[_0x26906e][_0x65c8('0x33')]=0x0;_0x238f0e[_0x26906e][_0x65c8('0x2d')]=0x0;_0x238f0e[_0x26906e]['sumBillable']=0x0;_0x238f0e[_0x26906e][_0x65c8('0x34')]=0x0;_0x238f0e[_0x26906e][_0x65c8('0x35')]=0x0;_0x238f0e[_0x26906e][_0x65c8('0x36')]=0x0;_0x238f0e[_0x26906e]['outboundCongestionCallsDay']=0x0;_0x238f0e[_0x26906e][_0x65c8('0x37')]=0x0;_0x238f0e[_0x26906e]['outboundUnknownCallsDay']=0x0;_0x238f0e[_0x26906e][_0x65c8('0x38')]=0x0;_0x238f0e[_0x26906e][_0x65c8('0x39')]=0x0;_0x238f0e[_0x26906e]['outboundBlacklistCallsDay']=0x0;_0x238f0e[_0x26906e][_0x65c8('0x3a')]=0x0;_0x238f0e[_0x26906e][_0x65c8('0x3b')]=0x0;_0x238f0e[_0x26906e]['outboundReCallsDay']=0x0;_0x238f0e[_0x26906e][_0x65c8('0x34')]=0x0;_0x238f0e[_0x26906e]['outboundAnswerCallsDay']=0x0;_0x238f0e[_0x26906e][_0x65c8('0x3c')]=!![];}}}}Realtime[_0x65c8('0x3d')]['mergeFromDatabase']=function(_0x3ea448,_0x4ba2eb){for(var _0x45aa94 in _0x4ba2eb){if(_0x3ea448['hasOwnProperty'](_0x45aa94)){_0x3ea448[_0x45aa94]=_0x4ba2eb[_0x45aa94];}}};Realtime[_0x65c8('0x3d')][_0x65c8('0x3e')]=function(){var _0x2c1f05=this;return function(_0x4515d0){if(_0x4515d0){freeIsNotKeyAgent(_0x4515d0,_0x2c1f05[_0x65c8('0x3f')]);for(var _0xcdb958=0x0,_0x222b30={},_0x17c923={};_0xcdb958<_0x4515d0[_0x65c8('0x40')];_0xcdb958+=0x1){_0x222b30=_0x4515d0[_0xcdb958];var _0x2992c8=_[_0x65c8('0x2a')](_0x222b30[_0x65c8('0x2b')])?util[_0x65c8('0x27')](_0x65c8('0x28'),_0x222b30[_0x65c8('0x29')]):_0x222b30['interface'];if(_[_0x65c8('0x41')](_0x2c1f05['agents'][_0x2992c8])){_0x2c1f05[_0x65c8('0x3f')][_0x2992c8]=new Agent(_0x222b30);}else{_0x2c1f05['mergeFromDatabase'](_0x2c1f05['agents'][_0x2992c8],_0x222b30);}}}return _0x2c1f05['agents'];};};Realtime[_0x65c8('0x3d')]['initTelephones']=function(){var _0x3c5651=this;return function(_0x3cb6ab){if(_0x3cb6ab){freeIsNotKeySip(_0x3cb6ab,_0x3c5651[_0x65c8('0x42')]);for(var _0x4c9dca=0x0,_0x1c2cfc={},_0x161058={};_0x4c9dca<_0x3cb6ab[_0x65c8('0x40')];_0x4c9dca+=0x1){_0x1c2cfc=_0x3cb6ab[_0x4c9dca];if(_[_0x65c8('0x41')](_0x3c5651[_0x65c8('0x42')][util[_0x65c8('0x27')](_0x65c8('0x28'),_0x1c2cfc[_0x65c8('0x29')])])){_0x3c5651[_0x65c8('0x42')][util[_0x65c8('0x27')]('SIP/%s',_0x1c2cfc[_0x65c8('0x29')])]=new Telephone(_0x1c2cfc);}else{_0x3c5651[_0x65c8('0x43')](_0x3c5651[_0x65c8('0x42')][util[_0x65c8('0x27')](_0x65c8('0x28'),_0x1c2cfc[_0x65c8('0x29')])],_0x1c2cfc);}}}return _0x3c5651[_0x65c8('0x42')];};};Realtime[_0x65c8('0x3d')][_0x65c8('0x44')]=function(){var _0x15793b=this;return function(_0x1381ef){if(_0x1381ef){freeIsNotKeySip(_0x1381ef,_0x15793b[_0x65c8('0x45')]);for(var _0x27bea6=0x0,_0x3632d9={},_0x224fcd={};_0x27bea6<_0x1381ef[_0x65c8('0x40')];_0x27bea6+=0x1){_0x3632d9=_0x1381ef[_0x27bea6];if(_[_0x65c8('0x41')](_0x15793b['trunks'][util[_0x65c8('0x27')](_0x65c8('0x28'),_0x3632d9['name'])])){_0x15793b['trunks'][util['format'](_0x65c8('0x28'),_0x3632d9[_0x65c8('0x29')])]=new Trunk(_0x3632d9);}else{_0x15793b[_0x65c8('0x43')](_0x15793b[_0x65c8('0x45')][util[_0x65c8('0x27')](_0x65c8('0x28'),_0x3632d9[_0x65c8('0x29')])],_0x3632d9);}}}return _0x15793b[_0x65c8('0x45')];};};Realtime[_0x65c8('0x3d')]['initVoiceQueues']=function(){var _0x3f55c4=this;return function(_0x22295b){if(_0x22295b){freeIsNotKey(_0x22295b,_0x3f55c4['voiceQueues'],'name');for(var _0x5254c9=0x0,_0x26dc74={},_0x2f2bd8={};_0x5254c9<_0x22295b['length'];_0x5254c9+=0x1){_0x26dc74=_0x22295b[_0x5254c9];if(_['isUndefined'](_0x3f55c4[_0x65c8('0x12')][_0x26dc74['name']])){_0x3f55c4[_0x65c8('0x12')][_0x26dc74[_0x65c8('0x29')]]=new VoiceQueue(_0x26dc74);}else{_0x3f55c4[_0x65c8('0x43')](_0x3f55c4['voiceQueues'][_0x26dc74['name']],_0x26dc74);}}}return _0x3f55c4['voiceQueues'];};};Realtime[_0x65c8('0x3d')][_0x65c8('0x46')]=function(){var _0x183ac0=this;return function(_0x3c5044){if(_0x3c5044){freeIsNotKey(_0x3c5044,_0x183ac0[_0x65c8('0x13')],'id');for(var _0x1cbdf9=0x0,_0x2e72b9={},_0xf32636={};_0x1cbdf9<_0x3c5044[_0x65c8('0x40')];_0x1cbdf9+=0x1){_0x2e72b9=_0x3c5044[_0x1cbdf9];if(_[_0x65c8('0x41')](_0x183ac0[_0x65c8('0x13')][_0x2e72b9['id']])){_0x183ac0['triggers'][_0x2e72b9['id']]=new Trigger(_0x2e72b9);}else{_0x183ac0[_0x65c8('0x43')](_0x183ac0[_0x65c8('0x13')][_0x2e72b9['id']],_0x2e72b9);}}}return _0x183ac0[_0x65c8('0x13')];};};Realtime[_0x65c8('0x3d')][_0x65c8('0x47')]=function(){var _0x119c8c=this;return function(_0x8c28ff){if(_0x8c28ff){freeIsNotKey(_0x8c28ff,_0x119c8c[_0x65c8('0x15')],'id');for(var _0x3616c5=0x0,_0x9a71fc={},_0xb43130={};_0x3616c5<_0x8c28ff[_0x65c8('0x40')];_0x3616c5+=0x1){_0x9a71fc=_0x8c28ff[_0x3616c5];if(_['isUndefined'](_0x119c8c['templates'][_0x9a71fc['id']])){_0x119c8c[_0x65c8('0x15')][_0x9a71fc['id']]=new Template(_0x9a71fc);}else{_0x119c8c[_0x65c8('0x43')](_0x119c8c[_0x65c8('0x15')][_0x9a71fc['id']],_0x9a71fc);}}}return _0x119c8c['templates'];};};Realtime['prototype']['initZendeskAccounts']=function(){var _0x4d57a2=this;return function(_0x322e3e){if(_0x322e3e){freeIsNotKey(_0x322e3e,_0x4d57a2['zendeskAccounts'],'id');for(var _0x52c6e0=0x0,_0x48b028={},_0x5cd6f={};_0x52c6e0<_0x322e3e['length'];_0x52c6e0+=0x1){_0x48b028=_0x322e3e[_0x52c6e0];if(_[_0x65c8('0x41')](_0x4d57a2[_0x65c8('0x48')][_0x48b028['id']])){_0x4d57a2['zendeskAccounts'][_0x48b028['id']]=new ZendeskAccount(_0x48b028);}else{_0x4d57a2['mergeFromDatabase'](_0x4d57a2[_0x65c8('0x48')][_0x48b028['id']],_0x48b028);}}}return _0x4d57a2[_0x65c8('0x48')];};};Realtime[_0x65c8('0x3d')][_0x65c8('0x49')]=function(){var _0x599389=this;return function(_0x2a1517){if(_0x2a1517){freeIsNotKey(_0x2a1517,_0x599389[_0x65c8('0x1b')],'id');for(var _0x408dfc=0x0,_0x140264={},_0x48d73d={};_0x408dfc<_0x2a1517[_0x65c8('0x40')];_0x408dfc+=0x1){_0x140264=_0x2a1517[_0x408dfc];if(_[_0x65c8('0x41')](_0x599389[_0x65c8('0x1b')][_0x140264['id']])){_0x599389['salesforceAccounts'][_0x140264['id']]=new SalesforceAccount(_0x140264);}else{_0x599389[_0x65c8('0x43')](_0x599389[_0x65c8('0x1b')][_0x140264['id']],_0x140264);}}}return _0x599389[_0x65c8('0x1b')];};};Realtime[_0x65c8('0x3d')][_0x65c8('0x4a')]=function(){var _0x51f7b7=this;return function(_0x2c05a9){if(_0x2c05a9){freeIsNotKey(_0x2c05a9,_0x51f7b7[_0x65c8('0x1d')],'id');for(var _0x22ba25=0x0,_0x325d1f={},_0x1d7f94={};_0x22ba25<_0x2c05a9[_0x65c8('0x40')];_0x22ba25+=0x1){_0x325d1f=_0x2c05a9[_0x22ba25];if(_[_0x65c8('0x41')](_0x51f7b7[_0x65c8('0x1d')][_0x325d1f['id']])){_0x51f7b7[_0x65c8('0x1d')][_0x325d1f['id']]=new FreshdeskAccount(_0x325d1f);}else{_0x51f7b7[_0x65c8('0x43')](_0x51f7b7[_0x65c8('0x1d')][_0x325d1f['id']],_0x325d1f);}}}return _0x51f7b7[_0x65c8('0x1d')];};};Realtime[_0x65c8('0x3d')][_0x65c8('0x4b')]=function(){var _0x5af756=this;return function(_0x432590){if(_0x432590){freeIsNotKey(_0x432590,_0x5af756['zohoAccounts'],'id');for(var _0x369d5f=0x0,_0x1756d0={},_0x3ca2cc={};_0x369d5f<_0x432590[_0x65c8('0x40')];_0x369d5f+=0x1){_0x1756d0=_0x432590[_0x369d5f];if(_[_0x65c8('0x41')](_0x5af756[_0x65c8('0x1e')][_0x1756d0['id']])){_0x5af756[_0x65c8('0x1e')][_0x1756d0['id']]=new ZohoAccount(_0x1756d0);}else{_0x5af756[_0x65c8('0x43')](_0x5af756[_0x65c8('0x1e')][_0x1756d0['id']],_0x1756d0);}}}return _0x5af756[_0x65c8('0x1e')];};};Realtime[_0x65c8('0x3d')]['initDeskAccounts']=function(){var _0x24c435=this;return function(_0x56db09){if(_0x56db09){freeIsNotKey(_0x56db09,_0x24c435[_0x65c8('0x1f')],'id');for(var _0x4d735b=0x0,_0x19b30e={},_0x2f6cc4={};_0x4d735b<_0x56db09['length'];_0x4d735b+=0x1){_0x19b30e=_0x56db09[_0x4d735b];if(_['isUndefined'](_0x24c435[_0x65c8('0x1f')][_0x19b30e['id']])){_0x24c435['deskAccounts'][_0x19b30e['id']]=new DeskAccount(_0x19b30e);}else{_0x24c435[_0x65c8('0x43')](_0x24c435[_0x65c8('0x1f')][_0x19b30e['id']],_0x19b30e);}}}return _0x24c435[_0x65c8('0x1f')];};};Realtime[_0x65c8('0x3d')][_0x65c8('0x4c')]=function(){var _0x2a3d58=this;return function(_0x4f302f){if(_0x4f302f){freeIsNotKey(_0x4f302f,_0x2a3d58[_0x65c8('0x1c')],'id');for(var _0x292959=0x0,_0x5b597e={},_0x430364={};_0x292959<_0x4f302f['length'];_0x292959+=0x1){_0x5b597e=_0x4f302f[_0x292959];if(_[_0x65c8('0x41')](_0x2a3d58[_0x65c8('0x1c')][_0x5b597e['id']])){_0x2a3d58['sugarcrmAccounts'][_0x5b597e['id']]=new SugarcrmAccount(_0x5b597e);}else{_0x2a3d58['mergeFromDatabase'](_0x2a3d58[_0x65c8('0x1c')][_0x5b597e['id']],_0x5b597e);}}}return _0x2a3d58[_0x65c8('0x1c')];};};Realtime[_0x65c8('0x3d')][_0x65c8('0x4d')]=function(){var _0x33eb1e=this;return function(_0x1878b5){if(_0x1878b5){freeIsNotKey(_0x1878b5,_0x33eb1e[_0x65c8('0x20')],'id');for(var _0x316595=0x0,_0xb994b6={},_0x5db8bb={};_0x316595<_0x1878b5['length'];_0x316595+=0x1){_0xb994b6=_0x1878b5[_0x316595];if(_[_0x65c8('0x41')](_0x33eb1e[_0x65c8('0x20')][_0xb994b6['id']])){_0x33eb1e[_0x65c8('0x20')][_0xb994b6['id']]=new VtigerAccount(_0xb994b6);}else{_0x33eb1e['mergeFromDatabase'](_0x33eb1e[_0x65c8('0x20')][_0xb994b6['id']],_0xb994b6);}}}return _0x33eb1e[_0x65c8('0x20')];};};Realtime['prototype']['initServicenowAccounts']=function(){var _0xe7a241=this;return function(_0x501dbe){if(_0x501dbe){freeIsNotKey(_0x501dbe,_0xe7a241[_0x65c8('0x21')],'id');for(var _0x3f90d6=0x0,_0x4c033={},_0x211fea={};_0x3f90d6<_0x501dbe[_0x65c8('0x40')];_0x3f90d6+=0x1){_0x4c033=_0x501dbe[_0x3f90d6];if(_[_0x65c8('0x41')](_0xe7a241[_0x65c8('0x21')][_0x4c033['id']])){_0xe7a241[_0x65c8('0x21')][_0x4c033['id']]=new ServicenowAccount(_0x4c033);}else{_0xe7a241[_0x65c8('0x43')](_0xe7a241[_0x65c8('0x21')][_0x4c033['id']],_0x4c033);}}}return _0xe7a241[_0x65c8('0x21')];};};Realtime[_0x65c8('0x3d')]['initDynamics365Accounts']=function(){var _0x420387=this;return function(_0x3515d9){if(_0x3515d9){freeIsNotKey(_0x3515d9,_0x420387[_0x65c8('0x22')],'id');for(var _0x483656=0x0,_0x1957aa={},_0x20ff41={};_0x483656<_0x3515d9[_0x65c8('0x40')];_0x483656+=0x1){_0x1957aa=_0x3515d9[_0x483656];if(_[_0x65c8('0x41')](_0x420387[_0x65c8('0x22')][_0x1957aa['id']])){_0x420387[_0x65c8('0x22')][_0x1957aa['id']]=new Dynamics365Account(_0x1957aa);}else{_0x420387[_0x65c8('0x43')](_0x420387[_0x65c8('0x22')][_0x1957aa['id']],_0x1957aa);}}}return _0x420387['dynamics365Accounts'];};};Realtime['prototype'][_0x65c8('0x4e')]=function(){var _0x273db6=this;return function(_0x428ad3){if(_0x428ad3){freeIsNotKey(_0x428ad3,_0x273db6[_0x65c8('0x23')],'id');for(var _0x158402=0x0,_0x105601={},_0x261e2e={};_0x158402<_0x428ad3[_0x65c8('0x40')];_0x158402+=0x1){_0x105601=_0x428ad3[_0x158402];if(_['isUndefined'](_0x273db6[_0x65c8('0x23')][_0x105601['id']])){_0x273db6[_0x65c8('0x23')][_0x105601['id']]=new FreshsalesAccount(_0x105601);}else{_0x273db6[_0x65c8('0x43')](_0x273db6[_0x65c8('0x23')][_0x105601['id']],_0x105601);}}}return _0x273db6[_0x65c8('0x23')];};};Realtime[_0x65c8('0x3d')][_0x65c8('0x4f')]=function(){var _0x41cb4b=this;return function(_0x51b013){for(var _0x20bb4f=0x0;_0x20bb4f<_0x51b013[_0x65c8('0x40')];_0x20bb4f+=0x1){_[_0x65c8('0x50')](_0x41cb4b[_0x65c8('0x12')][_0x51b013[_0x20bb4f]['name']],_0x51b013[_0x20bb4f]);}return _0x41cb4b['voiceQueues'];};};Realtime[_0x65c8('0x3d')][_0x65c8('0x51')]=function(){var _0x2dfaa1=this;return function(_0x20b682){clearVoiceQueues(_0x2dfaa1[_0x65c8('0x12')]);if(_0x20b682){_0x20b682=_[_0x65c8('0x52')](_0x20b682,'uniqueid');for(var _0x2c4e82 in _0x20b682){if(_0x20b682[_0x65c8('0x26')](_0x2c4e82)){var _0x3fc04d={};for(var _0x4fc1a8=0x0;_0x4fc1a8<_0x20b682[_0x2c4e82][_0x65c8('0x40')];_0x4fc1a8+=0x1){var _0x1a746a=_0x20b682[_0x2c4e82][_0x4fc1a8][_0x65c8('0x53')];if(_0x2dfaa1[_0x65c8('0x12')][_0x1a746a]){if(_0x20b682[_0x2c4e82][_0x4fc1a8][_0x65c8('0x54')]){_0x2dfaa1[_0x65c8('0x12')][_0x1a746a][_0x65c8('0x31')]+=0x1;}if(_0x20b682[_0x2c4e82][_0x4fc1a8][_0x65c8('0x55')]){_0x2dfaa1['voiceQueues'][_0x1a746a][_0x65c8('0x32')]+=0x1;}_0x2dfaa1[_0x65c8('0x12')][_0x1a746a]['sumHoldTime']+=moment(_0x20b682[_0x2c4e82][_0x4fc1a8][_0x65c8('0x56')])[_0x65c8('0x57')](moment(_0x20b682[_0x2c4e82][_0x4fc1a8]['queuecallerjoinAt']),'seconds')||0x0;if(_0x4fc1a8===_0x20b682[_0x2c4e82]['length']-0x1){_0x2dfaa1[_0x65c8('0x12')][_0x1a746a][_0x65c8('0x2d')]+=moment(_0x20b682[_0x2c4e82][_0x4fc1a8][_0x65c8('0x58')]||_0x20b682[_0x2c4e82][_0x4fc1a8][_0x65c8('0x59')]||_0x20b682[_0x2c4e82][_0x4fc1a8][_0x65c8('0x5a')])[_0x65c8('0x57')](moment(_0x20b682[_0x2c4e82][_0x4fc1a8][_0x65c8('0x5b')]),_0x65c8('0x5c'))||0x0;_0x2dfaa1[_0x65c8('0x12')][_0x1a746a][_0x65c8('0x30')]+=0x1;if(_0x20b682[_0x2c4e82][_0x4fc1a8][_0x65c8('0x5d')]){_0x2dfaa1[_0x65c8('0x12')][_0x1a746a][_0x65c8('0x2c')]+=0x1;_0x2dfaa1[_0x65c8('0x12')][_0x1a746a][_0x65c8('0x2e')]+=moment(_0x20b682[_0x2c4e82][_0x4fc1a8]['queuecallercompleteAt'])[_0x65c8('0x57')](moment(_0x20b682[_0x2c4e82][_0x4fc1a8]['queuecallerleaveAt']),_0x65c8('0x5c'))||0x0;}}else{_0x2dfaa1[_0x65c8('0x12')][_0x1a746a][_0x65c8('0x2d')]+=_0x2dfaa1[_0x65c8('0x12')][_0x1a746a][_0x65c8('0x33')]||0x0;}}}}}}return _0x2dfaa1[_0x65c8('0x12')];};};Realtime[_0x65c8('0x3d')][_0x65c8('0x5e')]=function(){var _0x23c94d=this;return function(_0x1bb98c){clearVoiceCallReports(_0x23c94d[_0x65c8('0x16')]);if(_0x1bb98c){for(var _0x5cc767=0x0;_0x5cc767<_0x1bb98c['length'];_0x5cc767+=0x1){_0x23c94d[_0x65c8('0x16')][_0x65c8('0x30')]+=0x1;_0x23c94d[_0x65c8('0x16')][_0x65c8('0x2d')]+=_0x1bb98c[_0x5cc767][_0x65c8('0x5f')];if(_0x1bb98c[_0x5cc767][_0x65c8('0x60')]===_0x65c8('0x61')){_0x23c94d['outbound'][_0x65c8('0x2c')]+=0x1;_0x23c94d[_0x65c8('0x16')][_0x65c8('0x33')]+=_0x1bb98c[_0x5cc767][_0x65c8('0x5f')]-_0x1bb98c[_0x5cc767]['billableseconds']||0x0;_0x23c94d['outbound']['sumBillable']+=_0x1bb98c[_0x5cc767][_0x65c8('0x62')];}}}return _0x23c94d[_0x65c8('0x16')];};};Realtime[_0x65c8('0x3d')]['initCampaigns']=function(){var _0x3428cd=this;return function(_0x40110f){if(_0x40110f){freeIsNotKey(_0x40110f,_0x3428cd['campaigns'],_0x65c8('0x29'));for(var _0x381638=0x0,_0x58c547={};_0x381638<_0x40110f[_0x65c8('0x40')];_0x381638+=0x1){_0x58c547=_0x40110f[_0x381638];if(_[_0x65c8('0x41')](_0x3428cd[_0x65c8('0x14')][_0x58c547['name']])){_0x3428cd['campaigns'][_0x58c547[_0x65c8('0x29')]]=new Campaign(_0x58c547);}else{_0x3428cd[_0x65c8('0x43')](_0x3428cd[_0x65c8('0x14')][_0x58c547[_0x65c8('0x29')]],_0x58c547);_0x3428cd[_0x65c8('0x14')][_0x58c547[_0x65c8('0x29')]][_0x65c8('0x63')]=_0x58c547['SquareProject']?_0x58c547[_0x65c8('0x64')][_0x65c8('0x29')]:undefined;}}}return _0x3428cd[_0x65c8('0x14')];};};Realtime[_0x65c8('0x3d')][_0x65c8('0x65')]=function(){var _0x5ad863=this;return function(_0xc3c9c9){if(_0xc3c9c9){freeIsNotKey(_0xc3c9c9,_0x5ad863[_0x65c8('0x17')],'id');for(var _0x372fe=0x0,_0x49cbe1={};_0x372fe<_0xc3c9c9['length'];_0x372fe+=0x1){_0x49cbe1=_0xc3c9c9[_0x372fe];if(_['isUndefined'](_0x5ad863[_0x65c8('0x17')][_0x49cbe1['id']])){_0x5ad863[_0x65c8('0x17')][_0x49cbe1['id']]=new VoiceExtension(_0x49cbe1);}else{_0x5ad863[_0x65c8('0x43')](_0x5ad863[_0x65c8('0x17')][_0x49cbe1['id']],_0x49cbe1);}}}return _0x5ad863[_0x65c8('0x17')];};};Realtime[_0x65c8('0x3d')][_0x65c8('0x66')]=function(){var _0x43bd6b=this;return function(_0x59939f){clearCampaigns(_0x43bd6b[_0x65c8('0x14')]);for(var _0x2e5d9d=0x0;_0x2e5d9d<_0x59939f[_0x65c8('0x40')];_0x2e5d9d+=0x1){_[_0x65c8('0x50')](_0x43bd6b['campaigns'][_0x59939f[_0x2e5d9d]['name']],_0x59939f[_0x2e5d9d]);}return _0x43bd6b[_0x65c8('0x14')];};};Realtime[_0x65c8('0x3d')][_0x65c8('0x67')]=function(){var _0x21c04e=this;return function(_0x59af46){if(_0x59af46){freeIsNotKey(_0x59af46,_0x21c04e[_0x65c8('0x24')],'id');for(var _0x2990e7=0x0,_0x127c13={},_0xd4b505={};_0x2990e7<_0x59af46[_0x65c8('0x40')];_0x2990e7+=0x1){_0x127c13=_0x59af46[_0x2990e7];if(_[_0x65c8('0x41')](_0x21c04e[_0x65c8('0x24')][_0x127c13['id']])){_0x21c04e[_0x65c8('0x24')][_0x127c13['id']]=new FaxAccount(_0x127c13);}else{_0x21c04e[_0x65c8('0x43')](_0x21c04e['faxAccounts'][_0x127c13['id']],_0x127c13);}}}return _0x21c04e[_0x65c8('0x24')];};};module[_0x65c8('0x68')]=Realtime;
\ No newline at end of file