18 var _0x0bb2=['refreshToken','clientId','clientSecret','refresh_token','then','add','catch','error','Failing\x20creating\x20the\x20access_token','stack','info','Search\x20user','Zoho-oauthtoken\x20','isArrayLikeObject','users','findIndex','email','Agent\x20found!','Using\x20the\x20admin\x20account!','user','profile','Administrator','The\x20failing\x20result\x20is','enduserType','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','data','code','SUCCESS','details','Error:\x20','log','GET','moduleSearch','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','uri','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','contact','lead','Creating\x20new\x20call...','Owner','administrator','Subject','getString','Description','Who_Id','Full_Name','Last_Name','First_Name','$se_module','talktime','Call_Duration','format','mm:ss','utc','YYYY-MM-DDTHH:mm:ss','diff','lastevent','Call_Result','Called','complete','connect','Answered','rejected','Rejected','abandoned','Abandoned','timeout','Call_Start_Time','starttime','agentcalledAt','Call_Type','Inbound','Fields','/crm/v2/Calls','err','queue','host','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','com','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','https://crm.','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','Outbound','/crm/EntityInfo.do?module=Calls&id=','unmanaged','toUpperCase','lodash','request-promise','md5','util','./util','moment','ioredis','bluebird','../../../../config/environment','../../../../config/logger','zoho','redis','defaults','socket.io-emitter','emit','stringify','forEach','includes','string','picklist','type','idField','toString','variable','variableName','Variable','name','toLowerCase','indexOf','split','isNil','access_token','expires_in','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST'];(function(_0x599e60,_0x5b6519){var _0x468e19=function(_0xcdfd97){while(--_0xcdfd97){_0x599e60['push'](_0x599e60['shift']());}};_0x468e19(++_0x5b6519);}(_0x0bb2,0x72));var _0x20bb=function(_0x37fc4f,_0x4417d1){_0x37fc4f=_0x37fc4f-0x0;var _0x49c72e=_0x0bb2[_0x37fc4f];return _0x49c72e;};'use strict';var _=require(_0x20bb('0x0'));var rp=require(_0x20bb('0x1'));var md5=require(_0x20bb('0x2'));var util=require(_0x20bb('0x3'));var intUtil=require(_0x20bb('0x4'));var moment=require(_0x20bb('0x5'));var Redis=require(_0x20bb('0x6'));var BPromise=require(_0x20bb('0x7'));var config=require(_0x20bb('0x8'));var logger=require(_0x20bb('0x9'))(_0x20bb('0xa'));config[_0x20bb('0xb')]=_[_0x20bb('0xc')](config[_0x20bb('0xb')],{'host':'localhost','port':0x18eb});var io=require(_0x20bb('0xd'))(new Redis(config[_0x20bb('0xb')]));function emit(_0x121af5,_0x968434,_0x51a4d5){io['to'](_0x121af5)[_0x20bb('0xe')](_0x968434,_0x51a4d5);}function request(_0x41d258){logger['debug']('[HTTP]',JSON[_0x20bb('0xf')](_0x41d258));return rp(_0x41d258);}function getCustomFields(_0x320f8d,_0x444dc3){var _0x4d8a64={};if(_0x320f8d['length']>0x0){_[_0x20bb('0x10')](_0x320f8d,function(_0x30951d){if(_[_0x20bb('0x11')]([_0x20bb('0x12'),_0x20bb('0x13')],_0x30951d[_0x20bb('0x14')])&&_0x30951d['idField']){_0x4d8a64[_0x30951d[_0x20bb('0x15')]]=_0x30951d['content'][_0x20bb('0x16')]();}else if(_0x30951d['type']===_0x20bb('0x17')&&_0x30951d[_0x20bb('0x18')]&&_0x30951d['idField']&&_0x444dc3[_0x30951d['variableName']]){_0x4d8a64[_0x30951d['idField']]=_0x444dc3[_0x30951d[_0x20bb('0x18')]][_0x20bb('0x16')]();}else if(_0x30951d[_0x20bb('0x14')]==='customVariable'&&_0x30951d['Variable']&&_0x30951d[_0x20bb('0x19')]['name']&&_0x30951d[_0x20bb('0x15')]&&_0x444dc3[_0x30951d['Variable'][_0x20bb('0x1a')][_0x20bb('0x1b')]()]){_0x4d8a64[_0x30951d[_0x20bb('0x15')]]=_0x444dc3[_0x30951d[_0x20bb('0x19')]['name']['toLowerCase']()][_0x20bb('0x16')]();}});}return _0x4d8a64;}function getName(_0x307a9f){if(_0x307a9f[_0x20bb('0x1c')]('\x20')>0x0){var _0x18b08c=_0x307a9f[_0x20bb('0x1d')](/ (.+)/);if(_0x18b08c[0x1]){return _0x18b08c;}}return[_0x307a9f,_0x307a9f];}var accountsTokens={};function getAccessToken(_0x348dce){return new Promise(function(_0x4e6f46,_0x557bbf){if(!_[_0x20bb('0x1e')](accountsTokens[_0x348dce['id']])&&!_[_0x20bb('0x1e')](accountsTokens[_0x348dce['id']][_0x20bb('0x1f')])){if(moment()['isBefore'](accountsTokens[_0x348dce['id']][_0x20bb('0x20')])){_0x4e6f46(accountsTokens[_0x348dce['id']][_0x20bb('0x1f')]);}}var _0x335cae;switch(_0x348dce['zone']){case'US':_0x335cae=_0x20bb('0x21');break;case'AU':_0x335cae=_0x20bb('0x22');break;case'EU':_0x335cae=_0x20bb('0x23');break;case'IN':_0x335cae=_0x20bb('0x24');break;case'CN':_0x335cae=_0x20bb('0x25');break;default:_0x335cae='https://accounts.zoho.eu';break;}var _0x429888={'method':_0x20bb('0x26'),'uri':_0x335cae+'/oauth/v2/token','qs':{'refresh_token':_0x348dce[_0x20bb('0x27')],'client_id':_0x348dce[_0x20bb('0x28')],'client_secret':_0x348dce[_0x20bb('0x29')],'grant_type':_0x20bb('0x2a')},'json':!![]};return rp(_0x429888)[_0x20bb('0x2b')](function(_0x2cee69){accountsTokens[_0x348dce['id']]={'access_token':_0x2cee69[_0x20bb('0x1f')],'expires_in':moment()[_0x20bb('0x2c')](_0x2cee69[_0x20bb('0x20')],'seconds')};_0x4e6f46(_0x2cee69['access_token']);})[_0x20bb('0x2d')](function(_0x2d1d1e){logger[_0x20bb('0x2e')](_0x20bb('0x2f'),_0x2d1d1e[_0x20bb('0x30')]);_0x557bbf(_0x2d1d1e);});});}function getUser(_0x106336,_0x5bb058,_0x23ab18,_0x4a6331){logger[_0x20bb('0x31')](_0x20bb('0x32'));return request({'method':'GET','uri':util['format']('https://www.zohoapis.%s/crm/v2/users',_0x5bb058),'qs':{'type':'ActiveUsers'},'headers':{'Authorization':_0x20bb('0x33')+_0x106336},'json':!![]})[_0x20bb('0x2b')](function(_0x57cd14){if(_0x57cd14['users']){var _0x12bf48=-0x1;if(_[_0x20bb('0x34')](_0x57cd14[_0x20bb('0x35')])){if(!_[_0x20bb('0x1e')](_0x4a6331)){_0x12bf48=_[_0x20bb('0x36')](_0x57cd14['users'],function(_0x23c237){return _0x23c237[_0x20bb('0x37')]===_0x4a6331;});}if(_0x12bf48>=0x0){logger['info'](_0x20bb('0x38'));}else{logger[_0x20bb('0x31')](_0x20bb('0x39'));_0x12bf48=_['findIndex'](_0x57cd14[_0x20bb('0x35')],function(_0xd95f9){return _0xd95f9['profile']['name']==='Administrator';});}return _0x57cd14[_0x20bb('0x35')][_0x12bf48];}else{if(_0x57cd14[_0x20bb('0x3a')][_0x20bb('0x3b')][_0x20bb('0x1a')]===_0x20bb('0x3c')){logger['info'](_0x20bb('0x39'));user=_0x57cd14[_0x20bb('0x3a')];return user;}else{logger[_0x20bb('0x2e')](_0x20bb('0x3d'),JSON[_0x20bb('0xf')](_0x57cd14));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0x20bb('0xf')](_0x57cd14));}}}else{logger[_0x20bb('0x2e')](_0x20bb('0x3d'),JSON['stringify'](_0x57cd14));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0x20bb('0xf')](_0x57cd14));}})[_0x20bb('0x2d')](function(_0x43aa33){console[_0x20bb('0x2e')](_0x43aa33);});}function getZohoUser(_0x468431,_0x1076f2){return new BPromise(function(_0x1ffddf,_0x29f5d3){request(_0x468431)['then'](function(_0x377cdd){var _0x1be694=null;if(_0x377cdd){_0x1be694=_0x377cdd['data'][0x0];_0x1be694[_0x20bb('0x3e')]=_0x1076f2;}_0x1ffddf(_0x1be694);})['catch'](function(_0x3ae26f){_0x29f5d3(_0x3ae26f);});});}function createEndUser(_0x1da324,_0x1e6646,_0x4bfa6e,_0x424193,_0x495a25,_0x321d52){var _0x4bfa6e=getName(_0x4bfa6e);return request({'method':_0x20bb('0x26'),'uri':_0x20bb('0x3f')+_0x1e6646+_0x20bb('0x40')+_[_0x20bb('0x41')](_0x321d52[_0x20bb('0x42')])+'s','body':{'data':[{'Last_Name':_0x4bfa6e[0x1],'First_Name':_0x4bfa6e[0x0],'Phone':_0x424193,'Owner':{'name':!_['isNil'](_0x495a25[_0x20bb('0x43')][_0x20bb('0x1a')])?_0x495a25[_0x20bb('0x43')][_0x20bb('0x1a')]:!_['isNil'](_0x495a25[_0x20bb('0x44')])?_0x495a25[_0x20bb('0x44')]+'\x20'+_0x495a25[_0x20bb('0x45')]:_0x495a25['last_name'],'id':_0x495a25['id']}}]},'headers':{'Authorization':_0x20bb('0x33')+_0x1da324},'json':!![]})[_0x20bb('0x2b')](function(_0x27ad4a){if(_0x27ad4a&&_0x27ad4a[_0x20bb('0x46')][0x0][_0x20bb('0x47')]===_0x20bb('0x48')){var _0x5a3ca4=_0x27ad4a[_0x20bb('0x46')][0x0][_0x20bb('0x49')];_0x5a3ca4[_0x20bb('0x3e')]=_[_0x20bb('0x41')](_0x321d52['moduleCreate'])+'s';return _0x5a3ca4;}logger['error'](_0x20bb('0x3d'),JSON[_0x20bb('0xf')](data));throw new Error(_0x20bb('0x4a')+JSON[_0x20bb('0xf')](data));})[_0x20bb('0x2d')](function(_0x149d7f){console[_0x20bb('0x4b')]('CREATE\x20ERROR',_0x149d7f);});}function getEndUser(_0x78da88,_0x149d47,_0x2c03f9,_0x3a6af2,_0x44b0f0,_0x21ddf0,_0x1f33b1){var _0xe3b657={'method':_0x20bb('0x4c'),'uri':'','headers':{'Authorization':_0x20bb('0x33')+_0x78da88},'json':!![]};switch(_0x1f33b1[_0x20bb('0x4d')]){case'contact_lead':_0xe3b657['uri']=_0x20bb('0x3f')+_0x149d47+_0x20bb('0x4e')+_0x44b0f0+'))';return getZohoUser(_0xe3b657,_0x20bb('0x4f'))['then'](function(_0x52bd24){if(_0x52bd24)return _0x52bd24;_0xe3b657[_0x20bb('0x50')]=_0x20bb('0x3f')+_0x149d47+_0x20bb('0x51')+_0x44b0f0+'))';return getZohoUser(_0xe3b657,_0x20bb('0x52'))['then'](function(_0x2ab1af){if(_0x2ab1af)return _0x2ab1af;if(_0x1f33b1['moduleCreate']!=_0x20bb('0x53')){return createEndUser(_0x78da88,_0x149d47,_0x3a6af2,_0x44b0f0,_0x21ddf0,_0x1f33b1);}else{return{};}});});break;case _0x20bb('0x54'):_0xe3b657['uri']=_0x20bb('0x3f')+_0x149d47+_0x20bb('0x4e')+_0x44b0f0+'))';return getZohoUser(_0xe3b657,_0x20bb('0x4f'))['then'](function(_0x346b20){if(_0x346b20)return _0x346b20;if(_0x1f33b1['moduleCreate']!=_0x20bb('0x53')){return createEndUser(_0x78da88,_0x149d47,_0x3a6af2,_0x44b0f0,_0x21ddf0,_0x1f33b1);}else{return{};}});break;case _0x20bb('0x55'):_0xe3b657['uri']='https://www.zohoapis.'+_0x149d47+_0x20bb('0x51')+_0x44b0f0+'))';return getZohoUser(_0xe3b657,'Leads')[_0x20bb('0x2b')](function(_0x3d780b){if(_0x3d780b)return _0x3d780b;if(_0x1f33b1[_0x20bb('0x42')]!=_0x20bb('0x53')){return createEndUser(_0x78da88,_0x149d47,_0x3a6af2,_0x44b0f0,_0x21ddf0,_0x1f33b1);}else{return{};}});break;}}function getCall(_0x3bd185,_0xbc9ac1,_0x47d564,_0x31c182,_0x51d7cf,_0x367878,_0x9b9e8a,_0x3402ad){logger['info'](_0x20bb('0x56'));var _0x4741c2={};_0x4741c2[_0x20bb('0x57')]={'name':!_[_0x20bb('0x1e')](_0x31c182[_0x20bb('0x43')][_0x20bb('0x1a')])&&!_[_0x20bb('0x1e')](_0x31c182[_0x20bb('0x3b')][_0x20bb('0x1a')])&&_0x31c182[_0x20bb('0x3b')][_0x20bb('0x1a')]===_0x20bb('0x58')?_0x31c182[_0x20bb('0x43')]['name']:!_[_0x20bb('0x1e')](_0x31c182[_0x20bb('0x44')])?_0x31c182['first_name']+'\x20'+_0x31c182[_0x20bb('0x45')]:_0x31c182['last_name'],'id':_0x31c182['id']};_0x4741c2[_0x20bb('0x59')]=intUtil[_0x20bb('0x5a')](_0x367878['Subjects'],_0x9b9e8a,'\x20');_0x4741c2[_0x20bb('0x5b')]=intUtil[_0x20bb('0x5a')](_0x367878['Descriptions'],_0x9b9e8a,'\x0a');if(_0x51d7cf[_0x20bb('0x3e')]===_0x20bb('0x4f')){_0x4741c2[_0x20bb('0x5c')]={'name':!_[_0x20bb('0x1e')](_0x51d7cf[_0x20bb('0x5d')])?_0x51d7cf['Full_Name']:!_[_0x20bb('0x1e')](_0x51d7cf['First_Name'])?_0x51d7cf['First_Name']+'\x20'+_0x51d7cf['Last_Name']:_0x51d7cf[_0x20bb('0x5e')],'id':_0x51d7cf['id']};}if(_0x51d7cf[_0x20bb('0x3e')]===_0x20bb('0x52')){_0x4741c2['What_Id']={'name':!_['isNil'](_0x51d7cf[_0x20bb('0x5d')])?_0x51d7cf['Full_Name']:!_[_0x20bb('0x1e')](_0x51d7cf['First_Name'])?_0x51d7cf[_0x20bb('0x5f')]+'\x20'+_0x51d7cf[_0x20bb('0x5e')]:_0x51d7cf[_0x20bb('0x5e')],'id':_0x51d7cf['id']};_0x4741c2[_0x20bb('0x60')]=_[_0x20bb('0x41')](_0x51d7cf[_0x20bb('0x3e')]);}if(_0x9b9e8a[_0x20bb('0x61')]){_0x4741c2[_0x20bb('0x62')]=moment['utc'](parseInt(_0x9b9e8a['talktime'])*0x3e8)[_0x20bb('0x63')](_0x20bb('0x64'));}else if(_0x9b9e8a['answertime']&&_0x9b9e8a['endtime']){_0x4741c2['Call_Duration']=moment[_0x20bb('0x65')](moment(_0x9b9e8a['endtime'],_0x20bb('0x66'))[_0x20bb('0x67')](moment(_0x9b9e8a['starttime'],_0x20bb('0x66'))))[_0x20bb('0x63')](_0x20bb('0x64'));}switch(_0x9b9e8a[_0x20bb('0x68')]){case'called':_0x4741c2[_0x20bb('0x69')]=_0x20bb('0x6a');break;case _0x20bb('0x6b'):case _0x20bb('0x6c'):_0x4741c2['Call_Result']=_0x20bb('0x6d');break;case _0x20bb('0x6e'):_0x4741c2[_0x20bb('0x69')]=_0x20bb('0x6f');break;case _0x20bb('0x70'):_0x4741c2['Call_Result']=_0x20bb('0x71');break;case _0x20bb('0x72'):_0x4741c2[_0x20bb('0x69')]='Timeout';default:}_0x4741c2[_0x20bb('0x73')]=(_0x3402ad==='outbound'?moment(_0x9b9e8a[_0x20bb('0x74')])[_0x20bb('0x63')]('YYYY-MM-DDTHH:mm:ss'):moment(_0x9b9e8a[_0x20bb('0x75')])[_0x20bb('0x63')](_0x20bb('0x66')))||moment()[_0x20bb('0x63')](_0x20bb('0x66'));_0x4741c2[_0x20bb('0x76')]=_0x3402ad||_0x20bb('0x77');_0x4741c2=_['merge'](_0x4741c2,getCustomFields(_0x367878[_0x20bb('0x78')],_0x9b9e8a));return request({'method':_0x20bb('0x26'),'uri':_0x20bb('0x3f')+_0xbc9ac1+_0x20bb('0x79'),'headers':{'Authorization':_0x20bb('0x33')+_0x3bd185},'body':{'data':[_0x4741c2]},'json':!![]})[_0x20bb('0x2b')](function(_0x241492){if(_0x241492&&_0x241492[_0x20bb('0x46')][0x0]['code']===_0x20bb('0x48')){logger['info']('Call\x20created!');return{'id':_0x241492[_0x20bb('0x46')][0x0][_0x20bb('0x49')]['id']};}})[_0x20bb('0x2d')](function(_0x379ad4){logger[_0x20bb('0x31')](_0x20bb('0x7a'),_0x379ad4['stack']);console[_0x20bb('0x4b')]('err',_0x379ad4);});}exports[_0x20bb('0x7b')]=function(_0x371456,_0x2f3854,_0x22ae54,_0x1e16c1,_0x21af15,_0x2f449e){var _0x4f5415,_0x40ce94,_0x37cb59;_0x2f449e[_0x20bb('0x7c')]=intUtil[_0x20bb('0x7d')](_0x2f449e[_0x20bb('0x7c')]);_0x2f449e[_0x20bb('0x7e')]=intUtil[_0x20bb('0x7d')](_0x2f449e[_0x20bb('0x7e')]);if(_0x21af15&&_0x21af15[_0x20bb('0x7f')]){logger[_0x20bb('0x31')](_0x20bb('0x80'),'Recording\x20is\x20enabled!');_0x2f3854[_0x20bb('0x81')]=_0x2f449e['serverUrl']+_0x20bb('0x82')+_0x2f3854[_0x20bb('0x83')]+_0x20bb('0x84')+md5(_0x2f3854[_0x20bb('0x83')]);}else{_0x2f3854[_0x20bb('0x81')]='';}var _0x33b0ae=_0x2f449e[_0x20bb('0x7c')]===_0x20bb('0x85')?'eu':_0x20bb('0x86');return getAccessToken(_0x2f449e)[_0x20bb('0x2b')](function(_0x50c505){_0x37cb59=_0x50c505;return getUser(_0x37cb59,_0x33b0ae,_0x2f449e,_0x1e16c1['email']);})[_0x20bb('0x2b')](function(_0x1ec9e7){_0x4f5415=_0x1ec9e7;logger[_0x20bb('0x31')](_0x20bb('0x87'),_0x4f5415['id']);return getEndUser(_0x37cb59,_0x33b0ae,_0x2f449e,_0x2f3854[_0x20bb('0x88')],_0x2f3854[_0x20bb('0x89')],_0x4f5415,_0x22ae54);})[_0x20bb('0x2b')](function(_0x4af3f7){_0x40ce94=_0x4af3f7;return getCall(_0x37cb59,_0x33b0ae,_0x2f449e,_0x4f5415,_0x40ce94,_0x22ae54,_0x2f3854,_0x20bb('0x77'));})[_0x20bb('0x2b')](function(_0x5e692b){if(_0x5e692b){logger[_0x20bb('0x31')](_0x20bb('0x8a'),_0x5e692b['id']);logger[_0x20bb('0x31')](_0x20bb('0x80'),_0x20bb('0x8b'));emit(util[_0x20bb('0x63')](_0x20bb('0x8c'),_0x1e16c1['name']),_0x20bb('0x8d'),{'uri':_0x20bb('0x8e')+_0x2f449e[_0x20bb('0x7c')]+'/crm/EntityInfo.do?module=Calls&id='+_0x5e692b['id']});}})[_0x20bb('0x2d')](function(_0x283297){logger['error'](_0x20bb('0x80'),JSON['stringify'](_0x283297));});};exports[_0x20bb('0x8f')]=function(_0x3b69ea,_0x1feff3,_0x53570d,_0x4aa460,_0x9968a0,_0x2ffb4a,_0x5c20bb){var _0x351e52,_0x545d2e,_0x36feca;_0x2ffb4a['host']=intUtil[_0x20bb('0x7d')](_0x2ffb4a['host']);_0x2ffb4a['serverUrl']=intUtil[_0x20bb('0x7d')](_0x2ffb4a[_0x20bb('0x7e')]);if(_0x5c20bb&&_0x5c20bb['recordingFormat']&&_0x5c20bb[_0x20bb('0x90')]!==_0x20bb('0x91')){logger[_0x20bb('0x31')](_0x20bb('0x92'),_0x20bb('0x93'));_0x1feff3[_0x20bb('0x81')]=_0x2ffb4a[_0x20bb('0x7e')]+'/api/voice/recordings/'+_0x1feff3[_0x20bb('0x83')]+_0x20bb('0x84')+md5(_0x1feff3['uniqueid']);}var _0x51ddc0=_0x2ffb4a[_0x20bb('0x7c')]===_0x20bb('0x85')?'eu':_0x20bb('0x86');return getAccessToken(_0x2ffb4a)[_0x20bb('0x2b')](function(_0x3b2d07){_0x36feca=_0x3b2d07;return getUser(_0x36feca,_0x51ddc0,_0x2ffb4a,_0x4aa460[_0x20bb('0x37')]);})[_0x20bb('0x2b')](function(_0x4a7ea5){_0x351e52=_0x4a7ea5;logger[_0x20bb('0x31')](_0x20bb('0x87'),_0x351e52['id']);return getEndUser(_0x36feca,_0x51ddc0,_0x2ffb4a,_0x1feff3[_0x20bb('0x94')],_0x1feff3['destcalleridnum'],_0x351e52,_0x53570d);})[_0x20bb('0x2b')](function(_0x367815){_0x545d2e=_0x367815;return getCall(_0x36feca,_0x51ddc0,_0x2ffb4a,_0x351e52,_0x545d2e,_0x53570d,_0x1feff3,_0x20bb('0x95'));})[_0x20bb('0x2b')](function(_0x101f68){if(_0x101f68){logger['info']('The\x20Call\x20ID\x20is:',_0x101f68['id']);logger[_0x20bb('0x31')](_0x20bb('0x92'),_0x20bb('0x8b'));emit(util[_0x20bb('0x63')](_0x20bb('0x8c'),_0x4aa460[_0x20bb('0x1a')]),_0x20bb('0x8d'),{'uri':'https://crm.'+_0x2ffb4a['host']+_0x20bb('0x96')+_0x101f68['id']});}})[_0x20bb('0x2d')](function(_0x5bd829){logger[_0x20bb('0x2e')](_0x20bb('0x92'),JSON[_0x20bb('0xf')](_0x5bd829));});};exports[_0x20bb('0x97')]=function(_0x288be7,_0x2773e1,_0x7f7508,_0x2ecaaf,_0x505aa2,_0x3a90e3){var _0x174989,_0x3cdb3d,_0x3c9123;_0x3a90e3[_0x20bb('0x7c')]=intUtil[_0x20bb('0x7d')](_0x3a90e3[_0x20bb('0x7c')]);_0x3a90e3[_0x20bb('0x7e')]=intUtil['stripTrailingSlash'](_0x3a90e3[_0x20bb('0x7e')]);if(_0x505aa2&&_0x505aa2[_0x20bb('0x7f')]){logger[_0x20bb('0x31')]('['+_0x2773e1[_0x20bb('0x68')][_0x20bb('0x98')]()+']',_0x20bb('0x93'));_0x2773e1[_0x20bb('0x81')]=_0x3a90e3[_0x20bb('0x7e')]+_0x20bb('0x82')+_0x2773e1['uniqueid']+_0x20bb('0x84')+md5(_0x2773e1[_0x20bb('0x83')]);}else{_0x2773e1[_0x20bb('0x81')]='';}var _0x5bdaed=_0x3a90e3['host']===_0x20bb('0x85')?'eu':_0x20bb('0x86');return getAccessToken(_0x3a90e3)['then'](function(_0x2e2408){_0x3c9123=_0x2e2408;return getUser(_0x3c9123,_0x5bdaed,_0x3a90e3);})[_0x20bb('0x2b')](function(_0x32bde7){_0x174989=_0x32bde7;logger[_0x20bb('0x31')]('The\x20User\x20ID\x20is:',_0x174989['id']);return getEndUser(_0x3c9123,_0x5bdaed,_0x3a90e3,_0x2773e1[_0x20bb('0x88')],_0x2773e1[_0x20bb('0x89')],_0x174989,_0x7f7508);})[_0x20bb('0x2b')](function(_0x3a36a7){_0x3cdb3d=_0x3a36a7;return getCall(_0x3c9123,_0x5bdaed,_0x3a90e3,_0x174989,_0x3cdb3d,_0x7f7508,_0x2773e1,_0x20bb('0x77'));})['then'](function(_0x1719b8){if(_0x1719b8){logger[_0x20bb('0x31')](_0x20bb('0x8a'),_0x1719b8['id']);}})[_0x20bb('0x2d')](function(_0x114cb2){logger[_0x20bb('0x2e')]('['+_0x2773e1[_0x20bb('0x68')][_0x20bb('0x98')]()+']',JSON['stringify'](_0x114cb2));});};