Built motion from commit e02f907f.|2.6.14
[motion2.git] / server / services / ami / trigger / integration / salesforce.js
index 26fc3e1..c94c070 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1f2d=['Account','first','Phone','attributes','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','format','Caller\x20-\x20%s','<unknown>','Company','No\x20Company','upperFirst','forEach','string','picklist','type','idField','content','toString','variable','variableName','customVariable','Variable','name','password','securityToken','Connection','remoteUri','https://login.salesforce.com','clientId','clientSecret','login','username','Connection\x20established.','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','email','calleridnum','Fields','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','trigger:salesforce:display','newTab','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','none','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','outbound','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','%s/%s/e','instanceUrl','[OUTBOUND]','unmanaged','lastevent','toUpperCase','calleridname',']\x20Ticket\x20%s\x20created.','moment','bluebird','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','salesforce','defaults','redis','emit','assign','getString','Subjects','ticketType','ActivityDate','utc','IsRecurrence','endUserType','contact','account','WhatId','ContactId','AccountId','lead','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','isNil','validateEmail','length','find','Agent\x20%s\x20found.','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','display_name','then','user_id','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','cloneDeep','additionalSearchContact','merge','$or','Contact','execute','additionalSearchLead','account_contact_lead','additionalSearchAccount','Lead'];(function(_0x2e2c0f,_0x393557){var _0x4a88df=function(_0x8ceb32){while(--_0x8ceb32){_0x2e2c0f['push'](_0x2e2c0f['shift']());}};_0x4a88df(++_0x393557);}(_0x1f2d,0x144));var _0xd1f2=function(_0x2dea24,_0x2fc021){_0x2dea24=_0x2dea24-0x0;var _0x309d58=_0x1f2d[_0x2dea24];return _0x309d58;};'use strict';var _=require('lodash');var rp=require('request-promise');var moment=require(_0xd1f2('0x0'));var BPromise=require(_0xd1f2('0x1'));var md5=require(_0xd1f2('0x2'));var jsforce=require('jsforce');var util=require('util');var Redis=require(_0xd1f2('0x3'));var intUtil=require(_0xd1f2('0x4'));var config=require(_0xd1f2('0x5'));var logger=require(_0xd1f2('0x6'))(_0xd1f2('0x7'));config['redis']=_[_0xd1f2('0x8')](config[_0xd1f2('0x9')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xd1f2('0x9')]));function emit(_0x9717f3,_0x242b28,_0x5171be){io['to'](_0x9717f3)[_0xd1f2('0xa')](_0x242b28,_0x5171be);}function getTicket(_0x48b1b9,_0x3c3093,_0x43fb25,_0x1b2205,_0xd20d0,_0x4a4fc6,_0x1bedd1,_0x397ab3){var _0x40a06e=Object[_0xd1f2('0xb')]({},{'OwnerId':_0x3c3093['id'],'Subject':intUtil[_0xd1f2('0xc')](_0x1b2205[_0xd1f2('0xd')],_0xd20d0,'\x20'),'Description':intUtil[_0xd1f2('0xc')](_0x1b2205['Descriptions'],_0xd20d0,'\x0a')},getCustomFields(_0x4a4fc6,_0xd20d0));if(_0x43fb25){if(_0x1b2205[_0xd1f2('0xe')]==='Task'){_0x40a06e[_0xd1f2('0xf')]=moment[_0xd1f2('0x10')]();_0x40a06e['IsReminderSet']=![];_0x40a06e[_0xd1f2('0x11')]=![];if(_0x43fb25[_0xd1f2('0x12')]===_0xd1f2('0x13')||_0x43fb25['endUserType']==='lead'){_0x40a06e['WhoId']=_0x43fb25['id'];}else if(_0x43fb25[_0xd1f2('0x12')]===_0xd1f2('0x14')){_0x40a06e[_0xd1f2('0x15')]=_0x43fb25['id'];}}else if(_0x1b2205[_0xd1f2('0xe')]==='Case'){if(_0x43fb25[_0xd1f2('0x12')]===_0xd1f2('0x13')){_0x40a06e[_0xd1f2('0x16')]=_0x43fb25['id'];}else if(_0x43fb25['endUserType']===_0xd1f2('0x14')){_0x40a06e[_0xd1f2('0x17')]=_0x43fb25['id'];}else if(_0x43fb25[_0xd1f2('0x12')]===_0xd1f2('0x18')&&_0x1b2205[_0xd1f2('0x19')]){_0x40a06e[_0x1b2205[_0xd1f2('0x19')]]=_0x43fb25['id'];}else{logger[_0xd1f2('0x1a')](_0xd1f2('0x1b'));}}}return _0x1bedd1[_0xd1f2('0x1c')](_0x1b2205['ticketType'])[_0xd1f2('0x1d')](_0x40a06e);}function getUser(_0xd0b018,_0x1fa7a5,_0x1147da){if(!_[_0xd1f2('0x1e')](_0x1fa7a5)&&intUtil[_0xd1f2('0x1f')](_0x1fa7a5)){var _0x14b239={'Email':_0x1fa7a5};var _0x5d5f1b={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x1147da[_0xd1f2('0x1c')]('User')['find'](_0x14b239,_0x5d5f1b)['execute']()['then'](function(_0x19e2fe){if(_0x19e2fe[_0xd1f2('0x20')]){var _0x3b2462=_[_0xd1f2('0x21')](_0x19e2fe,function(_0x16e2eb){return _0x16e2eb['Email']===_0x1fa7a5;});if(_0x3b2462){logger[_0xd1f2('0x1a')](_0xd1f2('0x22'),_0x1fa7a5);return BPromise[_0xd1f2('0x23')]({'id':_0x3b2462['Id'],'name':_0x3b2462[_0xd1f2('0x24')]});}}else{logger[_0xd1f2('0x1a')](_0xd1f2('0x25'),_0x1fa7a5);return _0x1147da[_0xd1f2('0x26')]()['then'](function(_0x23cc39){return BPromise['resolve']({'id':_0x23cc39['user_id'],'name':_0x23cc39[_0xd1f2('0x27')]});});}});}else{logger['info'](_0xd1f2('0x25'),_0x1fa7a5);return _0x1147da[_0xd1f2('0x26')]()[_0xd1f2('0x28')](function(_0xe08ed3){return BPromise['resolve']({'id':_0xe08ed3[_0xd1f2('0x29')],'name':_0xe08ed3[_0xd1f2('0x27')]});});}}function getEndUser(_0x189747,_0x23a6c8,_0xc81683,_0xd837c6,_0x57574f){var _0x40bf29={'$or':{'Phone':_0xd837c6}};var _0x524030={'Id':!![],'Name':!![],'Phone':!![]};return BPromise['resolve']()[_0xd1f2('0x28')](function(){logger[_0xd1f2('0x1a')](_0xd1f2('0x2a'),_0xd837c6,_0x23a6c8[_0xd1f2('0x2b')]);switch(_0x23a6c8[_0xd1f2('0x2b')]){case'contact_lead':var _0x1e1817=_[_0xd1f2('0x2c')](_0x40bf29);if(_0x23a6c8[_0xd1f2('0x2d')]){var _0x1b0791={};_0x1b0791[_0x23a6c8[_0xd1f2('0x2d')]]=_0xd837c6;_[_0xd1f2('0x2e')](_0x1e1817[_0xd1f2('0x2f')],_0x1b0791);}return _0x57574f[_0xd1f2('0x1c')](_0xd1f2('0x30'))[_0xd1f2('0x21')](_0x1e1817,_0x524030)[_0xd1f2('0x31')]()[_0xd1f2('0x28')](function(_0x1b024d){if(_0x1b024d&&_0x1b024d[_0xd1f2('0x20')]){return _0x1b024d;}else{var _0x333071=_[_0xd1f2('0x2c')](_0x40bf29);if(_0x23a6c8[_0xd1f2('0x32')]){var _0x164e6d={};_0x164e6d[_0x23a6c8['additionalSearchLead']]=_0xd837c6;_[_0xd1f2('0x2e')](_0x333071['$or'],_0x164e6d);}return _0x57574f[_0xd1f2('0x1c')]('Lead')[_0xd1f2('0x21')](_0x333071,_0x524030);}});case _0xd1f2('0x33'):var _0x41ea9f=_[_0xd1f2('0x2c')](_0x40bf29);if(_0x23a6c8['additionalSearchAccount']){var _0x1b0791={};_0x1b0791[_0x23a6c8[_0xd1f2('0x34')]]=_0xd837c6;_['merge'](_0x41ea9f[_0xd1f2('0x2f')],_0x1b0791);}return _0x57574f[_0xd1f2('0x1c')]('Account')[_0xd1f2('0x21')](_0x41ea9f,_0x524030)[_0xd1f2('0x31')]()['then'](function(_0x2e3412){if(_0x2e3412&&_0x2e3412[_0xd1f2('0x20')]){return _0x2e3412;}else{var _0x1c7dd2=_[_0xd1f2('0x2c')](_0x40bf29);if(_0x23a6c8['additionalSearchContact']){var _0x3d8cd0={};_0x3d8cd0[_0x23a6c8[_0xd1f2('0x2d')]]=_0xd837c6;_[_0xd1f2('0x2e')](_0x1c7dd2[_0xd1f2('0x2f')],_0x3d8cd0);}return _0x57574f[_0xd1f2('0x1c')]('Contact')[_0xd1f2('0x21')](_0x1c7dd2,_0x524030)[_0xd1f2('0x28')](function(_0x4edef6){if(_0x4edef6&&_0x4edef6[_0xd1f2('0x20')]){return _0x4edef6;}else{var _0x11a6ec=_[_0xd1f2('0x2c')](_0x40bf29);if(_0x23a6c8['additionalSearchLead']){var _0x14abf6={};_0x14abf6[_0x23a6c8[_0xd1f2('0x32')]]=_0xd837c6;_[_0xd1f2('0x2e')](_0x11a6ec[_0xd1f2('0x2f')],_0x14abf6);}return _0x57574f[_0xd1f2('0x1c')]('Lead')[_0xd1f2('0x21')](_0x11a6ec,_0x524030);}});}});case _0xd1f2('0x13'):var _0x1e1817=_[_0xd1f2('0x2c')](_0x40bf29);if(_0x23a6c8['additionalSearchContact']){var _0x1b0791={};_0x1b0791[_0x23a6c8[_0xd1f2('0x2d')]]=_0xd837c6;_['merge'](_0x1e1817['$or'],_0x1b0791);}return _0x57574f[_0xd1f2('0x1c')](_0xd1f2('0x30'))[_0xd1f2('0x21')](_0x1e1817,_0x524030)['execute']();case'lead':var _0x296749=_['cloneDeep'](_0x40bf29);if(_0x23a6c8['additionalSearchLead']){var _0x1b0791={};_0x1b0791[_0x23a6c8['additionalSearchLead']]=_0xd837c6;_[_0xd1f2('0x2e')](_0x296749['$or'],_0x1b0791);}return _0x57574f[_0xd1f2('0x1c')](_0xd1f2('0x35'))['find'](_0x296749,_0x524030);case _0xd1f2('0x14'):var _0x41ea9f=_['cloneDeep'](_0x40bf29);if(_0x23a6c8[_0xd1f2('0x34')]){var _0x1b0791={};_0x1b0791[_0x23a6c8['additionalSearchAccount']]=_0xd837c6;_['merge'](_0x41ea9f[_0xd1f2('0x2f')],_0x1b0791);}return _0x57574f[_0xd1f2('0x1c')](_0xd1f2('0x36'))[_0xd1f2('0x21')](_0x41ea9f,_0x524030);default:return null;}})[_0xd1f2('0x28')](function(_0x4016de){if(_0x4016de&&_0x4016de[_0xd1f2('0x20')]){var _0x3986f1=_[_0xd1f2('0x37')](_0x4016de);if(_0x3986f1){return BPromise[_0xd1f2('0x23')]({'id':_0x3986f1['Id'],'name':_0x3986f1[_0xd1f2('0x24')],'phone':_0x3986f1[_0xd1f2('0x38')],'endUserType':_0x3986f1[_0xd1f2('0x39')]['type'][_0xd1f2('0x3a')]()});}}})['then'](function(_0x394366){if(_0x394366){logger[_0xd1f2('0x1a')](_0xd1f2('0x3b'),_0x394366[_0xd1f2('0x12')],_0xd837c6);return BPromise[_0xd1f2('0x23')](_0x394366);}else{logger['info'](_0xd1f2('0x3c'),_0xd837c6);var _0x42a41d={'Phone':_0xd837c6};if(_0x23a6c8[_0xd1f2('0x3d')]){if(_0x23a6c8['moduleCreate']===_0xd1f2('0x13')){logger[_0xd1f2('0x1a')](_0xd1f2('0x3e'),_0xd837c6,_0x23a6c8['moduleCreate']);_0x42a41d[_0xd1f2('0x3f')]=_0xc81683!=='<unknown>'?_0xc81683:util[_0xd1f2('0x40')](_0xd1f2('0x41'),_0xd837c6);}else if(_0x23a6c8['moduleCreate']===_0xd1f2('0x18')){logger['info']('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0xd837c6,_0x23a6c8[_0xd1f2('0x3d')]);_0x42a41d[_0xd1f2('0x3f')]=_0xc81683!==_0xd1f2('0x42')?_0xc81683:util[_0xd1f2('0x40')](_0xd1f2('0x41'),_0xd837c6);_0x42a41d[_0xd1f2('0x43')]=_0xd1f2('0x44');}else if(_0x23a6c8[_0xd1f2('0x3d')]==='account'){logger[_0xd1f2('0x1a')](_0xd1f2('0x3e'),_0xd837c6,_0x23a6c8['moduleCreate']);_0x42a41d[_0xd1f2('0x24')]=_0xc81683!=='<unknown>'?_0xc81683:util[_0xd1f2('0x40')](_0xd1f2('0x41'),_0xd837c6);}else{return null;}}return _0x57574f[_0xd1f2('0x1c')](_[_0xd1f2('0x45')](_0x23a6c8['moduleCreate']))[_0xd1f2('0x1d')](_0x42a41d)[_0xd1f2('0x28')](function(_0x8c892){return BPromise[_0xd1f2('0x23')]({'id':_0x8c892['id'],'endUserType':_0x23a6c8[_0xd1f2('0x3d')]});});}});}function getCustomFields(_0x499bab,_0x4e126b){var _0x57e409={};if(_0x499bab[_0xd1f2('0x20')]>0x0){_[_0xd1f2('0x46')](_0x499bab,function(_0x523a25){if(_['includes']([_0xd1f2('0x47'),_0xd1f2('0x48')],_0x523a25[_0xd1f2('0x49')])&&_0x523a25['idField']){_0x57e409[_0x523a25[_0xd1f2('0x4a')]]=_0x523a25[_0xd1f2('0x4b')][_0xd1f2('0x4c')]();}else if(_0x523a25[_0xd1f2('0x49')]===_0xd1f2('0x4d')&&_0x523a25[_0xd1f2('0x4e')]&&_0x523a25[_0xd1f2('0x4a')]){_0x4e126b[_0x523a25[_0xd1f2('0x4e')]]&&(_0x57e409[_0x523a25[_0xd1f2('0x4a')]]=_0x4e126b[_0x523a25[_0xd1f2('0x4e')]][_0xd1f2('0x4c')]());}else if(_0x523a25[_0xd1f2('0x49')]===_0xd1f2('0x4f')&&_0x523a25[_0xd1f2('0x50')]&&_0x523a25[_0xd1f2('0x50')]['name']&&_0x523a25[_0xd1f2('0x4a')]){_0x4e126b[_0x523a25['Variable'][_0xd1f2('0x51')][_0xd1f2('0x3a')]()]&&(_0x57e409[_0x523a25['idField']]=_0x4e126b[_0x523a25[_0xd1f2('0x50')][_0xd1f2('0x51')][_0xd1f2('0x3a')]()][_0xd1f2('0x4c')]());}});}return _0x57e409;}function getConnection(_0x5606be){var _0x2433a9=_0x5606be[_0xd1f2('0x52')]['concat'](_0x5606be[_0xd1f2('0x53')]);var _0x1f54f3=new jsforce[(_0xd1f2('0x54'))]({'oauth2':{'loginUrl':_0x5606be[_0xd1f2('0x55')]||_0xd1f2('0x56'),'clientId':_0x5606be[_0xd1f2('0x57')],'clientSecret':_0x5606be[_0xd1f2('0x58')]}});return _0x1f54f3[_0xd1f2('0x59')](_0x5606be[_0xd1f2('0x5a')],_0x2433a9)[_0xd1f2('0x28')](function(){logger[_0xd1f2('0x1a')](_0xd1f2('0x5b'));return _0x1f54f3;});}exports[_0xd1f2('0x5c')]=function(_0x3c7334,_0x3d744f,_0x1e6ba2,_0x38994c,_0x5930f7,_0x59076e){var _0x4802c1,_0x2374e5,_0x429349,_0x3a88d5;_0x59076e['serverUrl']=intUtil[_0xd1f2('0x5d')](_0x59076e[_0xd1f2('0x5e')]);_0x59076e[_0xd1f2('0x55')]=intUtil['stripTrailingSlash'](_0x59076e[_0xd1f2('0x55')]);if(_0x5930f7&&_0x5930f7[_0xd1f2('0x5f')]){logger[_0xd1f2('0x1a')](_0xd1f2('0x60'),_0xd1f2('0x61'));_0x3d744f[_0xd1f2('0x62')]=util[_0xd1f2('0x40')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x59076e[_0xd1f2('0x5e')],_0x3d744f[_0xd1f2('0x63')],md5(_0x3d744f['uniqueid']));}else{_0x3d744f[_0xd1f2('0x62')]='';}return getConnection(_0x59076e)[_0xd1f2('0x28')](function(_0x497f14){_0x3a88d5=_0x497f14;return getUser(_0x59076e,_0x38994c[_0xd1f2('0x64')],_0x3a88d5);})[_0xd1f2('0x28')](function(_0x5a0156){_0x4802c1=_0x5a0156;return getEndUser(_0x59076e,_0x1e6ba2,_0x3d744f['calleridname'],_0x3d744f[_0xd1f2('0x65')],_0x3a88d5);})[_0xd1f2('0x28')](function(_0x1484d0){_0x2374e5=_0x1484d0;return getTicket(_0x59076e,_0x4802c1,_0x2374e5,_0x1e6ba2,_0x3d744f,_0x1e6ba2[_0xd1f2('0x66')],_0x3a88d5,_0xd1f2('0x5c'));})[_0xd1f2('0x28')](function(_0x3c8001){_0x429349=_0x3c8001;logger[_0xd1f2('0x1a')](_0xd1f2('0x67'),_0x429349['id']);logger[_0xd1f2('0x1a')](_0xd1f2('0x68'),_0x429349['id'],_0x38994c['name'],_0x59076e[_0xd1f2('0x49')]);switch(_0x59076e[_0xd1f2('0x49')]){case _0xd1f2('0x69'):emit(util[_0xd1f2('0x40')](_0xd1f2('0x6a'),_0x38994c[_0xd1f2('0x51')]),_0xd1f2('0x6b'),{'recordId':_0x429349['id']});break;case _0xd1f2('0x6c'):emit(util[_0xd1f2('0x40')](_0xd1f2('0x6a'),_0x38994c[_0xd1f2('0x51')]),'trigger:browser:url',{'uri':util[_0xd1f2('0x40')]('%s/%s/e',_0x3a88d5['instanceUrl'],_0x429349['id'])});break;default:logger[_0xd1f2('0x6d')](_0xd1f2('0x6e'));}})[_0xd1f2('0x6f')](function(_0x420b41){logger[_0xd1f2('0x6d')]('[QUEUE]',_0x420b41);});};exports['outbound']=function(_0x4f3d87,_0x488e88,_0x54e8db,_0x327366,_0x16e7a6,_0x26eb40,_0x2e3eb2){var _0x38c452,_0xe9daba,_0x4d049c,_0x4d70d3;_0x26eb40[_0xd1f2('0x5e')]=intUtil[_0xd1f2('0x5d')](_0x26eb40[_0xd1f2('0x5e')]);_0x26eb40[_0xd1f2('0x55')]=intUtil['stripTrailingSlash'](_0x26eb40[_0xd1f2('0x55')]);if(_0x2e3eb2&&_0x2e3eb2['recordingFormat']&&_0x2e3eb2['recordingFormat']!==_0xd1f2('0x70')){logger[_0xd1f2('0x1a')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x488e88[_0xd1f2('0x62')]=util[_0xd1f2('0x40')](_0xd1f2('0x71'),_0x26eb40[_0xd1f2('0x5e')],_0x488e88[_0xd1f2('0x63')],md5(_0x488e88[_0xd1f2('0x63')]));}return getConnection(_0x26eb40)[_0xd1f2('0x28')](function(_0x104087){_0x4d70d3=_0x104087;return getUser(_0x26eb40,_0x327366[_0xd1f2('0x64')],_0x4d70d3);})['then'](function(_0x34de60){_0x38c452=_0x34de60;return getEndUser(_0x26eb40,_0x54e8db,_0x488e88[_0xd1f2('0x72')],_0x488e88['destcalleridnum'],_0x4d70d3);})['then'](function(_0x1c5146){_0xe9daba=_0x1c5146;return getTicket(_0x26eb40,_0x38c452,_0xe9daba,_0x54e8db,_0x488e88,_0x54e8db['Fields'],_0x4d70d3,_0xd1f2('0x73'));})[_0xd1f2('0x28')](function(_0x42dd3f){_0x4d049c=_0x42dd3f;logger[_0xd1f2('0x1a')](_0xd1f2('0x74'),_0x4d049c['id']);logger['info'](_0xd1f2('0x75'),_0x4d049c['id'],_0x327366['name'],_0x26eb40[_0xd1f2('0x49')]);switch(_0x26eb40[_0xd1f2('0x49')]){case _0xd1f2('0x69'):emit(util[_0xd1f2('0x40')](_0xd1f2('0x6a'),_0x327366[_0xd1f2('0x51')]),_0xd1f2('0x6b'),{'recordId':_0x4d049c['id']});break;case _0xd1f2('0x6c'):emit(util[_0xd1f2('0x40')](_0xd1f2('0x6a'),_0x327366[_0xd1f2('0x51')]),'trigger:browser:url',{'uri':util[_0xd1f2('0x40')](_0xd1f2('0x76'),_0x4d70d3[_0xd1f2('0x77')],_0x4d049c['id'])});break;default:logger[_0xd1f2('0x6d')]('[OUTBOUND]','Salesforce\x20account\x20type\x20not\x20recognized');}})[_0xd1f2('0x6f')](function(_0x3167a0){logger[_0xd1f2('0x6d')](_0xd1f2('0x78'),_0x3167a0);});};exports[_0xd1f2('0x79')]=function(_0x189bfd,_0x3bdb43,_0x52fead,_0xfa7495,_0x17c233,_0x107ecf){var _0x478e4f,_0x3d46a3,_0x5447eb,_0x104e6b;_0x107ecf[_0xd1f2('0x5e')]=intUtil['stripTrailingSlash'](_0x107ecf[_0xd1f2('0x5e')]);_0x107ecf[_0xd1f2('0x55')]=intUtil['stripTrailingSlash'](_0x107ecf[_0xd1f2('0x55')]);if(_0x17c233&&_0x17c233[_0xd1f2('0x5f')]){logger['info']('['+_0x3bdb43[_0xd1f2('0x7a')][_0xd1f2('0x7b')]()+']','Recording\x20is\x20enabled!');_0x3bdb43['recordingURL']=util[_0xd1f2('0x40')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x107ecf['serverUrl'],_0x3bdb43[_0xd1f2('0x63')],md5(_0x3bdb43[_0xd1f2('0x63')]));}else{_0x3bdb43[_0xd1f2('0x62')]='';}return getConnection(_0x107ecf)['then'](function(_0x1f2e8d){_0x104e6b=_0x1f2e8d;if(!_['isNil'](_0xfa7495)){return getUser(_0x107ecf,_0xfa7495[_0xd1f2('0x51')],_0x104e6b);}else{return getUser(_0x107ecf,null,_0x104e6b);}})[_0xd1f2('0x28')](function(_0x383efa){_0x478e4f=_0x383efa;return getEndUser(_0x107ecf,_0x52fead,_0x3bdb43[_0xd1f2('0x7c')],_0x3bdb43[_0xd1f2('0x65')],_0x104e6b);})[_0xd1f2('0x28')](function(_0x23c241){_0x3d46a3=_0x23c241;return getTicket(_0x107ecf,_0x478e4f,_0x3d46a3,_0x52fead,_0x3bdb43,_0x52fead[_0xd1f2('0x66')],_0x104e6b);})['then'](function(_0x1ecb7d){_0x5447eb=_0x1ecb7d;logger[_0xd1f2('0x1a')]('['+_0x3bdb43[_0xd1f2('0x7a')][_0xd1f2('0x7b')]()+_0xd1f2('0x7d'),_0x5447eb['id']);logger[_0xd1f2('0x1a')]('['+_0x3bdb43['lastevent'][_0xd1f2('0x7b')]()+']\x20Integration\x20account\x20type\x20%s.',_0x107ecf[_0xd1f2('0x49')]);})[_0xd1f2('0x6f')](function(_0x32098f){logger[_0xd1f2('0x6d')]('['+_0x3bdb43[_0xd1f2('0x7a')][_0xd1f2('0x7b')]()+']',_0x32098f);});};
\ No newline at end of file
+var _0xda01=['format','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','calleridnum','Fields','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','trigger:browser:url','%s/%s/e','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','outbound','remoteUri','recordingFormat','[OUTBOUND]','destcalleridname','destcalleridnum','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','trigger:salesforce:display','unmanaged','toUpperCase','lastevent',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','moment','md5','jsforce','util','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','localhost','socket.io-emitter','emit','assign','getString','Subjects','ticketType','Task','ActivityDate','IsReminderSet','IsRecurrence','endUserType','WhoId','account','WhatId','contact','ContactId','AccountId','leadId','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','isNil','User','execute','then','length','find','Agent\x20%s\x20found.','Name','info','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','resolve','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','$or','Contact','additionalSearchLead','merge','Lead','account_contact_lead','additionalSearchAccount','Account','Phone','attributes','type','toLowerCase','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','<unknown>','Caller\x20-\x20%s','lead','Company','No\x20Company','upperFirst','forEach','string','idField','variable','variableName','customVariable','Variable','name','password','securityToken','Connection','https://login.salesforce.com','clientId','clientSecret','username','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL'];(function(_0x556b48,_0x9161b1){var _0x344f73=function(_0x480c3b){while(--_0x480c3b){_0x556b48['push'](_0x556b48['shift']());}};_0x344f73(++_0x9161b1);}(_0xda01,0x194));var _0x1da0=function(_0x157e1d,_0x189cb3){_0x157e1d=_0x157e1d-0x0;var _0x10ee85=_0xda01[_0x157e1d];return _0x10ee85;};'use strict';var _=require(_0x1da0('0x0'));var rp=require(_0x1da0('0x1'));var moment=require(_0x1da0('0x2'));var BPromise=require('bluebird');var md5=require(_0x1da0('0x3'));var jsforce=require(_0x1da0('0x4'));var util=require(_0x1da0('0x5'));var Redis=require('ioredis');var intUtil=require(_0x1da0('0x6'));var config=require(_0x1da0('0x7'));var logger=require(_0x1da0('0x8'))(_0x1da0('0x9'));config['redis']=_['defaults'](config[_0x1da0('0xa')],{'host':_0x1da0('0xb'),'port':0x18eb});var io=require(_0x1da0('0xc'))(new Redis(config['redis']));function emit(_0x1c3762,_0x580db8,_0x582882){io['to'](_0x1c3762)[_0x1da0('0xd')](_0x580db8,_0x582882);}function getTicket(_0x4e0ebc,_0x559ea8,_0x2c8b80,_0x20ab30,_0xd51488,_0xa8123e,_0x33ffe2,_0x19e6b1){var _0x5e629b=Object[_0x1da0('0xe')]({},{'OwnerId':_0x559ea8['id'],'Subject':intUtil[_0x1da0('0xf')](_0x20ab30[_0x1da0('0x10')],_0xd51488,'\x20'),'Description':intUtil[_0x1da0('0xf')](_0x20ab30['Descriptions'],_0xd51488,'\x0a')},getCustomFields(_0xa8123e,_0xd51488));if(_0x2c8b80){if(_0x20ab30[_0x1da0('0x11')]===_0x1da0('0x12')){_0x5e629b[_0x1da0('0x13')]=moment['utc']();_0x5e629b[_0x1da0('0x14')]=![];_0x5e629b[_0x1da0('0x15')]=![];if(_0x2c8b80[_0x1da0('0x16')]==='contact'||_0x2c8b80[_0x1da0('0x16')]==='lead'){_0x5e629b[_0x1da0('0x17')]=_0x2c8b80['id'];}else if(_0x2c8b80[_0x1da0('0x16')]===_0x1da0('0x18')){_0x5e629b[_0x1da0('0x19')]=_0x2c8b80['id'];}}else if(_0x20ab30['ticketType']==='Case'){if(_0x2c8b80[_0x1da0('0x16')]===_0x1da0('0x1a')){_0x5e629b[_0x1da0('0x1b')]=_0x2c8b80['id'];}else if(_0x2c8b80[_0x1da0('0x16')]===_0x1da0('0x18')){_0x5e629b[_0x1da0('0x1c')]=_0x2c8b80['id'];}else if(_0x2c8b80[_0x1da0('0x16')]==='lead'&&_0x20ab30[_0x1da0('0x1d')]){_0x5e629b[_0x20ab30[_0x1da0('0x1d')]]=_0x2c8b80['id'];}else{logger['info'](_0x1da0('0x1e'));}}}return _0x33ffe2[_0x1da0('0x1f')](_0x20ab30[_0x1da0('0x11')])[_0x1da0('0x20')](_0x5e629b);}function getUser(_0x51597c,_0x3069f8,_0x23ac88){if(!_[_0x1da0('0x21')](_0x3069f8)&&intUtil['validateEmail'](_0x3069f8)){var _0x3339e0={'Email':_0x3069f8};var _0x65d05f={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x23ac88[_0x1da0('0x1f')](_0x1da0('0x22'))['find'](_0x3339e0,_0x65d05f)[_0x1da0('0x23')]()[_0x1da0('0x24')](function(_0x61278d){if(_0x61278d[_0x1da0('0x25')]){var _0x3efc5a=_[_0x1da0('0x26')](_0x61278d,function(_0x3041e3){return _0x3041e3['Email']===_0x3069f8;});if(_0x3efc5a){logger['info'](_0x1da0('0x27'),_0x3069f8);return BPromise['resolve']({'id':_0x3efc5a['Id'],'name':_0x3efc5a[_0x1da0('0x28')]});}}else{logger[_0x1da0('0x29')](_0x1da0('0x2a'),_0x3069f8);return _0x23ac88[_0x1da0('0x2b')]()[_0x1da0('0x24')](function(_0x36abda){return BPromise[_0x1da0('0x2c')]({'id':_0x36abda[_0x1da0('0x2d')],'name':_0x36abda[_0x1da0('0x2e')]});});}});}else{logger[_0x1da0('0x29')](_0x1da0('0x2a'),_0x3069f8);return _0x23ac88[_0x1da0('0x2b')]()['then'](function(_0x34d95d){return BPromise[_0x1da0('0x2c')]({'id':_0x34d95d['user_id'],'name':_0x34d95d['display_name']});});}}function getEndUser(_0x1d0443,_0x5ee774,_0x49ef2f,_0x43c077,_0x998074){var _0x37db59={'$or':{'Phone':_0x43c077}};var _0x5630c3={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x1da0('0x2c')]()[_0x1da0('0x24')](function(){logger[_0x1da0('0x29')](_0x1da0('0x2f'),_0x43c077,_0x5ee774[_0x1da0('0x30')]);switch(_0x5ee774['moduleSearch']){case _0x1da0('0x31'):var _0x1e01ed=_[_0x1da0('0x32')](_0x37db59);if(_0x5ee774[_0x1da0('0x33')]){var _0x1eedc8={};_0x1eedc8[_0x5ee774[_0x1da0('0x33')]]=_0x43c077;_['merge'](_0x1e01ed[_0x1da0('0x34')],_0x1eedc8);}return _0x998074['sobject'](_0x1da0('0x35'))['find'](_0x1e01ed,_0x5630c3)[_0x1da0('0x23')]()[_0x1da0('0x24')](function(_0x5ba7c9){if(_0x5ba7c9&&_0x5ba7c9['length']){return _0x5ba7c9;}else{var _0x6527a7=_['cloneDeep'](_0x37db59);if(_0x5ee774[_0x1da0('0x36')]){var _0x3fe0c2={};_0x3fe0c2[_0x5ee774['additionalSearchLead']]=_0x43c077;_[_0x1da0('0x37')](_0x6527a7['$or'],_0x3fe0c2);}return _0x998074[_0x1da0('0x1f')](_0x1da0('0x38'))[_0x1da0('0x26')](_0x6527a7,_0x5630c3);}});case _0x1da0('0x39'):var _0x301e02=_[_0x1da0('0x32')](_0x37db59);if(_0x5ee774[_0x1da0('0x3a')]){var _0x1eedc8={};_0x1eedc8[_0x5ee774[_0x1da0('0x3a')]]=_0x43c077;_[_0x1da0('0x37')](_0x301e02[_0x1da0('0x34')],_0x1eedc8);}return _0x998074[_0x1da0('0x1f')](_0x1da0('0x3b'))['find'](_0x301e02,_0x5630c3)['execute']()[_0x1da0('0x24')](function(_0x28a323){if(_0x28a323&&_0x28a323[_0x1da0('0x25')]){return _0x28a323;}else{var _0x53ca85=_[_0x1da0('0x32')](_0x37db59);if(_0x5ee774['additionalSearchContact']){var _0x1069d5={};_0x1069d5[_0x5ee774[_0x1da0('0x33')]]=_0x43c077;_[_0x1da0('0x37')](_0x53ca85[_0x1da0('0x34')],_0x1069d5);}return _0x998074[_0x1da0('0x1f')](_0x1da0('0x35'))[_0x1da0('0x26')](_0x53ca85,_0x5630c3)[_0x1da0('0x24')](function(_0x21843b){if(_0x21843b&&_0x21843b['length']){return _0x21843b;}else{var _0x283242=_[_0x1da0('0x32')](_0x37db59);if(_0x5ee774[_0x1da0('0x36')]){var _0x4e338e={};_0x4e338e[_0x5ee774[_0x1da0('0x36')]]=_0x43c077;_['merge'](_0x283242[_0x1da0('0x34')],_0x4e338e);}return _0x998074[_0x1da0('0x1f')](_0x1da0('0x38'))[_0x1da0('0x26')](_0x283242,_0x5630c3);}});}});case'contact':var _0x1e01ed=_['cloneDeep'](_0x37db59);if(_0x5ee774['additionalSearchContact']){var _0x1eedc8={};_0x1eedc8[_0x5ee774['additionalSearchContact']]=_0x43c077;_[_0x1da0('0x37')](_0x1e01ed[_0x1da0('0x34')],_0x1eedc8);}return _0x998074[_0x1da0('0x1f')](_0x1da0('0x35'))[_0x1da0('0x26')](_0x1e01ed,_0x5630c3)[_0x1da0('0x23')]();case'lead':var _0x2cc039=_[_0x1da0('0x32')](_0x37db59);if(_0x5ee774['additionalSearchLead']){var _0x1eedc8={};_0x1eedc8[_0x5ee774[_0x1da0('0x36')]]=_0x43c077;_[_0x1da0('0x37')](_0x2cc039[_0x1da0('0x34')],_0x1eedc8);}return _0x998074[_0x1da0('0x1f')](_0x1da0('0x38'))['find'](_0x2cc039,_0x5630c3);case _0x1da0('0x18'):var _0x301e02=_[_0x1da0('0x32')](_0x37db59);if(_0x5ee774[_0x1da0('0x3a')]){var _0x1eedc8={};_0x1eedc8[_0x5ee774[_0x1da0('0x3a')]]=_0x43c077;_[_0x1da0('0x37')](_0x301e02[_0x1da0('0x34')],_0x1eedc8);}return _0x998074['sobject'](_0x1da0('0x3b'))[_0x1da0('0x26')](_0x301e02,_0x5630c3);default:return null;}})[_0x1da0('0x24')](function(_0x5105bd){if(_0x5105bd&&_0x5105bd['length']){var _0x15e83b=_['first'](_0x5105bd);if(_0x15e83b){return BPromise[_0x1da0('0x2c')]({'id':_0x15e83b['Id'],'name':_0x15e83b[_0x1da0('0x28')],'phone':_0x15e83b[_0x1da0('0x3c')],'endUserType':_0x15e83b[_0x1da0('0x3d')][_0x1da0('0x3e')][_0x1da0('0x3f')]()});}}})[_0x1da0('0x24')](function(_0x3c7e2f){if(_0x3c7e2f){logger[_0x1da0('0x29')]('Enduser\x20(%s)\x20with\x20phone\x20%s\x20found',_0x3c7e2f['endUserType'],_0x43c077);return BPromise[_0x1da0('0x2c')](_0x3c7e2f);}else{logger[_0x1da0('0x29')](_0x1da0('0x40'),_0x43c077);var _0xbc7db3={'Phone':_0x43c077};if(_0x5ee774[_0x1da0('0x41')]){if(_0x5ee774['moduleCreate']===_0x1da0('0x1a')){logger[_0x1da0('0x29')](_0x1da0('0x42'),_0x43c077,_0x5ee774['moduleCreate']);_0xbc7db3[_0x1da0('0x43')]=_0x49ef2f!==_0x1da0('0x44')?_0x49ef2f:util['format'](_0x1da0('0x45'),_0x43c077);}else if(_0x5ee774[_0x1da0('0x41')]===_0x1da0('0x46')){logger['info'](_0x1da0('0x42'),_0x43c077,_0x5ee774['moduleCreate']);_0xbc7db3['LastName']=_0x49ef2f!==_0x1da0('0x44')?_0x49ef2f:util['format'](_0x1da0('0x45'),_0x43c077);_0xbc7db3[_0x1da0('0x47')]=_0x1da0('0x48');}else if(_0x5ee774[_0x1da0('0x41')]===_0x1da0('0x18')){logger[_0x1da0('0x29')](_0x1da0('0x42'),_0x43c077,_0x5ee774[_0x1da0('0x41')]);_0xbc7db3[_0x1da0('0x28')]=_0x49ef2f!==_0x1da0('0x44')?_0x49ef2f:util['format'](_0x1da0('0x45'),_0x43c077);}else{return null;}}return _0x998074[_0x1da0('0x1f')](_[_0x1da0('0x49')](_0x5ee774[_0x1da0('0x41')]))['create'](_0xbc7db3)['then'](function(_0x410a15){return BPromise[_0x1da0('0x2c')]({'id':_0x410a15['id'],'endUserType':_0x5ee774[_0x1da0('0x41')]});});}});}function getCustomFields(_0x13050e,_0x2fd5e7){var _0x318825={};if(_0x13050e[_0x1da0('0x25')]>0x0){_[_0x1da0('0x4a')](_0x13050e,function(_0x51b4db){if(_['includes']([_0x1da0('0x4b'),'picklist'],_0x51b4db[_0x1da0('0x3e')])&&_0x51b4db[_0x1da0('0x4c')]){_0x318825[_0x51b4db['idField']]=_0x51b4db['content']['toString']();}else if(_0x51b4db[_0x1da0('0x3e')]===_0x1da0('0x4d')&&_0x51b4db[_0x1da0('0x4e')]&&_0x51b4db[_0x1da0('0x4c')]){_0x2fd5e7[_0x51b4db[_0x1da0('0x4e')]]&&(_0x318825[_0x51b4db['idField']]=_0x2fd5e7[_0x51b4db[_0x1da0('0x4e')]]['toString']());}else if(_0x51b4db[_0x1da0('0x3e')]===_0x1da0('0x4f')&&_0x51b4db[_0x1da0('0x50')]&&_0x51b4db['Variable'][_0x1da0('0x51')]&&_0x51b4db[_0x1da0('0x4c')]){_0x2fd5e7[_0x51b4db[_0x1da0('0x50')]['name']['toLowerCase']()]&&(_0x318825[_0x51b4db[_0x1da0('0x4c')]]=_0x2fd5e7[_0x51b4db[_0x1da0('0x50')][_0x1da0('0x51')]['toLowerCase']()]['toString']());}});}return _0x318825;}function getConnection(_0x27fbc6){var _0x11b84e=_0x27fbc6[_0x1da0('0x52')]['concat'](_0x27fbc6[_0x1da0('0x53')]);var _0x558d7a=new jsforce[(_0x1da0('0x54'))]({'oauth2':{'loginUrl':_0x27fbc6['remoteUri']||_0x1da0('0x55'),'clientId':_0x27fbc6[_0x1da0('0x56')],'clientSecret':_0x27fbc6[_0x1da0('0x57')]}});return _0x558d7a['login'](_0x27fbc6[_0x1da0('0x58')],_0x11b84e)[_0x1da0('0x24')](function(){logger[_0x1da0('0x29')]('Connection\x20established.');return _0x558d7a;});}exports[_0x1da0('0x59')]=function(_0x2de448,_0x4cee28,_0x555ce2,_0x500da7,_0x34f82b,_0x5f2662){var _0x300b69,_0xe54949,_0x30712e,_0x18a3fc;_0x5f2662[_0x1da0('0x5a')]=intUtil[_0x1da0('0x5b')](_0x5f2662['serverUrl']);_0x5f2662['remoteUri']=intUtil[_0x1da0('0x5b')](_0x5f2662['remoteUri']);if(_0x34f82b&&_0x34f82b[_0x1da0('0x5c')]){logger[_0x1da0('0x29')](_0x1da0('0x5d'),_0x1da0('0x5e'));_0x4cee28[_0x1da0('0x5f')]=util[_0x1da0('0x60')](_0x1da0('0x61'),_0x5f2662[_0x1da0('0x5a')],_0x4cee28[_0x1da0('0x62')],md5(_0x4cee28[_0x1da0('0x62')]));}else{_0x4cee28[_0x1da0('0x5f')]='';}return getConnection(_0x5f2662)['then'](function(_0x362c3c){_0x18a3fc=_0x362c3c;return getUser(_0x5f2662,_0x500da7[_0x1da0('0x63')],_0x18a3fc);})[_0x1da0('0x24')](function(_0xd8f1cd){_0x300b69=_0xd8f1cd;return getEndUser(_0x5f2662,_0x555ce2,_0x4cee28[_0x1da0('0x64')],_0x4cee28[_0x1da0('0x65')],_0x18a3fc);})['then'](function(_0x5ba12d){_0xe54949=_0x5ba12d;return getTicket(_0x5f2662,_0x300b69,_0xe54949,_0x555ce2,_0x4cee28,_0x555ce2[_0x1da0('0x66')],_0x18a3fc,_0x1da0('0x59'));})[_0x1da0('0x24')](function(_0x572a32){_0x30712e=_0x572a32;logger[_0x1da0('0x29')](_0x1da0('0x67'),_0x30712e['id']);logger[_0x1da0('0x29')](_0x1da0('0x68'),_0x30712e['id'],_0x500da7[_0x1da0('0x51')],_0x5f2662[_0x1da0('0x3e')]);switch(_0x5f2662[_0x1da0('0x3e')]){case _0x1da0('0x69'):emit(util[_0x1da0('0x60')](_0x1da0('0x6a'),_0x500da7[_0x1da0('0x51')]),'trigger:salesforce:display',{'recordId':_0x30712e['id']});break;case'newTab':emit(util['format'](_0x1da0('0x6a'),_0x500da7['name']),_0x1da0('0x6b'),{'uri':util[_0x1da0('0x60')](_0x1da0('0x6c'),_0x18a3fc['instanceUrl'],_0x30712e['id'])});break;default:logger[_0x1da0('0x6d')](_0x1da0('0x6e'));}})[_0x1da0('0x6f')](function(_0x52f3d1){logger['error'](_0x1da0('0x5d'),_0x52f3d1);});};exports[_0x1da0('0x70')]=function(_0x27a42a,_0x36518e,_0x6526d6,_0x5d841b,_0x251230,_0x703496,_0x151b06){var _0x14de18,_0x5c41e1,_0x332f71,_0x37247f;_0x703496['serverUrl']=intUtil[_0x1da0('0x5b')](_0x703496['serverUrl']);_0x703496['remoteUri']=intUtil['stripTrailingSlash'](_0x703496[_0x1da0('0x71')]);if(_0x151b06&&_0x151b06['recordingFormat']&&_0x151b06[_0x1da0('0x72')]!=='none'){logger[_0x1da0('0x29')](_0x1da0('0x73'),_0x1da0('0x5e'));_0x36518e[_0x1da0('0x5f')]=util[_0x1da0('0x60')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x703496['serverUrl'],_0x36518e[_0x1da0('0x62')],md5(_0x36518e[_0x1da0('0x62')]));}return getConnection(_0x703496)[_0x1da0('0x24')](function(_0x39e1a4){_0x37247f=_0x39e1a4;return getUser(_0x703496,_0x5d841b['email'],_0x37247f);})[_0x1da0('0x24')](function(_0x5a5994){_0x14de18=_0x5a5994;return getEndUser(_0x703496,_0x6526d6,_0x36518e[_0x1da0('0x74')],_0x36518e[_0x1da0('0x75')],_0x37247f);})[_0x1da0('0x24')](function(_0x3fd740){_0x5c41e1=_0x3fd740;return getTicket(_0x703496,_0x14de18,_0x5c41e1,_0x6526d6,_0x36518e,_0x6526d6['Fields'],_0x37247f,'outbound');})['then'](function(_0x4fd0ae){_0x332f71=_0x4fd0ae;logger[_0x1da0('0x29')]('[OUTBOUND]\x20Ticket\x20%s\x20created.',_0x332f71['id']);logger['info'](_0x1da0('0x76'),_0x332f71['id'],_0x5d841b['name'],_0x703496[_0x1da0('0x3e')]);switch(_0x703496[_0x1da0('0x3e')]){case _0x1da0('0x69'):emit(util[_0x1da0('0x60')]('user:%s',_0x5d841b[_0x1da0('0x51')]),_0x1da0('0x77'),{'recordId':_0x332f71['id']});break;case'newTab':emit(util[_0x1da0('0x60')](_0x1da0('0x6a'),_0x5d841b[_0x1da0('0x51')]),_0x1da0('0x6b'),{'uri':util[_0x1da0('0x60')](_0x1da0('0x6c'),_0x37247f['instanceUrl'],_0x332f71['id'])});break;default:logger[_0x1da0('0x6d')](_0x1da0('0x73'),'Salesforce\x20account\x20type\x20not\x20recognized');}})[_0x1da0('0x6f')](function(_0x4c7bcd){logger[_0x1da0('0x6d')]('[OUTBOUND]',_0x4c7bcd);});};exports[_0x1da0('0x78')]=function(_0x33513d,_0x437980,_0x270685,_0x74c225,_0x3721e9,_0x3e8151){var _0x1bcdb6,_0x2091ad,_0x4e69fd,_0x4c6a3e;_0x3e8151['serverUrl']=intUtil[_0x1da0('0x5b')](_0x3e8151['serverUrl']);_0x3e8151['remoteUri']=intUtil['stripTrailingSlash'](_0x3e8151[_0x1da0('0x71')]);if(_0x3721e9&&_0x3721e9['monitor_format']){logger[_0x1da0('0x29')]('['+_0x437980['lastevent'][_0x1da0('0x79')]()+']',_0x1da0('0x5e'));_0x437980[_0x1da0('0x5f')]=util[_0x1da0('0x60')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3e8151[_0x1da0('0x5a')],_0x437980[_0x1da0('0x62')],md5(_0x437980[_0x1da0('0x62')]));}else{_0x437980[_0x1da0('0x5f')]='';}return getConnection(_0x3e8151)['then'](function(_0x101588){_0x4c6a3e=_0x101588;if(!_[_0x1da0('0x21')](_0x74c225)){return getUser(_0x3e8151,_0x74c225[_0x1da0('0x51')],_0x4c6a3e);}else{return getUser(_0x3e8151,null,_0x4c6a3e);}})[_0x1da0('0x24')](function(_0x1caf20){_0x1bcdb6=_0x1caf20;return getEndUser(_0x3e8151,_0x270685,_0x437980[_0x1da0('0x64')],_0x437980[_0x1da0('0x65')],_0x4c6a3e);})[_0x1da0('0x24')](function(_0x3e213e){_0x2091ad=_0x3e213e;return getTicket(_0x3e8151,_0x1bcdb6,_0x2091ad,_0x270685,_0x437980,_0x270685[_0x1da0('0x66')],_0x4c6a3e);})[_0x1da0('0x24')](function(_0x403be5){_0x4e69fd=_0x403be5;logger['info']('['+_0x437980[_0x1da0('0x7a')]['toUpperCase']()+_0x1da0('0x7b'),_0x4e69fd['id']);logger[_0x1da0('0x29')]('['+_0x437980[_0x1da0('0x7a')][_0x1da0('0x79')]()+_0x1da0('0x7c'),_0x3e8151[_0x1da0('0x3e')]);})[_0x1da0('0x6f')](function(_0x5c4332){logger[_0x1da0('0x6d')]('['+_0x437980[_0x1da0('0x7a')][_0x1da0('0x79')]()+']',_0x5c4332);});};
\ No newline at end of file