7b5924673def505ae2081fb3fa5691e1bfcaab6f
[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 _0x1b64=['sugarcrm','redis','localhost','emit','info','Creating\x20new\x20ticket...','name','getString','Subjects','created_by','description','Descriptions','toISOString','slice','replace','duration_hours','duration_minutes','parent_id','parent_type','parent_name','direction','length','forEach','variableName','JSON','stringify','Calls','format','toString','get_server_info','isNil','Getting\x20agent\x20with\x20name','Employees','user_name','then','entry_list','value','Agent\x20found!','resolve','name_value_list','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','get_entry_list','Contacts','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','find','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','set_entry','first_name','<unknown>','Caller\x20-\x20%s','Enduser\x20created.','debug','merge','map','type','string','nameField','customField','toLowerCase','content','idField','push','variable','custom_fields','customVariable','Variable','login','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','stripTrailingSlash','remoteUri','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','contacts','version','charAt','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','catch','error','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','uniqueid','destcalleridname','destcalleridnum','Outbound','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','user:%s','trigger:browser:url','unmanaged','Inbound','lastevent','toUpperCase','lodash','request-promise','md5','../../../../config/environment','../../../../config/logger'];(function(_0x1d6768,_0x45c63f){var _0x2b3383=function(_0x3de615){while(--_0x3de615){_0x1d6768['push'](_0x1d6768['shift']());}};_0x2b3383(++_0x45c63f);}(_0x1b64,0x76));var _0x41b6=function(_0x5188ed,_0x17ed3c){_0x5188ed=_0x5188ed-0x0;var _0x164a75=_0x1b64[_0x5188ed];return _0x164a75;};'use strict';var _=require(_0x41b6('0x0'));var rp=require(_0x41b6('0x1'));var BPromise=require('bluebird');var md5=require(_0x41b6('0x2'));var util=require('util');var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0x41b6('0x3'));var logger=require(_0x41b6('0x4'))(_0x41b6('0x5'));config[_0x41b6('0x6')]=_['defaults'](config[_0x41b6('0x6')],{'host':_0x41b6('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var def={'method':'POST','json':!![]};function emit(_0x7763c3,_0x3cc6f8,_0x3c7ef4){io['to'](_0x7763c3)[_0x41b6('0x8')](_0x3cc6f8,_0x3c7ef4);}function getTicket(_0x477e12,_0x412dca,_0x4d66c5,_0x207a2f,_0x31b2b4,_0x274f27,_0x1e0256,_0x28c385){logger[_0x41b6('0x9')](_0x41b6('0xa'));var _0xd7866=new Date();var _0x179e37=[{'name':_0x41b6('0xb'),'value':intUtil[_0x41b6('0xc')](_0x207a2f[_0x41b6('0xd')],_0x31b2b4,'\x20')},{'name':'assigned_user_id','value':_0x412dca['id']},{'name':_0x41b6('0xe'),'value':_0x412dca['id']},{'name':_0x41b6('0xf'),'value':intUtil[_0x41b6('0xc')](_0x207a2f[_0x41b6('0x10')],_0x31b2b4,'\x0a')},{'name':'date_start','value':_0xd7866[_0x41b6('0x11')]()[_0x41b6('0x12')](0x0,0x13)[_0x41b6('0x13')]('T','\x20')},{'name':_0x41b6('0x14'),'value':'0'},{'name':_0x41b6('0x15'),'value':'15'},{'name':_0x41b6('0x16'),'value':_0x4d66c5['id']},{'name':_0x41b6('0x17'),'value':'Contacts'},{'name':_0x41b6('0x18'),'value':_0x4d66c5[_0x41b6('0xb')]},{'name':_0x41b6('0x19'),'value':_0x28c385}];if(_0x274f27[_0x41b6('0x1a')]){_[_0x41b6('0x1b')](_0x274f27,function(_0x47feb9){if(_0x31b2b4[_0x47feb9['variableName']]){_0x179e37['push']({'name':_0x47feb9['idField'],'value':_0x31b2b4[_0x47feb9[_0x41b6('0x1c')]]});}});}return request({'form':{'method':'set_entry','input_type':_0x41b6('0x1d'),'response_type':_0x41b6('0x1d'),'rest_data':JSON[_0x41b6('0x1e')]({'session':_0x1e0256['id'],'module_name':_0x41b6('0x1f'),'name_value_list':_0x179e37})}});}function getAuth(_0x10c17c){return util[_0x41b6('0x20')]('Basic\x20%s',new Buffer(_0x10c17c['apiKey']+':X')[_0x41b6('0x21')]('base64'));}function getServerInfo(_0xb4596c){return request({'form':{'method':_0x41b6('0x22'),'input_type':_0x41b6('0x1d'),'response_type':_0x41b6('0x1d'),'rest_data':JSON[_0x41b6('0x1e')]({'session':_0xb4596c['id']})}});}function getUser(_0x1c8e7a,_0x1fea00,_0x11cc02){if(!_[_0x41b6('0x23')](_0x1fea00)){logger[_0x41b6('0x9')](_0x41b6('0x24'),_0x1fea00);return request({'form':{'method':'get_entry_list','input_type':_0x41b6('0x1d'),'response_type':_0x41b6('0x1d'),'rest_data':JSON['stringify']({'session':_0x11cc02['id'],'module_name':_0x41b6('0x25'),'query':util[_0x41b6('0x20')]('INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200',_0x1fea00),'order_by':'','offset':'0','select_fields':['id',_0x41b6('0xb'),_0x41b6('0x26')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x41b6('0x27')](function(_0x5a9624){if(_0x5a9624[_0x41b6('0x28')]['length']){var _0x49142b=_['find'](_0x5a9624[_0x41b6('0x28')],function(_0x425c16){return _0x425c16['name_value_list'][_0x41b6('0x26')][_0x41b6('0x29')]===_0x1fea00;});if(_0x49142b){logger[_0x41b6('0x9')](_0x41b6('0x2a'));return BPromise[_0x41b6('0x2b')]({'id':_0x49142b['name_value_list']['id']['value'],'name':_0x49142b[_0x41b6('0x2c')][_0x41b6('0xb')][_0x41b6('0x29')]});}}logger['info'](_0x41b6('0x2d'));return BPromise[_0x41b6('0x2b')]({'id':_0x11cc02['name_value_list'][_0x41b6('0x2e')][_0x41b6('0x29')],'name':_0x11cc02[_0x41b6('0x2c')][_0x41b6('0x26')][_0x41b6('0x29')]});});}else{logger[_0x41b6('0x9')](_0x41b6('0x2f'));return BPromise['resolve']({'id':_0x11cc02[_0x41b6('0x2c')]['user_id']['value'],'name':_0x11cc02[_0x41b6('0x2c')]['user_name'][_0x41b6('0x29')]});}}function getEndUser(_0x84987a,_0x2762de,_0x435639,_0xc97805){logger[_0x41b6('0x9')](_0x41b6('0x30'),_0x435639);return request({'form':{'method':_0x41b6('0x31'),'input_type':'JSON','response_type':_0x41b6('0x1d'),'rest_data':JSON[_0x41b6('0x1e')]({'session':_0xc97805['id'],'module_name':_0x41b6('0x32'),'query':util[_0x41b6('0x20')](_0x41b6('0x33'),_0x435639),'order_by':'','offset':'0','select_fields':['id',_0x41b6('0xb'),_0x41b6('0x34')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x69277a){if(_0x69277a['entry_list']['length']){var _0x34edfc=_[_0x41b6('0x35')](_0x69277a[_0x41b6('0x28')],function(_0x2de366){return _0x2de366[_0x41b6('0x2c')][_0x41b6('0x34')]['value']===_0x435639;});if(_0x34edfc){logger[_0x41b6('0x9')](_0x41b6('0x36'));return BPromise[_0x41b6('0x2b')]({'id':_0x34edfc[_0x41b6('0x2c')]['id'][_0x41b6('0x29')],'name':_0x34edfc[_0x41b6('0x2c')][_0x41b6('0xb')]['value'],'phone':_0x34edfc[_0x41b6('0x2c')][_0x41b6('0x34')][_0x41b6('0x29')]});}}else{logger[_0x41b6('0x9')](_0x41b6('0x37'));return request({'form':{'method':_0x41b6('0x38'),'input_type':_0x41b6('0x1d'),'response_type':_0x41b6('0x1d'),'rest_data':JSON[_0x41b6('0x1e')]({'session':_0xc97805['id'],'module_name':_0x41b6('0x32'),'name_value_list':[{'name':_0x41b6('0x39'),'value':_0x2762de!==_0x41b6('0x3a')?_0x2762de:util['format'](_0x41b6('0x3b'),_0x435639)},{'name':_0x41b6('0x34'),'value':_0x435639}]})}})[_0x41b6('0x27')](function(_0x1bba10){logger[_0x41b6('0x9')](_0x41b6('0x3c'));return BPromise['resolve']({'id':_0x1bba10['id'],'name':_0x1bba10['entry_list'][_0x41b6('0x39')][_0x41b6('0x29')],'phone':_0x1bba10['entry_list']['phone_home'][_0x41b6('0x29')]});});}});}function request(_0x2e72ae){logger[_0x41b6('0x3d')]('[HTTP]',JSON['stringify'](_0x2e72ae));return rp(_[_0x41b6('0x3e')](def,_0x2e72ae));}function getTags(_0x4a81f2,_0x1c1da2){var _0xa8ae34=[];if(_0x4a81f2&&_0x4a81f2[_0x41b6('0x1a')]>0x0){_0xa8ae34=_[_0x41b6('0x3f')](_0x4a81f2,_0x1c1da2);}return _0xa8ae34;}function getCustomFields(_0x1d3f2f,_0x5b5599){var _0x29aae8=[];var _0x22103e={'custom_fields':[]};if(_0x1d3f2f[_0x41b6('0x1a')]>0x0){_[_0x41b6('0x1b')](_0x1d3f2f,function(_0x5f0e3b){if(_0x5f0e3b[_0x41b6('0x40')]===_0x41b6('0x41')&&_0x5f0e3b[_0x41b6('0x42')]&&!_0x5f0e3b[_0x41b6('0x43')]){_0x22103e[_0x5f0e3b[_0x41b6('0x42')][_0x41b6('0x44')]()]=_0x5f0e3b[_0x41b6('0x45')]['toString']();}else if(_0x5f0e3b[_0x41b6('0x40')]==='string'&&_0x5f0e3b[_0x41b6('0x46')]&&_0x5f0e3b[_0x41b6('0x43')]){_0x22103e['custom_fields'][_0x41b6('0x47')]({'id':_0x5f0e3b[_0x41b6('0x46')],'value':_0x5f0e3b['content'][_0x41b6('0x21')]()});}else if(_0x5f0e3b[_0x41b6('0x40')]===_0x41b6('0x48')&&_0x5f0e3b[_0x41b6('0x1c')]&&_0x5f0e3b[_0x41b6('0x46')]&&_0x5f0e3b['customField']){_0x5b5599[_0x5f0e3b[_0x41b6('0x1c')]]&&_0x22103e[_0x41b6('0x49')][_0x41b6('0x47')]({'id':_0x5f0e3b['idField'],'value':_0x5b5599[_0x5f0e3b[_0x41b6('0x1c')]][_0x41b6('0x21')]()});}else if(_0x5f0e3b[_0x41b6('0x40')]===_0x41b6('0x4a')&&_0x5f0e3b[_0x41b6('0x4b')]&&_0x5f0e3b[_0x41b6('0x4b')][_0x41b6('0xb')]&&_0x5f0e3b['idField']&&_0x5f0e3b['customField']){_0x5b5599[_0x5f0e3b[_0x41b6('0x4b')]['name']['toLowerCase']()]&&_0x22103e[_0x41b6('0x49')][_0x41b6('0x47')]({'id':_0x5f0e3b[_0x41b6('0x46')],'value':_0x5b5599[_0x5f0e3b[_0x41b6('0x4b')][_0x41b6('0xb')][_0x41b6('0x44')]()]['toString']()});}});}return _0x22103e;}function getConnection(_0x288798){return request({'method':'POST','form':{'method':_0x41b6('0x4c'),'input_type':'JSON','response_type':_0x41b6('0x1d'),'rest_data':JSON[_0x41b6('0x1e')]({'user_auth':{'user_name':_0x288798['username'],'password':_0x288798[_0x41b6('0x4d')],'encryption':_0x41b6('0x4e')},'application':_0x41b6('0x4f')})}})[_0x41b6('0x27')](function(_0x36826d){var _0xa006c=_0x36826d;if(_0xa006c['id']){def[_0x41b6('0x50')]=_0xa006c['id'];return BPromise[_0x41b6('0x2b')](_0xa006c);}else{throw new Error(util[_0x41b6('0x20')](_0x41b6('0x51'),_0x288798['id']));}});}function setRelationship(_0x318910,_0x7d3cfd,_0x372a48,_0xb1a0e6){return request({'form':{'method':_0x41b6('0x52'),'input_type':_0x41b6('0x1d'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x318910['id'],'module_name':'Calls','module_id':_0x372a48['id'],'link_field_name':_0xb1a0e6,'related_ids':[_0x7d3cfd['id']]})}});}exports[_0x41b6('0x53')]=function(_0x208dd9,_0x1d5dad,_0xfb97ec,_0x195e34,_0x226cda,_0x33438d){var _0x206833,_0xf49f85,_0x1b69e3,_0x4f918c;_0x33438d['remoteUri']=intUtil[_0x41b6('0x54')](_0x33438d[_0x41b6('0x55')]);_0x33438d[_0x41b6('0x56')]=intUtil[_0x41b6('0x54')](_0x33438d[_0x41b6('0x56')]);def[_0x41b6('0x57')]=util[_0x41b6('0x20')](_0x41b6('0x58'),_0x33438d[_0x41b6('0x55')]);if(_0x226cda&&_0x226cda[_0x41b6('0x59')]){logger[_0x41b6('0x9')](_0x41b6('0x5a'),'Recording\x20is\x20enabled!');_0x1d5dad[_0x41b6('0x5b')]=util[_0x41b6('0x20')](_0x41b6('0x5c'),_0x33438d[_0x41b6('0x56')],_0x1d5dad['uniqueid'],md5(_0x1d5dad['uniqueid']));}else{_0x1d5dad[_0x41b6('0x5b')]='';}return getConnection(_0x33438d)['then'](function(_0x5480cc){_0x4f918c=_0x5480cc;return getUser(_0x33438d,_0x195e34[_0x41b6('0xb')],_0x4f918c);})[_0x41b6('0x27')](function(_0xaca824){_0x206833=_0xaca824;logger[_0x41b6('0x9')](_0x41b6('0x5d'),_0x206833['id']);return getEndUser(_0x33438d,_0x1d5dad[_0x41b6('0x5e')],_0x1d5dad['calleridnum'],_0x4f918c);})[_0x41b6('0x27')](function(_0x3b6854){_0xf49f85=_0x3b6854;logger['info'](_0x41b6('0x5f'),_0xf49f85['id']);return getTicket(_0x33438d,_0x206833,_0xf49f85,_0xfb97ec,_0x1d5dad,_0xfb97ec[_0x41b6('0x60')],_0x4f918c,'Inbound');})[_0x41b6('0x27')](function(_0x2222f6){_0x1b69e3=_0x2222f6;logger[_0x41b6('0x9')](_0x41b6('0x61'));logger[_0x41b6('0x9')](_0x41b6('0x62'),_0x1b69e3['id']);return setRelationship(_0x4f918c,_0x206833,_0x1b69e3,_0x41b6('0x63'));})[_0x41b6('0x27')](function(){return setRelationship(_0x4f918c,_0xf49f85,_0x1b69e3,_0x41b6('0x64'));})[_0x41b6('0x27')](function(){return getServerInfo(_0x4f918c);})['then'](function(_0x6220e1){var _0x30427f=parseInt(_0x6220e1[_0x41b6('0x65')][_0x41b6('0x66')](0x0));var _0x1bd4a8=util[_0x41b6('0x20')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x33438d[_0x41b6('0x55')],_0x1b69e3['id']);if(_0x30427f>0x6){_0x1bd4a8=util[_0x41b6('0x20')](_0x41b6('0x67'),_0x33438d['remoteUri'],_0x1b69e3['id']);}logger['info'](_0x41b6('0x5a'),_0x41b6('0x68'));emit(util['format']('user:%s',_0x195e34[_0x41b6('0xb')]),'trigger:browser:url',{'uri':_0x1bd4a8});})[_0x41b6('0x69')](function(_0xfe58b4){logger[_0x41b6('0x6a')]('[QUEUE]',JSON[_0x41b6('0x1e')](_0xfe58b4));});};exports[_0x41b6('0x6b')]=function(_0x55fd14,_0x3fe947,_0x522403,_0x29863e,_0x11ae0e,_0x39eeeb,_0x2fe6db){var _0x2a7a85,_0x2740ad,_0x55013b,_0x51ba97;_0x39eeeb[_0x41b6('0x55')]=intUtil['stripTrailingSlash'](_0x39eeeb[_0x41b6('0x55')]);_0x39eeeb[_0x41b6('0x56')]=intUtil[_0x41b6('0x54')](_0x39eeeb[_0x41b6('0x56')]);def['uri']=util['format'](_0x41b6('0x58'),_0x39eeeb[_0x41b6('0x55')]);if(_0x2fe6db&&_0x2fe6db['recordingFormat']&&_0x2fe6db[_0x41b6('0x6c')]!==_0x41b6('0x6d')){logger['info'](_0x41b6('0x6e'),_0x41b6('0x6f'));_0x3fe947[_0x41b6('0x5b')]=util[_0x41b6('0x20')](_0x41b6('0x5c'),_0x39eeeb[_0x41b6('0x56')],_0x3fe947[_0x41b6('0x70')],md5(_0x3fe947['uniqueid']));}return getConnection(_0x39eeeb)[_0x41b6('0x27')](function(_0x2f21b5){_0x51ba97=_0x2f21b5;return getUser(_0x39eeeb,_0x29863e[_0x41b6('0xb')],_0x51ba97);})[_0x41b6('0x27')](function(_0x2c2bf2){_0x2a7a85=_0x2c2bf2;logger['info'](_0x41b6('0x5d'),_0x2a7a85['id']);return getEndUser(_0x39eeeb,_0x3fe947[_0x41b6('0x71')],_0x3fe947[_0x41b6('0x72')],_0x51ba97);})[_0x41b6('0x27')](function(_0x325fba){_0x2740ad=_0x325fba;logger[_0x41b6('0x9')](_0x41b6('0x5f'),_0x2740ad['id']);return getTicket(_0x39eeeb,_0x2a7a85,_0x2740ad,_0x522403,_0x3fe947,_0x522403[_0x41b6('0x60')],_0x51ba97,_0x41b6('0x73'));})[_0x41b6('0x27')](function(_0x139c80){_0x55013b=_0x139c80;logger[_0x41b6('0x9')](_0x41b6('0x61'));logger[_0x41b6('0x9')]('The\x20Ticket\x20ID\x20is:',_0x55013b['id']);return setRelationship(_0x51ba97,_0x2a7a85,_0x55013b,_0x41b6('0x63'));})[_0x41b6('0x27')](function(){return setRelationship(_0x51ba97,_0x2740ad,_0x55013b,'contacts');})[_0x41b6('0x27')](function(){return getServerInfo(_0x51ba97);})[_0x41b6('0x27')](function(_0x36aa49){var _0x4a702f=parseInt(_0x36aa49[_0x41b6('0x65')]['charAt'](0x0));var _0x19441a=util['format'](_0x41b6('0x74'),_0x39eeeb[_0x41b6('0x55')],_0x55013b['id']);if(_0x4a702f>0x6){_0x19441a=util[_0x41b6('0x20')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x39eeeb[_0x41b6('0x55')],_0x55013b['id']);}logger['info'](_0x41b6('0x6e'),_0x41b6('0x68'));emit(util['format'](_0x41b6('0x75'),_0x29863e[_0x41b6('0xb')]),_0x41b6('0x76'),{'uri':_0x19441a});})[_0x41b6('0x69')](function(_0x1d3d71){logger[_0x41b6('0x6a')]('[OUTBOUND]',JSON['stringify'](_0x1d3d71));});};exports[_0x41b6('0x77')]=function(_0x5ad34e,_0x4c866f,_0x10ca1b,_0x154369,_0x4c5a0f,_0x224e20){var _0x45f71d,_0x1d8d47,_0x43a714,_0x1a6d0a;_0x224e20['remoteUri']=intUtil['stripTrailingSlash'](_0x224e20[_0x41b6('0x55')]);_0x224e20[_0x41b6('0x56')]=intUtil[_0x41b6('0x54')](_0x224e20[_0x41b6('0x56')]);def['uri']=util['format'](_0x41b6('0x58'),_0x224e20[_0x41b6('0x55')]);if(_0x4c5a0f&&_0x4c5a0f[_0x41b6('0x59')]){logger[_0x41b6('0x9')]('['+_0x4c866f['lastevent']['toUpperCase']()+']',_0x41b6('0x6f'));_0x4c866f[_0x41b6('0x5b')]=util[_0x41b6('0x20')](_0x41b6('0x5c'),_0x224e20[_0x41b6('0x56')],_0x4c866f['uniqueid'],md5(_0x4c866f[_0x41b6('0x70')]));}else{_0x4c866f['recordingURL']='';}return getConnection(_0x224e20)[_0x41b6('0x27')](function(_0x16cfbf){_0x1a6d0a=_0x16cfbf;if(!_[_0x41b6('0x23')](_0x154369)){return getUser(_0x224e20,_0x154369['name'],_0x1a6d0a);}else{return getUser(_0x224e20,null,_0x1a6d0a);}})['then'](function(_0x18dfd3){_0x45f71d=_0x18dfd3;logger['info'](_0x41b6('0x5d'),_0x45f71d['id']);return getEndUser(_0x224e20,_0x4c866f[_0x41b6('0x5e')],_0x4c866f['calleridnum'],_0x1a6d0a);})[_0x41b6('0x27')](function(_0x3d213a){_0x1d8d47=_0x3d213a;logger[_0x41b6('0x9')](_0x41b6('0x5f'),_0x1d8d47['id']);return getTicket(_0x224e20,_0x45f71d,_0x1d8d47,_0x10ca1b,_0x4c866f,_0x10ca1b['Fields'],_0x1a6d0a,_0x41b6('0x78'));})[_0x41b6('0x27')](function(_0x26fc9c){_0x43a714=_0x26fc9c;logger[_0x41b6('0x9')](_0x41b6('0x61'));logger[_0x41b6('0x9')](_0x41b6('0x62'),_0x43a714['id']);return setRelationship(_0x1a6d0a,_0x45f71d,_0x43a714,'users');})[_0x41b6('0x27')](function(){return setRelationship(_0x1a6d0a,_0x1d8d47,_0x43a714,_0x41b6('0x64'));})[_0x41b6('0x27')](function(){return getServerInfo(_0x1a6d0a);})['catch'](function(_0x11858){logger['error']('['+_0x4c866f[_0x41b6('0x79')][_0x41b6('0x7a')]()+']',JSON[_0x41b6('0x1e')](_0x11858));});};