acd57d5e68a4a6afa34a4112df2dd7cc7a76737a
[motion2.git] / server / services / ami / trigger / integration / sugarcrm.js
1 // *************************************************************************
2 // *                                                                       *
3 // * xCALLY Motion -  The Omnichannel Contact Center                       *
4 // * Copyright (c) Xenialab s.r.l. All Rights Reserved                     *
5 // *                                                                       *
6 // *************************************************************************
7 // *                                                                       *
8 // * Email: info@xcally.com                                                *
9 // * Website: https://www.xcally.com                                       *
10 // *                                                                       *
11 // *************************************************************************
12 // *                                                                       *
13 // * The SOFTWARE PRODUCT is protected by copyright laws and international *
14 // * copyright treaties, as well as other intellectual property laws and   *
15 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                         *
16 // *                                                                       *
17 // *************************************************************************
18 var _0x5fd8=['Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','find','name_value_list','value','info','Agent\x20found!','resolve','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','set_entry','first_name','<unknown>','Caller\x20-\x20%s','Enduser\x20created.','[HTTP]','merge','map','type','string','nameField','customField','toLowerCase','content','custom_fields','variable','Variable','POST','login','username','PLAIN','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','remoteUri','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','recordingURL','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','contacts','version','charAt','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','error','outbound','recordingFormat','none','uniqueid','destcalleridname','destcalleridnum','Outbound','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','[OUTBOUND]','trigger:browser:url','catch','unmanaged','lastevent','lodash','request-promise','bluebird','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','localhost','socket.io-emitter','emit','Creating\x20new\x20ticket...','name','getString','Subjects','assigned_user_id','created_by','date_start','toISOString','duration_hours','duration_minutes','parent_id','Contacts','parent_name','direction','length','forEach','variableName','push','idField','JSON','stringify','Calls','format','Basic\x20%s','toString','base64','isNil','Getting\x20agent\x20with\x20name'];(function(_0x2b7806,_0x3b0257){var _0x162485=function(_0x5174f3){while(--_0x5174f3){_0x2b7806['push'](_0x2b7806['shift']());}};_0x162485(++_0x3b0257);}(_0x5fd8,0xc8));var _0x85fd=function(_0x1a0d7e,_0x301787){_0x1a0d7e=_0x1a0d7e-0x0;var _0x158962=_0x5fd8[_0x1a0d7e];return _0x158962;};'use strict';var _=require(_0x85fd('0x0'));var rp=require(_0x85fd('0x1'));var BPromise=require(_0x85fd('0x2'));var md5=require(_0x85fd('0x3'));var util=require('util');var Redis=require(_0x85fd('0x4'));var intUtil=require(_0x85fd('0x5'));var config=require(_0x85fd('0x6'));var logger=require(_0x85fd('0x7'))('sugarcrm');config['redis']=_['defaults'](config[_0x85fd('0x8')],{'host':_0x85fd('0x9'),'port':0x18eb});var io=require(_0x85fd('0xa'))(new Redis(config['redis']));var def={'method':'POST','json':!![]};function emit(_0x287c3d,_0x433d9f,_0x97ebb4){io['to'](_0x287c3d)[_0x85fd('0xb')](_0x433d9f,_0x97ebb4);}function getTicket(_0x3cc6b6,_0x101621,_0x50ee48,_0xe038c6,_0xa8f79b,_0x22e64e,_0x257fed,_0x45d902){logger['info'](_0x85fd('0xc'));var _0xe56588=new Date();var _0x32cf1e=[{'name':_0x85fd('0xd'),'value':intUtil[_0x85fd('0xe')](_0xe038c6[_0x85fd('0xf')],_0xa8f79b,'\x20')},{'name':_0x85fd('0x10'),'value':_0x101621['id']},{'name':_0x85fd('0x11'),'value':_0x101621['id']},{'name':'description','value':intUtil[_0x85fd('0xe')](_0xe038c6['Descriptions'],_0xa8f79b,'\x0a')},{'name':_0x85fd('0x12'),'value':_0xe56588[_0x85fd('0x13')]()['slice'](0x0,0x13)['replace']('T','\x20')},{'name':_0x85fd('0x14'),'value':'0'},{'name':_0x85fd('0x15'),'value':'15'},{'name':_0x85fd('0x16'),'value':_0x50ee48['id']},{'name':'parent_type','value':_0x85fd('0x17')},{'name':_0x85fd('0x18'),'value':_0x50ee48[_0x85fd('0xd')]},{'name':_0x85fd('0x19'),'value':_0x45d902}];if(_0x22e64e[_0x85fd('0x1a')]){_[_0x85fd('0x1b')](_0x22e64e,function(_0x46d1ce){if(_0xa8f79b[_0x46d1ce[_0x85fd('0x1c')]]){_0x32cf1e[_0x85fd('0x1d')]({'name':_0x46d1ce[_0x85fd('0x1e')],'value':_0xa8f79b[_0x46d1ce['variableName']]});}});}return request({'form':{'method':'set_entry','input_type':_0x85fd('0x1f'),'response_type':_0x85fd('0x1f'),'rest_data':JSON[_0x85fd('0x20')]({'session':_0x257fed['id'],'module_name':_0x85fd('0x21'),'name_value_list':_0x32cf1e})}});}function getAuth(_0x31d5d8){return util[_0x85fd('0x22')](_0x85fd('0x23'),new Buffer(_0x31d5d8['apiKey']+':X')[_0x85fd('0x24')](_0x85fd('0x25')));}function getServerInfo(_0x4641b9){return request({'form':{'method':'get_server_info','input_type':_0x85fd('0x1f'),'response_type':_0x85fd('0x1f'),'rest_data':JSON['stringify']({'session':_0x4641b9['id']})}});}function getUser(_0x1358bc,_0x5487c2,_0x4527d9){if(!_[_0x85fd('0x26')](_0x5487c2)){logger['info'](_0x85fd('0x27'),_0x5487c2);return request({'form':{'method':'get_entry_list','input_type':_0x85fd('0x1f'),'response_type':'JSON','rest_data':JSON[_0x85fd('0x20')]({'session':_0x4527d9['id'],'module_name':_0x85fd('0x28'),'query':util['format'](_0x85fd('0x29'),_0x5487c2),'order_by':'','offset':'0','select_fields':['id','name',_0x85fd('0x2a')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x85fd('0x2b')](function(_0x4d5cad){if(_0x4d5cad[_0x85fd('0x2c')][_0x85fd('0x1a')]){var _0x51a083=_[_0x85fd('0x2d')](_0x4d5cad[_0x85fd('0x2c')],function(_0x8b32b6){return _0x8b32b6[_0x85fd('0x2e')][_0x85fd('0x2a')][_0x85fd('0x2f')]===_0x5487c2;});if(_0x51a083){logger[_0x85fd('0x30')](_0x85fd('0x31'));return BPromise[_0x85fd('0x32')]({'id':_0x51a083['name_value_list']['id'][_0x85fd('0x2f')],'name':_0x51a083['name_value_list'][_0x85fd('0xd')][_0x85fd('0x2f')]});}}logger[_0x85fd('0x30')](_0x85fd('0x33'));return BPromise[_0x85fd('0x32')]({'id':_0x4527d9[_0x85fd('0x2e')][_0x85fd('0x34')][_0x85fd('0x2f')],'name':_0x4527d9['name_value_list'][_0x85fd('0x2a')][_0x85fd('0x2f')]});});}else{logger[_0x85fd('0x30')]('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise['resolve']({'id':_0x4527d9[_0x85fd('0x2e')][_0x85fd('0x34')][_0x85fd('0x2f')],'name':_0x4527d9['name_value_list']['user_name']['value']});}}function getEndUser(_0x10f90b,_0x4a1d4b,_0x2a5bb2,_0x3ac059){logger['info'](_0x85fd('0x35'),_0x2a5bb2);return request({'form':{'method':'get_entry_list','input_type':_0x85fd('0x1f'),'response_type':'JSON','rest_data':JSON[_0x85fd('0x20')]({'session':_0x3ac059['id'],'module_name':'Contacts','query':util[_0x85fd('0x22')](_0x85fd('0x36'),_0x2a5bb2),'order_by':'','offset':'0','select_fields':['id',_0x85fd('0xd'),'phone_home'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0xdbf64d){if(_0xdbf64d[_0x85fd('0x2c')][_0x85fd('0x1a')]){var _0x33be37=_[_0x85fd('0x2d')](_0xdbf64d['entry_list'],function(_0x305d51){return _0x305d51[_0x85fd('0x2e')][_0x85fd('0x37')][_0x85fd('0x2f')]===_0x2a5bb2;});if(_0x33be37){logger['info'](_0x85fd('0x38'));return BPromise[_0x85fd('0x32')]({'id':_0x33be37['name_value_list']['id'][_0x85fd('0x2f')],'name':_0x33be37[_0x85fd('0x2e')][_0x85fd('0xd')][_0x85fd('0x2f')],'phone':_0x33be37[_0x85fd('0x2e')][_0x85fd('0x37')][_0x85fd('0x2f')]});}}else{logger['info'](_0x85fd('0x39'));return request({'form':{'method':_0x85fd('0x3a'),'input_type':_0x85fd('0x1f'),'response_type':'JSON','rest_data':JSON[_0x85fd('0x20')]({'session':_0x3ac059['id'],'module_name':_0x85fd('0x17'),'name_value_list':[{'name':_0x85fd('0x3b'),'value':_0x4a1d4b!==_0x85fd('0x3c')?_0x4a1d4b:util[_0x85fd('0x22')](_0x85fd('0x3d'),_0x2a5bb2)},{'name':_0x85fd('0x37'),'value':_0x2a5bb2}]})}})[_0x85fd('0x2b')](function(_0x564816){logger[_0x85fd('0x30')](_0x85fd('0x3e'));return BPromise[_0x85fd('0x32')]({'id':_0x564816['id'],'name':_0x564816[_0x85fd('0x2c')][_0x85fd('0x3b')]['value'],'phone':_0x564816['entry_list'][_0x85fd('0x37')]['value']});});}});}function request(_0x437a57){logger['debug'](_0x85fd('0x3f'),JSON[_0x85fd('0x20')](_0x437a57));return rp(_[_0x85fd('0x40')](def,_0x437a57));}function getTags(_0x30d5b8,_0x52c2ba){var _0x3ec24f=[];if(_0x30d5b8&&_0x30d5b8[_0x85fd('0x1a')]>0x0){_0x3ec24f=_[_0x85fd('0x41')](_0x30d5b8,_0x52c2ba);}return _0x3ec24f;}function getCustomFields(_0x325457,_0x1dcee1){var _0x243e1f=[];var _0x40aad3={'custom_fields':[]};if(_0x325457[_0x85fd('0x1a')]>0x0){_[_0x85fd('0x1b')](_0x325457,function(_0x17cfe8){if(_0x17cfe8[_0x85fd('0x42')]===_0x85fd('0x43')&&_0x17cfe8[_0x85fd('0x44')]&&!_0x17cfe8[_0x85fd('0x45')]){_0x40aad3[_0x17cfe8['nameField'][_0x85fd('0x46')]()]=_0x17cfe8[_0x85fd('0x47')][_0x85fd('0x24')]();}else if(_0x17cfe8[_0x85fd('0x42')]===_0x85fd('0x43')&&_0x17cfe8[_0x85fd('0x1e')]&&_0x17cfe8[_0x85fd('0x45')]){_0x40aad3[_0x85fd('0x48')]['push']({'id':_0x17cfe8[_0x85fd('0x1e')],'value':_0x17cfe8[_0x85fd('0x47')]['toString']()});}else if(_0x17cfe8[_0x85fd('0x42')]===_0x85fd('0x49')&&_0x17cfe8['variableName']&&_0x17cfe8['idField']&&_0x17cfe8[_0x85fd('0x45')]){_0x1dcee1[_0x17cfe8[_0x85fd('0x1c')]]&&_0x40aad3[_0x85fd('0x48')][_0x85fd('0x1d')]({'id':_0x17cfe8['idField'],'value':_0x1dcee1[_0x17cfe8['variableName']][_0x85fd('0x24')]()});}else if(_0x17cfe8['type']==='customVariable'&&_0x17cfe8[_0x85fd('0x4a')]&&_0x17cfe8[_0x85fd('0x4a')][_0x85fd('0xd')]&&_0x17cfe8[_0x85fd('0x1e')]&&_0x17cfe8['customField']){_0x1dcee1[_0x17cfe8[_0x85fd('0x4a')][_0x85fd('0xd')][_0x85fd('0x46')]()]&&_0x40aad3[_0x85fd('0x48')]['push']({'id':_0x17cfe8[_0x85fd('0x1e')],'value':_0x1dcee1[_0x17cfe8[_0x85fd('0x4a')][_0x85fd('0xd')][_0x85fd('0x46')]()][_0x85fd('0x24')]()});}});}return _0x40aad3;}function getConnection(_0x4740ec){return request({'method':_0x85fd('0x4b'),'form':{'method':_0x85fd('0x4c'),'input_type':_0x85fd('0x1f'),'response_type':_0x85fd('0x1f'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x4740ec[_0x85fd('0x4d')],'password':_0x4740ec['password'],'encryption':_0x85fd('0x4e')},'application':'xCALLY\x20Motion\x20integration'})}})[_0x85fd('0x2b')](function(_0xd61c6){var _0x1d4691=_0xd61c6;if(_0x1d4691['id']){def['sessionID']=_0x1d4691['id'];return BPromise['resolve'](_0x1d4691);}else{throw new Error(util['format'](_0x85fd('0x4f'),_0x4740ec['id']));}});}function setRelationship(_0x3ac244,_0x6db202,_0x152f66,_0x4e0141){return request({'form':{'method':_0x85fd('0x50'),'input_type':_0x85fd('0x1f'),'response_type':'JSON','rest_data':JSON[_0x85fd('0x20')]({'session':_0x3ac244['id'],'module_name':_0x85fd('0x21'),'module_id':_0x152f66['id'],'link_field_name':_0x4e0141,'related_ids':[_0x6db202['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x85fd('0x51')]=function(_0x2b1040,_0x354354,_0x5b2c74,_0x423cce,_0x30ab42,_0xea5d33){var _0x2b5d4a,_0x508d30,_0x87da3f,_0x2d3161;_0xea5d33[_0x85fd('0x52')]=intUtil[_0x85fd('0x53')](_0xea5d33[_0x85fd('0x52')]);_0xea5d33[_0x85fd('0x54')]=intUtil['stripTrailingSlash'](_0xea5d33[_0x85fd('0x54')]);def[_0x85fd('0x55')]=util[_0x85fd('0x22')](_0x85fd('0x56'),_0xea5d33[_0x85fd('0x52')]);if(_0x30ab42&&_0x30ab42[_0x85fd('0x57')]){logger['info']('[QUEUE]',_0x85fd('0x58'));_0x354354['recordingURL']=util[_0x85fd('0x22')](_0x85fd('0x59'),_0xea5d33[_0x85fd('0x54')],_0x354354['uniqueid'],md5(_0x354354['uniqueid']));}else{_0x354354[_0x85fd('0x5a')]='';}return getConnection(_0xea5d33)[_0x85fd('0x2b')](function(_0x3d7807){_0x2d3161=_0x3d7807;return getUser(_0xea5d33,_0x423cce[_0x85fd('0xd')],_0x2d3161);})[_0x85fd('0x2b')](function(_0x511750){_0x2b5d4a=_0x511750;logger[_0x85fd('0x30')](_0x85fd('0x5b'),_0x2b5d4a['id']);return getEndUser(_0xea5d33,_0x354354[_0x85fd('0x5c')],_0x354354[_0x85fd('0x5d')],_0x2d3161);})[_0x85fd('0x2b')](function(_0x4930c6){_0x508d30=_0x4930c6;logger[_0x85fd('0x30')](_0x85fd('0x5e'),_0x508d30['id']);return getTicket(_0xea5d33,_0x2b5d4a,_0x508d30,_0x5b2c74,_0x354354,_0x5b2c74[_0x85fd('0x5f')],_0x2d3161,_0x85fd('0x60'));})[_0x85fd('0x2b')](function(_0x1c6b36){_0x87da3f=_0x1c6b36;logger[_0x85fd('0x30')](_0x85fd('0x61'));logger[_0x85fd('0x30')](_0x85fd('0x62'),_0x87da3f['id']);return setRelationship(_0x2d3161,_0x2b5d4a,_0x87da3f,_0x85fd('0x63'));})[_0x85fd('0x2b')](function(){return setRelationship(_0x2d3161,_0x508d30,_0x87da3f,_0x85fd('0x64'));})[_0x85fd('0x2b')](function(){return getServerInfo(_0x2d3161);})[_0x85fd('0x2b')](function(_0x292f3a){var _0x42b439=parseInt(_0x292f3a[_0x85fd('0x65')][_0x85fd('0x66')](0x0));var _0x22992b=util[_0x85fd('0x22')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0xea5d33[_0x85fd('0x52')],_0x87da3f['id']);if(_0x42b439>0x6){_0x22992b=util[_0x85fd('0x22')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0xea5d33['remoteUri'],_0x87da3f['id']);}logger[_0x85fd('0x30')](_0x85fd('0x67'),_0x85fd('0x68'));emit(util[_0x85fd('0x22')](_0x85fd('0x69'),_0x423cce['name']),'trigger:browser:url',{'uri':_0x22992b});})['catch'](function(_0x5e81ae){logger[_0x85fd('0x6a')]('[QUEUE]',JSON[_0x85fd('0x20')](_0x5e81ae));});};exports[_0x85fd('0x6b')]=function(_0x755d4b,_0x285ac8,_0x5a24b5,_0x58a108,_0x2b036b,_0x496b3c,_0x3f4093){var _0x52f7df,_0x3c28ce,_0x43f04c,_0x409723;_0x496b3c[_0x85fd('0x52')]=intUtil[_0x85fd('0x53')](_0x496b3c[_0x85fd('0x52')]);_0x496b3c[_0x85fd('0x54')]=intUtil[_0x85fd('0x53')](_0x496b3c[_0x85fd('0x54')]);def[_0x85fd('0x55')]=util[_0x85fd('0x22')]('%s/service/v4_1/rest.php',_0x496b3c[_0x85fd('0x52')]);if(_0x3f4093&&_0x3f4093[_0x85fd('0x6c')]&&_0x3f4093[_0x85fd('0x6c')]!==_0x85fd('0x6d')){logger[_0x85fd('0x30')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x285ac8[_0x85fd('0x5a')]=util['format'](_0x85fd('0x59'),_0x496b3c['serverUrl'],_0x285ac8[_0x85fd('0x6e')],md5(_0x285ac8['uniqueid']));}return getConnection(_0x496b3c)[_0x85fd('0x2b')](function(_0x2f8605){_0x409723=_0x2f8605;return getUser(_0x496b3c,_0x58a108[_0x85fd('0xd')],_0x409723);})[_0x85fd('0x2b')](function(_0x5ce5e2){_0x52f7df=_0x5ce5e2;logger[_0x85fd('0x30')]('The\x20User\x20ID\x20is:',_0x52f7df['id']);return getEndUser(_0x496b3c,_0x285ac8[_0x85fd('0x6f')],_0x285ac8[_0x85fd('0x70')],_0x409723);})[_0x85fd('0x2b')](function(_0x183fbf){_0x3c28ce=_0x183fbf;logger[_0x85fd('0x30')](_0x85fd('0x5e'),_0x3c28ce['id']);return getTicket(_0x496b3c,_0x52f7df,_0x3c28ce,_0x5a24b5,_0x285ac8,_0x5a24b5[_0x85fd('0x5f')],_0x409723,_0x85fd('0x71'));})[_0x85fd('0x2b')](function(_0x8d7b7d){_0x43f04c=_0x8d7b7d;logger['info'](_0x85fd('0x61'));logger[_0x85fd('0x30')](_0x85fd('0x62'),_0x43f04c['id']);return setRelationship(_0x409723,_0x52f7df,_0x43f04c,'users');})[_0x85fd('0x2b')](function(){return setRelationship(_0x409723,_0x3c28ce,_0x43f04c,'contacts');})[_0x85fd('0x2b')](function(){return getServerInfo(_0x409723);})[_0x85fd('0x2b')](function(_0x36567a){var _0x396401=parseInt(_0x36567a[_0x85fd('0x65')][_0x85fd('0x66')](0x0));var _0x474096=util[_0x85fd('0x22')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x496b3c[_0x85fd('0x52')],_0x43f04c['id']);if(_0x396401>0x6){_0x474096=util[_0x85fd('0x22')](_0x85fd('0x72'),_0x496b3c[_0x85fd('0x52')],_0x43f04c['id']);}logger[_0x85fd('0x30')](_0x85fd('0x73'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0x85fd('0x69'),_0x58a108[_0x85fd('0xd')]),_0x85fd('0x74'),{'uri':_0x474096});})[_0x85fd('0x75')](function(_0x4c4335){logger['error'](_0x85fd('0x73'),JSON['stringify'](_0x4c4335));});};exports[_0x85fd('0x76')]=function(_0x560c4b,_0x1f476d,_0x4187b8,_0x3d14fb,_0xa92078,_0x1c67f3){var _0x293e73,_0x252d07,_0x3303dd,_0x48e0b7;_0x1c67f3[_0x85fd('0x52')]=intUtil['stripTrailingSlash'](_0x1c67f3[_0x85fd('0x52')]);_0x1c67f3[_0x85fd('0x54')]=intUtil['stripTrailingSlash'](_0x1c67f3['serverUrl']);def[_0x85fd('0x55')]=util[_0x85fd('0x22')]('%s/service/v4_1/rest.php',_0x1c67f3[_0x85fd('0x52')]);if(_0xa92078&&_0xa92078[_0x85fd('0x57')]){logger[_0x85fd('0x30')]('['+_0x1f476d['lastevent']['toUpperCase']()+']',_0x85fd('0x58'));_0x1f476d['recordingURL']=util[_0x85fd('0x22')](_0x85fd('0x59'),_0x1c67f3[_0x85fd('0x54')],_0x1f476d[_0x85fd('0x6e')],md5(_0x1f476d['uniqueid']));}else{_0x1f476d['recordingURL']='';}return getConnection(_0x1c67f3)[_0x85fd('0x2b')](function(_0x41fe80){_0x48e0b7=_0x41fe80;if(!_['isNil'](_0x3d14fb)){return getUser(_0x1c67f3,_0x3d14fb[_0x85fd('0xd')],_0x48e0b7);}else{return getUser(_0x1c67f3,null,_0x48e0b7);}})[_0x85fd('0x2b')](function(_0x2737ee){_0x293e73=_0x2737ee;logger[_0x85fd('0x30')]('The\x20User\x20ID\x20is:',_0x293e73['id']);return getEndUser(_0x1c67f3,_0x1f476d[_0x85fd('0x5c')],_0x1f476d[_0x85fd('0x5d')],_0x48e0b7);})[_0x85fd('0x2b')](function(_0x198e5e){_0x252d07=_0x198e5e;logger[_0x85fd('0x30')](_0x85fd('0x5e'),_0x252d07['id']);return getTicket(_0x1c67f3,_0x293e73,_0x252d07,_0x4187b8,_0x1f476d,_0x4187b8['Fields'],_0x48e0b7,'Inbound');})[_0x85fd('0x2b')](function(_0x4b80bd){_0x3303dd=_0x4b80bd;logger['info'](_0x85fd('0x61'));logger[_0x85fd('0x30')](_0x85fd('0x62'),_0x3303dd['id']);return setRelationship(_0x48e0b7,_0x293e73,_0x3303dd,_0x85fd('0x63'));})[_0x85fd('0x2b')](function(){return setRelationship(_0x48e0b7,_0x252d07,_0x3303dd,_0x85fd('0x64'));})[_0x85fd('0x2b')](function(){return getServerInfo(_0x48e0b7);})['catch'](function(_0x2179ba){logger[_0x85fd('0x6a')]('['+_0x1f476d[_0x85fd('0x77')]['toUpperCase']()+']',JSON['stringify'](_0x2179ba));});};