Built motion from commit 10af8726.|2.6.34
[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 _0xbc0a=['socket.io-emitter','emit','info','name','getString','Subjects','assigned_user_id','created_by','description','Descriptions','date_start','toISOString','replace','duration_hours','parent_type','Contacts','parent_name','direction','forEach','idField','variableName','set_entry','JSON','stringify','Calls','format','Basic\x20%s','apiKey','toString','base64','get_server_info','Getting\x20agent\x20with\x20name','get_entry_list','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','length','find','name_value_list','value','Agent\x20found!','resolve','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','first_name','Caller\x20-\x20%s','Enduser\x20created.','[HTTP]','merge','map','string','nameField','customField','type','custom_fields','push','content','variable','Variable','toLowerCase','POST','username','password','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','queue','remoteUri','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','users','contacts','version','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','error','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','Outbound','The\x20Ticket\x20ID\x20is:','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','unmanaged','lastevent','toUpperCase','calleridnum','request-promise','bluebird','md5','ioredis','./util','../../../../config/environment','sugarcrm','defaults','redis','localhost'];(function(_0x489250,_0x5e9468){var _0x1283e5=function(_0x2559d9){while(--_0x2559d9){_0x489250['push'](_0x489250['shift']());}};_0x1283e5(++_0x5e9468);}(_0xbc0a,0xe2));var _0xabc0=function(_0x1cf42a,_0x20d2f4){_0x1cf42a=_0x1cf42a-0x0;var _0x1a5e91=_0xbc0a[_0x1cf42a];return _0x1a5e91;};'use strict';var _=require('lodash');var rp=require(_0xabc0('0x0'));var BPromise=require(_0xabc0('0x1'));var md5=require(_0xabc0('0x2'));var util=require('util');var Redis=require(_0xabc0('0x3'));var intUtil=require(_0xabc0('0x4'));var config=require(_0xabc0('0x5'));var logger=require('../../../../config/logger')(_0xabc0('0x6'));config['redis']=_[_0xabc0('0x7')](config[_0xabc0('0x8')],{'host':_0xabc0('0x9'),'port':0x18eb});var io=require(_0xabc0('0xa'))(new Redis(config['redis']));var def={'method':'POST','json':!![]};function emit(_0x11903a,_0x271122,_0x30b974){io['to'](_0x11903a)[_0xabc0('0xb')](_0x271122,_0x30b974);}function getTicket(_0x294ce7,_0x9ee3a0,_0x1bce40,_0x46dc13,_0x46cc4f,_0x150837,_0x349c83,_0x1bb05b){logger[_0xabc0('0xc')]('Creating\x20new\x20ticket...');var _0x30685e=new Date();var _0xc53c1d=[{'name':_0xabc0('0xd'),'value':intUtil[_0xabc0('0xe')](_0x46dc13[_0xabc0('0xf')],_0x46cc4f,'\x20')},{'name':_0xabc0('0x10'),'value':_0x9ee3a0['id']},{'name':_0xabc0('0x11'),'value':_0x9ee3a0['id']},{'name':_0xabc0('0x12'),'value':intUtil[_0xabc0('0xe')](_0x46dc13[_0xabc0('0x13')],_0x46cc4f,'\x0a')},{'name':_0xabc0('0x14'),'value':_0x30685e[_0xabc0('0x15')]()['slice'](0x0,0x13)[_0xabc0('0x16')]('T','\x20')},{'name':_0xabc0('0x17'),'value':'0'},{'name':'duration_minutes','value':'15'},{'name':'parent_id','value':_0x1bce40['id']},{'name':_0xabc0('0x18'),'value':_0xabc0('0x19')},{'name':_0xabc0('0x1a'),'value':_0x1bce40['name']},{'name':_0xabc0('0x1b'),'value':_0x1bb05b}];if(_0x150837['length']){_[_0xabc0('0x1c')](_0x150837,function(_0x1b2af1){if(_0x46cc4f[_0x1b2af1['variableName']]){_0xc53c1d['push']({'name':_0x1b2af1[_0xabc0('0x1d')],'value':_0x46cc4f[_0x1b2af1[_0xabc0('0x1e')]]});}});}return request({'form':{'method':_0xabc0('0x1f'),'input_type':_0xabc0('0x20'),'response_type':_0xabc0('0x20'),'rest_data':JSON[_0xabc0('0x21')]({'session':_0x349c83['id'],'module_name':_0xabc0('0x22'),'name_value_list':_0xc53c1d})}});}function getAuth(_0x3d2485){return util[_0xabc0('0x23')](_0xabc0('0x24'),new Buffer(_0x3d2485[_0xabc0('0x25')]+':X')[_0xabc0('0x26')](_0xabc0('0x27')));}function getServerInfo(_0x238e04){return request({'form':{'method':_0xabc0('0x28'),'input_type':_0xabc0('0x20'),'response_type':_0xabc0('0x20'),'rest_data':JSON[_0xabc0('0x21')]({'session':_0x238e04['id']})}});}function getUser(_0x33cce0,_0x596156,_0x4a526c){if(!_['isNil'](_0x596156)){logger[_0xabc0('0xc')](_0xabc0('0x29'),_0x596156);return request({'form':{'method':_0xabc0('0x2a'),'input_type':_0xabc0('0x20'),'response_type':_0xabc0('0x20'),'rest_data':JSON[_0xabc0('0x21')]({'session':_0x4a526c['id'],'module_name':'Employees','query':util[_0xabc0('0x23')](_0xabc0('0x2b'),_0x596156),'order_by':'','offset':'0','select_fields':['id',_0xabc0('0xd'),_0xabc0('0x2c')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xabc0('0x2d')](function(_0x456b87){if(_0x456b87[_0xabc0('0x2e')][_0xabc0('0x2f')]){var _0x3583b8=_[_0xabc0('0x30')](_0x456b87[_0xabc0('0x2e')],function(_0x553ebd){return _0x553ebd[_0xabc0('0x31')][_0xabc0('0x2c')][_0xabc0('0x32')]===_0x596156;});if(_0x3583b8){logger[_0xabc0('0xc')](_0xabc0('0x33'));return BPromise[_0xabc0('0x34')]({'id':_0x3583b8[_0xabc0('0x31')]['id']['value'],'name':_0x3583b8[_0xabc0('0x31')][_0xabc0('0xd')][_0xabc0('0x32')]});}}logger[_0xabc0('0xc')](_0xabc0('0x35'));return BPromise[_0xabc0('0x34')]({'id':_0x4a526c[_0xabc0('0x31')][_0xabc0('0x36')][_0xabc0('0x32')],'name':_0x4a526c[_0xabc0('0x31')]['user_name']['value']});});}else{logger['info']('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise['resolve']({'id':_0x4a526c['name_value_list'][_0xabc0('0x36')][_0xabc0('0x32')],'name':_0x4a526c[_0xabc0('0x31')]['user_name']['value']});}}function getEndUser(_0x6c76fa,_0xd9bc6f,_0xeb3d0f,_0x53b96e){logger[_0xabc0('0xc')]('Searching\x20enduser\x20with\x20phone',_0xeb3d0f);return request({'form':{'method':_0xabc0('0x2a'),'input_type':_0xabc0('0x20'),'response_type':_0xabc0('0x20'),'rest_data':JSON['stringify']({'session':_0x53b96e['id'],'module_name':_0xabc0('0x19'),'query':util[_0xabc0('0x23')](_0xabc0('0x37'),_0xeb3d0f),'order_by':'','offset':'0','select_fields':['id',_0xabc0('0xd'),'phone_home'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xabc0('0x2d')](function(_0x1dc2ed){if(_0x1dc2ed['entry_list'][_0xabc0('0x2f')]){var _0x5331fb=_[_0xabc0('0x30')](_0x1dc2ed[_0xabc0('0x2e')],function(_0x243d96){return _0x243d96['name_value_list'][_0xabc0('0x38')]['value']===_0xeb3d0f;});if(_0x5331fb){logger[_0xabc0('0xc')]('Enduser\x20found!');return BPromise[_0xabc0('0x34')]({'id':_0x5331fb[_0xabc0('0x31')]['id'][_0xabc0('0x32')],'name':_0x5331fb[_0xabc0('0x31')][_0xabc0('0xd')][_0xabc0('0x32')],'phone':_0x5331fb[_0xabc0('0x31')][_0xabc0('0x38')][_0xabc0('0x32')]});}}else{logger[_0xabc0('0xc')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'form':{'method':'set_entry','input_type':_0xabc0('0x20'),'response_type':'JSON','rest_data':JSON[_0xabc0('0x21')]({'session':_0x53b96e['id'],'module_name':'Contacts','name_value_list':[{'name':_0xabc0('0x39'),'value':_0xd9bc6f!=='<unknown>'?_0xd9bc6f:util[_0xabc0('0x23')](_0xabc0('0x3a'),_0xeb3d0f)},{'name':_0xabc0('0x38'),'value':_0xeb3d0f}]})}})[_0xabc0('0x2d')](function(_0x2f212d){logger['info'](_0xabc0('0x3b'));return BPromise[_0xabc0('0x34')]({'id':_0x2f212d['id'],'name':_0x2f212d[_0xabc0('0x2e')][_0xabc0('0x39')][_0xabc0('0x32')],'phone':_0x2f212d[_0xabc0('0x2e')][_0xabc0('0x38')]['value']});});}});}function request(_0x12440e){logger['debug'](_0xabc0('0x3c'),JSON[_0xabc0('0x21')](_0x12440e));return rp(_[_0xabc0('0x3d')](def,_0x12440e));}function getTags(_0x265042,_0x212f23){var _0x5ead79=[];if(_0x265042&&_0x265042[_0xabc0('0x2f')]>0x0){_0x5ead79=_[_0xabc0('0x3e')](_0x265042,_0x212f23);}return _0x5ead79;}function getCustomFields(_0x574dce,_0x345612){var _0x194825=[];var _0x103e31={'custom_fields':[]};if(_0x574dce[_0xabc0('0x2f')]>0x0){_[_0xabc0('0x1c')](_0x574dce,function(_0x309237){if(_0x309237['type']===_0xabc0('0x3f')&&_0x309237[_0xabc0('0x40')]&&!_0x309237[_0xabc0('0x41')]){_0x103e31[_0x309237[_0xabc0('0x40')]['toLowerCase']()]=_0x309237['content'][_0xabc0('0x26')]();}else if(_0x309237[_0xabc0('0x42')]===_0xabc0('0x3f')&&_0x309237[_0xabc0('0x1d')]&&_0x309237[_0xabc0('0x41')]){_0x103e31[_0xabc0('0x43')][_0xabc0('0x44')]({'id':_0x309237[_0xabc0('0x1d')],'value':_0x309237[_0xabc0('0x45')][_0xabc0('0x26')]()});}else if(_0x309237[_0xabc0('0x42')]===_0xabc0('0x46')&&_0x309237[_0xabc0('0x1e')]&&_0x309237[_0xabc0('0x1d')]&&_0x309237[_0xabc0('0x41')]){_0x345612[_0x309237[_0xabc0('0x1e')]]&&_0x103e31[_0xabc0('0x43')][_0xabc0('0x44')]({'id':_0x309237[_0xabc0('0x1d')],'value':_0x345612[_0x309237[_0xabc0('0x1e')]]['toString']()});}else if(_0x309237['type']==='customVariable'&&_0x309237['Variable']&&_0x309237[_0xabc0('0x47')][_0xabc0('0xd')]&&_0x309237[_0xabc0('0x1d')]&&_0x309237[_0xabc0('0x41')]){_0x345612[_0x309237[_0xabc0('0x47')][_0xabc0('0xd')][_0xabc0('0x48')]()]&&_0x103e31[_0xabc0('0x43')][_0xabc0('0x44')]({'id':_0x309237[_0xabc0('0x1d')],'value':_0x345612[_0x309237[_0xabc0('0x47')]['name']['toLowerCase']()][_0xabc0('0x26')]()});}});}return _0x103e31;}function getConnection(_0x411ce2){return request({'method':_0xabc0('0x49'),'form':{'method':'login','input_type':_0xabc0('0x20'),'response_type':_0xabc0('0x20'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x411ce2[_0xabc0('0x4a')],'password':_0x411ce2[_0xabc0('0x4b')],'encryption':'PLAIN'},'application':_0xabc0('0x4c')})}})[_0xabc0('0x2d')](function(_0x58c03c){var _0x2201fa=_0x58c03c;if(_0x2201fa['id']){def[_0xabc0('0x4d')]=_0x2201fa['id'];return BPromise['resolve'](_0x2201fa);}else{throw new Error(util['format'](_0xabc0('0x4e'),_0x411ce2['id']));}});}function setRelationship(_0xa359b1,_0x1a6921,_0x2f6cee,_0x341cfb){return request({'form':{'method':'set_relationship','input_type':_0xabc0('0x20'),'response_type':_0xabc0('0x20'),'rest_data':JSON['stringify']({'session':_0xa359b1['id'],'module_name':'Calls','module_id':_0x2f6cee['id'],'link_field_name':_0x341cfb,'related_ids':[_0x1a6921['id']],'name_value_list':[],'delete':0x0})}});}exports[_0xabc0('0x4f')]=function(_0x89c48f,_0x46f0c7,_0x4170e5,_0x1dd459,_0x102a4d,_0x3be758){var _0x1eaa70,_0x257274,_0x3febdb,_0x130491;_0x3be758[_0xabc0('0x50')]=intUtil[_0xabc0('0x51')](_0x3be758[_0xabc0('0x50')]);_0x3be758[_0xabc0('0x52')]=intUtil[_0xabc0('0x51')](_0x3be758[_0xabc0('0x52')]);def[_0xabc0('0x53')]=util['format'](_0xabc0('0x54'),_0x3be758[_0xabc0('0x50')]);if(_0x102a4d&&_0x102a4d[_0xabc0('0x55')]){logger[_0xabc0('0xc')](_0xabc0('0x56'),_0xabc0('0x57'));_0x46f0c7[_0xabc0('0x58')]=util['format'](_0xabc0('0x59'),_0x3be758['serverUrl'],_0x46f0c7[_0xabc0('0x5a')],md5(_0x46f0c7[_0xabc0('0x5a')]));}else{_0x46f0c7[_0xabc0('0x58')]='';}return getConnection(_0x3be758)[_0xabc0('0x2d')](function(_0x4ec91d){_0x130491=_0x4ec91d;return getUser(_0x3be758,_0x1dd459[_0xabc0('0xd')],_0x130491);})[_0xabc0('0x2d')](function(_0x5548b0){_0x1eaa70=_0x5548b0;logger[_0xabc0('0xc')](_0xabc0('0x5b'),_0x1eaa70['id']);return getEndUser(_0x3be758,_0x46f0c7['calleridname'],_0x46f0c7['calleridnum'],_0x130491);})['then'](function(_0x33863b){_0x257274=_0x33863b;logger[_0xabc0('0xc')]('The\x20Enduser\x20ID\x20is:',_0x257274['id']);return getTicket(_0x3be758,_0x1eaa70,_0x257274,_0x4170e5,_0x46f0c7,_0x4170e5[_0xabc0('0x5c')],_0x130491,_0xabc0('0x5d'));})[_0xabc0('0x2d')](function(_0xe26f11){_0x3febdb=_0xe26f11;logger[_0xabc0('0xc')](_0xabc0('0x5e'));logger[_0xabc0('0xc')]('The\x20Ticket\x20ID\x20is:',_0x3febdb['id']);return setRelationship(_0x130491,_0x1eaa70,_0x3febdb,_0xabc0('0x5f'));})[_0xabc0('0x2d')](function(){return setRelationship(_0x130491,_0x257274,_0x3febdb,_0xabc0('0x60'));})['then'](function(){return getServerInfo(_0x130491);})[_0xabc0('0x2d')](function(_0x3db3d2){var _0xa92ed3=parseInt(_0x3db3d2[_0xabc0('0x61')]['charAt'](0x0));var _0x5c56cb=util['format']('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x3be758[_0xabc0('0x50')],_0x3febdb['id']);if(_0xa92ed3>0x6){_0x5c56cb=util[_0xabc0('0x23')](_0xabc0('0x62'),_0x3be758[_0xabc0('0x50')],_0x3febdb['id']);}logger[_0xabc0('0xc')](_0xabc0('0x56'),_0xabc0('0x63'));emit(util['format'](_0xabc0('0x64'),_0x1dd459['name']),_0xabc0('0x65'),{'uri':_0x5c56cb});})[_0xabc0('0x66')](function(_0x2067c6){logger[_0xabc0('0x67')](_0xabc0('0x56'),JSON[_0xabc0('0x21')](_0x2067c6));});};exports['outbound']=function(_0x35c728,_0x32a0e0,_0x306b9b,_0x2730d8,_0x5842f8,_0x3fdd30,_0x44f452){var _0x57cb58,_0x721f2,_0x283ca8,_0x5c156d;_0x3fdd30[_0xabc0('0x50')]=intUtil[_0xabc0('0x51')](_0x3fdd30[_0xabc0('0x50')]);_0x3fdd30['serverUrl']=intUtil['stripTrailingSlash'](_0x3fdd30[_0xabc0('0x52')]);def[_0xabc0('0x53')]=util[_0xabc0('0x23')](_0xabc0('0x54'),_0x3fdd30[_0xabc0('0x50')]);if(_0x44f452&&_0x44f452[_0xabc0('0x68')]&&_0x44f452[_0xabc0('0x68')]!==_0xabc0('0x69')){logger[_0xabc0('0xc')](_0xabc0('0x6a'),'Recording\x20is\x20enabled!');_0x32a0e0[_0xabc0('0x58')]=util[_0xabc0('0x23')](_0xabc0('0x59'),_0x3fdd30[_0xabc0('0x52')],_0x32a0e0['uniqueid'],md5(_0x32a0e0[_0xabc0('0x5a')]));}return getConnection(_0x3fdd30)[_0xabc0('0x2d')](function(_0x62a1a8){_0x5c156d=_0x62a1a8;return getUser(_0x3fdd30,_0x2730d8['name'],_0x5c156d);})[_0xabc0('0x2d')](function(_0x14a1da){_0x57cb58=_0x14a1da;logger[_0xabc0('0xc')](_0xabc0('0x5b'),_0x57cb58['id']);return getEndUser(_0x3fdd30,_0x32a0e0[_0xabc0('0x6b')],_0x32a0e0[_0xabc0('0x6c')],_0x5c156d);})[_0xabc0('0x2d')](function(_0x971cf6){_0x721f2=_0x971cf6;logger[_0xabc0('0xc')](_0xabc0('0x6d'),_0x721f2['id']);return getTicket(_0x3fdd30,_0x57cb58,_0x721f2,_0x306b9b,_0x32a0e0,_0x306b9b[_0xabc0('0x5c')],_0x5c156d,_0xabc0('0x6e'));})[_0xabc0('0x2d')](function(_0x5e12fe){_0x283ca8=_0x5e12fe;logger[_0xabc0('0xc')]('Ticket\x20created!');logger['info'](_0xabc0('0x6f'),_0x283ca8['id']);return setRelationship(_0x5c156d,_0x57cb58,_0x283ca8,_0xabc0('0x5f'));})['then'](function(){return setRelationship(_0x5c156d,_0x721f2,_0x283ca8,_0xabc0('0x60'));})[_0xabc0('0x2d')](function(){return getServerInfo(_0x5c156d);})[_0xabc0('0x2d')](function(_0x26841d){var _0x579545=parseInt(_0x26841d[_0xabc0('0x61')][_0xabc0('0x70')](0x0));var _0x3b3bd9=util[_0xabc0('0x23')](_0xabc0('0x71'),_0x3fdd30['remoteUri'],_0x283ca8['id']);if(_0x579545>0x6){_0x3b3bd9=util[_0xabc0('0x23')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x3fdd30['remoteUri'],_0x283ca8['id']);}logger[_0xabc0('0xc')](_0xabc0('0x6a'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xabc0('0x23')](_0xabc0('0x64'),_0x2730d8[_0xabc0('0xd')]),_0xabc0('0x65'),{'uri':_0x3b3bd9});})[_0xabc0('0x66')](function(_0x4db8cf){logger[_0xabc0('0x67')](_0xabc0('0x6a'),JSON[_0xabc0('0x21')](_0x4db8cf));});};exports[_0xabc0('0x72')]=function(_0x22afa3,_0x3eb28c,_0x440304,_0x2edefc,_0x481373,_0x1fa190){var _0x50f177,_0x342588,_0x14ec35,_0x344b35;_0x1fa190['remoteUri']=intUtil[_0xabc0('0x51')](_0x1fa190['remoteUri']);_0x1fa190[_0xabc0('0x52')]=intUtil[_0xabc0('0x51')](_0x1fa190['serverUrl']);def[_0xabc0('0x53')]=util['format'](_0xabc0('0x54'),_0x1fa190['remoteUri']);if(_0x481373&&_0x481373[_0xabc0('0x55')]){logger[_0xabc0('0xc')]('['+_0x3eb28c[_0xabc0('0x73')][_0xabc0('0x74')]()+']',_0xabc0('0x57'));_0x3eb28c['recordingURL']=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1fa190['serverUrl'],_0x3eb28c[_0xabc0('0x5a')],md5(_0x3eb28c[_0xabc0('0x5a')]));}else{_0x3eb28c['recordingURL']='';}return getConnection(_0x1fa190)['then'](function(_0x2b0f6d){_0x344b35=_0x2b0f6d;if(!_['isNil'](_0x2edefc)){return getUser(_0x1fa190,_0x2edefc['name'],_0x344b35);}else{return getUser(_0x1fa190,null,_0x344b35);}})[_0xabc0('0x2d')](function(_0x4d2d43){_0x50f177=_0x4d2d43;logger[_0xabc0('0xc')]('The\x20User\x20ID\x20is:',_0x50f177['id']);return getEndUser(_0x1fa190,_0x3eb28c['calleridname'],_0x3eb28c[_0xabc0('0x75')],_0x344b35);})[_0xabc0('0x2d')](function(_0x277ec1){_0x342588=_0x277ec1;logger[_0xabc0('0xc')](_0xabc0('0x6d'),_0x342588['id']);return getTicket(_0x1fa190,_0x50f177,_0x342588,_0x440304,_0x3eb28c,_0x440304[_0xabc0('0x5c')],_0x344b35,_0xabc0('0x5d'));})[_0xabc0('0x2d')](function(_0x383583){_0x14ec35=_0x383583;logger['info'](_0xabc0('0x5e'));logger['info'](_0xabc0('0x6f'),_0x14ec35['id']);return setRelationship(_0x344b35,_0x50f177,_0x14ec35,_0xabc0('0x5f'));})[_0xabc0('0x2d')](function(){return setRelationship(_0x344b35,_0x342588,_0x14ec35,_0xabc0('0x60'));})[_0xabc0('0x2d')](function(){return getServerInfo(_0x344b35);})[_0xabc0('0x66')](function(_0x94128d){logger[_0xabc0('0x67')]('['+_0x3eb28c['lastevent'][_0xabc0('0x74')]()+']',JSON['stringify'](_0x94128d));});};