78233babe0bbb3772cc2fe28a2cad8641b7dce11
[motion-next.git] / server / services / ami / index.js
1 const a1064_0x421f=['initVoiceQueueReports','getZendeskAccounts','./rpc/integrations/zendesk','log','./rpc/integrations/salesforce','initVoiceExtensions','./rpc/integrations/sugarcrm','getFreshdeskAccounts','initCampaigns','getDynamics365Accounts','catch','./rpc/integrations/servicenow','./preview','getVoiceQueueHopperHistory','initVoiceCallReports','initVtigerAccounts','initFaxAccounts','getVoiceQueueReports','getFreshsalesAccounts','initZendeskAccounts','initDeskAccounts','./rpc/faxAccount','initFreshdeskAccounts','./rpc/campaign','getZohoAccounts','listen','./rpc/user','moment','initServicenowAccounts','getVoiceQueues','getTelephones','resolve','initFreshsalesAccounts','initDynamics365Accounts','getTemplates','getCampaignHopperHistory','getFaxAccounts','./rpc/trunk','hour','./rpc/integrations/freshsales','getVtigerAccounts','initSugarcrmAccounts','./report','../../globals','initSalesforceAccounts','./rpc/integrations/zoho','initVoiceQueues','getTriggers','getTrunks','./rpc/voiceQueueReport','./server','getServicenowAccounts','sync','then','./rpc/integrations/desk','initTrunks'];(function(_0x6476ba,_0x421f25){const _0x4acbbd=function(_0x4e5af6){while(--_0x4e5af6){_0x6476ba['push'](_0x6476ba['shift']());}};_0x4acbbd(++_0x421f25);}(a1064_0x421f,0xa4));const a1064_0x4acb=function(_0x6476ba,_0x421f25){_0x6476ba=_0x6476ba-0x0;let _0x4acbbd=a1064_0x421f[_0x6476ba];return _0x4acbbd;};const _0x487d4b=a1064_0x4acb;'use strict';require(_0x487d4b('0x2f'));const moment=require(_0x487d4b('0x1f')),server=require(_0x487d4b('0x36')),Realtime=require('./realtime'),Report=require(_0x487d4b('0x2e')),Preview=require(_0x487d4b('0x10')),Fax=require('./fax'),user=require(_0x487d4b('0x1e')),voiceQueue=require('./rpc/voiceQueue'),voiceQueueReport=require(_0x487d4b('0x35')),voiceCallReport=require('./rpc/voiceCallReport'),trunk=require(_0x487d4b('0x29')),trigger=require('./rpc/trigger'),template=require('./rpc/template'),cmHopperHistory=require('./rpc/cmHopperHistory'),campaign=require(_0x487d4b('0x1b')),voiceExtension=require('./rpc/voiceExtension'),faxAccount=require(_0x487d4b('0x19')),zendesk=require(_0x487d4b('0x6')),salesforce=require(_0x487d4b('0x8')),sugarcrm=require(_0x487d4b('0xa')),freshdesk=require('./rpc/integrations/freshdesk'),desk=require(_0x487d4b('0x2')),zoho=require(_0x487d4b('0x31')),vtiger=require('./rpc/integrations/vtiger'),freshsales=require(_0x487d4b('0x2b')),servicenow=require(_0x487d4b('0xf')),dynamics365=require('./rpc/integrations/dynamics365'),realtime=new Realtime(),report=new Report(realtime),preview=new Preview(realtime),fax=new Fax(realtime);let isTrue=!![],initP=!![];function ifMidnight(){const _0x2046d7=_0x487d4b;moment()['get'](_0x2046d7('0x2a'))===0x0&&initP&&(initP=![],isTrue=!![],initParams()),moment()['get'](_0x2046d7('0x2a'))===0x1&&isTrue&&(isTrue=![],initP=!![]);}function initRealtime(){const _0x4cf42c=_0x487d4b;return ifMidnight(),Promise[_0x4cf42c('0x23')]()[_0x4cf42c('0x1')](user['getAgents']())[_0x4cf42c('0x1')](realtime['initAgents']())[_0x4cf42c('0x1')](user[_0x4cf42c('0x22')]())['then'](realtime['initTelephones']())[_0x4cf42c('0x1')](trunk[_0x4cf42c('0x34')]())[_0x4cf42c('0x1')](realtime[_0x4cf42c('0x3')]())['then'](voiceQueue[_0x4cf42c('0x21')]())[_0x4cf42c('0x1')](realtime[_0x4cf42c('0x32')]())['then'](trigger[_0x4cf42c('0x33')]())[_0x4cf42c('0x1')](realtime['initTriggers']())[_0x4cf42c('0x1')](template[_0x4cf42c('0x26')]())[_0x4cf42c('0x1')](realtime['initTemplates']())[_0x4cf42c('0x1')](zendesk[_0x4cf42c('0x5')]())['then'](realtime[_0x4cf42c('0x17')]())[_0x4cf42c('0x1')](salesforce['getSalesforceAccounts']())[_0x4cf42c('0x1')](realtime[_0x4cf42c('0x30')]())[_0x4cf42c('0x1')](sugarcrm['getSugarcrmAccounts']())[_0x4cf42c('0x1')](realtime[_0x4cf42c('0x2d')]())['then'](freshdesk[_0x4cf42c('0xb')]())[_0x4cf42c('0x1')](realtime[_0x4cf42c('0x1a')]())[_0x4cf42c('0x1')](desk['getDeskAccounts']())[_0x4cf42c('0x1')](realtime[_0x4cf42c('0x18')]())[_0x4cf42c('0x1')](zoho[_0x4cf42c('0x1c')]())[_0x4cf42c('0x1')](realtime['initZohoAccounts']())[_0x4cf42c('0x1')](vtiger[_0x4cf42c('0x2c')]())['then'](realtime[_0x4cf42c('0x13')]())[_0x4cf42c('0x1')](freshsales[_0x4cf42c('0x16')]())[_0x4cf42c('0x1')](realtime[_0x4cf42c('0x24')]())[_0x4cf42c('0x1')](servicenow[_0x4cf42c('0x37')]())[_0x4cf42c('0x1')](realtime[_0x4cf42c('0x20')]())['then'](dynamics365[_0x4cf42c('0xd')]())['then'](realtime[_0x4cf42c('0x25')]())['then'](campaign['getCampaigns']())[_0x4cf42c('0x1')](realtime[_0x4cf42c('0xc')]())[_0x4cf42c('0x1')](voiceExtension['getVoiceExtensions']())[_0x4cf42c('0x1')](realtime[_0x4cf42c('0x9')]())[_0x4cf42c('0x1')](faxAccount[_0x4cf42c('0x28')]())[_0x4cf42c('0x1')](realtime[_0x4cf42c('0x14')]())['then'](function(){return realtime;});}function initParams(){const _0x2669d5=_0x487d4b;return Promise[_0x2669d5('0x23')]()[_0x2669d5('0x1')](voiceQueueReport[_0x2669d5('0x15')]())['then'](realtime[_0x2669d5('0x4')]())['then'](cmHopperHistory[_0x2669d5('0x11')]())[_0x2669d5('0x1')](realtime['initVoiceQueueHopperHistory']())[_0x2669d5('0x1')](cmHopperHistory[_0x2669d5('0x27')]())[_0x2669d5('0x1')](realtime['initCampaignHopperHistory']())[_0x2669d5('0x1')](voiceCallReport['getVoiceCallReports']())['then'](realtime[_0x2669d5('0x12')]())['then'](function(){})[_0x2669d5('0xe')](function(_0x4e5af6){console['log'](_0x4e5af6);});}function main(){const _0x183f4b=_0x487d4b;return server[_0x183f4b('0x1d')](realtime,preview,fax)[_0x183f4b('0x1')](function(){return initRealtime();})[_0x183f4b('0x1')](function(){return initParams();})[_0x183f4b('0x1')](function(){const _0x29bbe8=_0x183f4b;report[_0x29bbe8('0x0')](),setInterval(initRealtime,0x1388);})[_0x183f4b('0xe')](function(_0x22f6d0){const _0x46a5b0=_0x183f4b;console[_0x46a5b0('0x7')](_0x22f6d0);});}main();