Built motion from commit (unavailable).|2.6.0
[motion2.git] / server / services / ami / trigger / integration / sugarcrm.js
index bb68f32..1b3866a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf34f=['slice','replace','duration_hours','duration_minutes','parent_id','parent_type','Contacts','parent_name','direction','forEach','variableName','push','set_entry','JSON','stringify','Calls','format','Basic\x20%s','apiKey','toString','base64','get_server_info','isNil','get_entry_list','Employees','user_name','entry_list','length','find','name_value_list','Agent\x20found!','resolve','value','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','<unknown>','Caller\x20-\x20%s','then','merge','map','type','nameField','toLowerCase','string','idField','customField','custom_fields','content','customVariable','Variable','login','username','password','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','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','calleridnum','Fields','Inbound','Ticket\x20created!','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','error','recordingFormat','none','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridnum','The\x20Enduser\x20ID\x20is:','Outbound','users','contacts','catch','lastevent','toUpperCase','calleridname','The\x20Ticket\x20ID\x20is:','lodash','bluebird','util','./util','../../../../config/environment','../../../../config/logger','redis','socket.io-emitter','POST','emit','info','name','getString','Subjects','assigned_user_id','created_by','description','Descriptions','date_start','toISOString'];(function(_0x3e6766,_0x5e958d){var _0x53e815=function(_0x38a070){while(--_0x38a070){_0x3e6766['push'](_0x3e6766['shift']());}};_0x53e815(++_0x5e958d);}(_0xf34f,0x64));var _0xff34=function(_0x12936b,_0x126728){_0x12936b=_0x12936b-0x0;var _0xd77d03=_0xf34f[_0x12936b];return _0xd77d03;};'use strict';var _=require(_0xff34('0x0'));var rp=require('request-promise');var BPromise=require(_0xff34('0x1'));var md5=require('md5');var util=require(_0xff34('0x2'));var Redis=require('ioredis');var intUtil=require(_0xff34('0x3'));var config=require(_0xff34('0x4'));var logger=require(_0xff34('0x5'))('sugarcrm');config[_0xff34('0x6')]=_['defaults'](config[_0xff34('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0xff34('0x7'))(new Redis(config['redis']));var def={'method':_0xff34('0x8'),'json':!![]};function emit(_0x46d761,_0x5c1668,_0x5cc9f3){io['to'](_0x46d761)[_0xff34('0x9')](_0x5c1668,_0x5cc9f3);}function getTicket(_0xe76c05,_0x912de5,_0x5b80d3,_0x4546dd,_0x116875,_0x58d065,_0x31427c,_0x23bc11){logger[_0xff34('0xa')]('Creating\x20new\x20ticket...');var _0x32ac65=new Date();var _0x305801=[{'name':_0xff34('0xb'),'value':intUtil[_0xff34('0xc')](_0x4546dd[_0xff34('0xd')],_0x116875,'\x20')},{'name':_0xff34('0xe'),'value':_0x912de5['id']},{'name':_0xff34('0xf'),'value':_0x912de5['id']},{'name':_0xff34('0x10'),'value':intUtil[_0xff34('0xc')](_0x4546dd[_0xff34('0x11')],_0x116875,'\x0a')},{'name':_0xff34('0x12'),'value':_0x32ac65[_0xff34('0x13')]()[_0xff34('0x14')](0x0,0x13)[_0xff34('0x15')]('T','\x20')},{'name':_0xff34('0x16'),'value':'0'},{'name':_0xff34('0x17'),'value':'15'},{'name':_0xff34('0x18'),'value':_0x5b80d3['id']},{'name':_0xff34('0x19'),'value':_0xff34('0x1a')},{'name':_0xff34('0x1b'),'value':_0x5b80d3['name']},{'name':_0xff34('0x1c'),'value':_0x23bc11}];if(_0x58d065['length']){_[_0xff34('0x1d')](_0x58d065,function(_0x50bfa5){if(_0x116875[_0x50bfa5[_0xff34('0x1e')]]){_0x305801[_0xff34('0x1f')]({'name':_0x50bfa5['idField'],'value':_0x116875[_0x50bfa5['variableName']]});}});}return request({'form':{'method':_0xff34('0x20'),'input_type':_0xff34('0x21'),'response_type':_0xff34('0x21'),'rest_data':JSON[_0xff34('0x22')]({'session':_0x31427c['id'],'module_name':_0xff34('0x23'),'name_value_list':_0x305801})}});}function getAuth(_0x26998e){return util[_0xff34('0x24')](_0xff34('0x25'),new Buffer(_0x26998e[_0xff34('0x26')]+':X')[_0xff34('0x27')](_0xff34('0x28')));}function getServerInfo(_0x1c76f6){return request({'form':{'method':_0xff34('0x29'),'input_type':_0xff34('0x21'),'response_type':_0xff34('0x21'),'rest_data':JSON[_0xff34('0x22')]({'session':_0x1c76f6['id']})}});}function getUser(_0x2a988d,_0xebe57c,_0x40f14e){if(!_[_0xff34('0x2a')](_0xebe57c)){logger[_0xff34('0xa')]('Getting\x20agent\x20with\x20name',_0xebe57c);return request({'form':{'method':_0xff34('0x2b'),'input_type':_0xff34('0x21'),'response_type':_0xff34('0x21'),'rest_data':JSON[_0xff34('0x22')]({'session':_0x40f14e['id'],'module_name':_0xff34('0x2c'),'query':util['format']('INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200',_0xebe57c),'order_by':'','offset':'0','select_fields':['id',_0xff34('0xb'),_0xff34('0x2d')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x284696){if(_0x284696[_0xff34('0x2e')][_0xff34('0x2f')]){var _0x4c2c42=_[_0xff34('0x30')](_0x284696[_0xff34('0x2e')],function(_0x3939fa){return _0x3939fa[_0xff34('0x31')][_0xff34('0x2d')]['value']===_0xebe57c;});if(_0x4c2c42){logger[_0xff34('0xa')](_0xff34('0x32'));return BPromise[_0xff34('0x33')]({'id':_0x4c2c42['name_value_list']['id'][_0xff34('0x34')],'name':_0x4c2c42[_0xff34('0x31')][_0xff34('0xb')][_0xff34('0x34')]});}}logger[_0xff34('0xa')](_0xff34('0x35'));return BPromise['resolve']({'id':_0x40f14e['name_value_list'][_0xff34('0x36')]['value'],'name':_0x40f14e[_0xff34('0x31')][_0xff34('0x2d')]['value']});});}else{logger[_0xff34('0xa')](_0xff34('0x37'));return BPromise[_0xff34('0x33')]({'id':_0x40f14e[_0xff34('0x31')][_0xff34('0x36')][_0xff34('0x34')],'name':_0x40f14e[_0xff34('0x31')][_0xff34('0x2d')][_0xff34('0x34')]});}}function getEndUser(_0x51c4a8,_0x21fa9a,_0x552dfb,_0x446ca5){logger[_0xff34('0xa')]('Searching\x20enduser\x20with\x20phone',_0x552dfb);return request({'form':{'method':'get_entry_list','input_type':_0xff34('0x21'),'response_type':_0xff34('0x21'),'rest_data':JSON[_0xff34('0x22')]({'session':_0x446ca5['id'],'module_name':_0xff34('0x1a'),'query':util[_0xff34('0x24')]('contacts.phone_home\x20=\x20\x22%s\x22',_0x552dfb),'order_by':'','offset':'0','select_fields':['id',_0xff34('0xb'),_0xff34('0x38')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x41d87a){if(_0x41d87a[_0xff34('0x2e')]['length']){var _0x45bf6d=_['find'](_0x41d87a[_0xff34('0x2e')],function(_0x1bf3ed){return _0x1bf3ed['name_value_list'][_0xff34('0x38')][_0xff34('0x34')]===_0x552dfb;});if(_0x45bf6d){logger[_0xff34('0xa')](_0xff34('0x39'));return BPromise[_0xff34('0x33')]({'id':_0x45bf6d[_0xff34('0x31')]['id'][_0xff34('0x34')],'name':_0x45bf6d['name_value_list']['name'][_0xff34('0x34')],'phone':_0x45bf6d[_0xff34('0x31')]['phone_home'][_0xff34('0x34')]});}}else{logger[_0xff34('0xa')](_0xff34('0x3a'));return request({'form':{'method':_0xff34('0x20'),'input_type':_0xff34('0x21'),'response_type':_0xff34('0x21'),'rest_data':JSON[_0xff34('0x22')]({'session':_0x446ca5['id'],'module_name':_0xff34('0x1a'),'name_value_list':[{'name':_0xff34('0x3b'),'value':_0x21fa9a!==_0xff34('0x3c')?_0x21fa9a:util[_0xff34('0x24')](_0xff34('0x3d'),_0x552dfb)},{'name':_0xff34('0x38'),'value':_0x552dfb}]})}})[_0xff34('0x3e')](function(_0xcb277){logger[_0xff34('0xa')]('Enduser\x20created.');return BPromise[_0xff34('0x33')]({'id':_0xcb277['id'],'name':_0xcb277[_0xff34('0x2e')]['first_name'][_0xff34('0x34')],'phone':_0xcb277[_0xff34('0x2e')][_0xff34('0x38')][_0xff34('0x34')]});});}});}function request(_0x107c58){logger['debug']('[HTTP]',JSON[_0xff34('0x22')](_0x107c58));return rp(_[_0xff34('0x3f')](def,_0x107c58));}function getTags(_0x5a1971,_0xc5f15a){var _0x236f65=[];if(_0x5a1971&&_0x5a1971[_0xff34('0x2f')]>0x0){_0x236f65=_[_0xff34('0x40')](_0x5a1971,_0xc5f15a);}return _0x236f65;}function getCustomFields(_0xdb90e,_0x4b92af){var _0x49fe89=[];var _0x1c8d83={'custom_fields':[]};if(_0xdb90e['length']>0x0){_[_0xff34('0x1d')](_0xdb90e,function(_0x5f048a){if(_0x5f048a[_0xff34('0x41')]==='string'&&_0x5f048a[_0xff34('0x42')]&&!_0x5f048a['customField']){_0x1c8d83[_0x5f048a[_0xff34('0x42')][_0xff34('0x43')]()]=_0x5f048a['content'][_0xff34('0x27')]();}else if(_0x5f048a[_0xff34('0x41')]===_0xff34('0x44')&&_0x5f048a[_0xff34('0x45')]&&_0x5f048a[_0xff34('0x46')]){_0x1c8d83[_0xff34('0x47')][_0xff34('0x1f')]({'id':_0x5f048a['idField'],'value':_0x5f048a[_0xff34('0x48')]['toString']()});}else if(_0x5f048a['type']==='variable'&&_0x5f048a[_0xff34('0x1e')]&&_0x5f048a['idField']&&_0x5f048a[_0xff34('0x46')]){_0x4b92af[_0x5f048a[_0xff34('0x1e')]]&&_0x1c8d83[_0xff34('0x47')][_0xff34('0x1f')]({'id':_0x5f048a['idField'],'value':_0x4b92af[_0x5f048a['variableName']][_0xff34('0x27')]()});}else if(_0x5f048a[_0xff34('0x41')]===_0xff34('0x49')&&_0x5f048a['Variable']&&_0x5f048a['Variable']['name']&&_0x5f048a[_0xff34('0x45')]&&_0x5f048a[_0xff34('0x46')]){_0x4b92af[_0x5f048a[_0xff34('0x4a')]['name'][_0xff34('0x43')]()]&&_0x1c8d83['custom_fields'][_0xff34('0x1f')]({'id':_0x5f048a['idField'],'value':_0x4b92af[_0x5f048a[_0xff34('0x4a')][_0xff34('0xb')][_0xff34('0x43')]()]['toString']()});}});}return _0x1c8d83;}function getConnection(_0x127152){return request({'method':'POST','form':{'method':_0xff34('0x4b'),'input_type':_0xff34('0x21'),'response_type':'JSON','rest_data':JSON[_0xff34('0x22')]({'user_auth':{'user_name':_0x127152[_0xff34('0x4c')],'password':_0x127152[_0xff34('0x4d')],'encryption':'PLAIN'},'application':_0xff34('0x4e')})}})[_0xff34('0x3e')](function(_0x5c09bb){var _0x17eb36=_0x5c09bb;if(_0x17eb36['id']){def[_0xff34('0x4f')]=_0x17eb36['id'];return BPromise[_0xff34('0x33')](_0x17eb36);}else{throw new Error(util['format'](_0xff34('0x50'),_0x127152['id']));}});}function setRelationship(_0x5cb422,_0x12a658,_0x31216a,_0x16e7a7){return request({'form':{'method':_0xff34('0x51'),'input_type':'JSON','response_type':_0xff34('0x21'),'rest_data':JSON[_0xff34('0x22')]({'session':_0x5cb422['id'],'module_name':_0xff34('0x23'),'module_id':_0x31216a['id'],'link_field_name':_0x16e7a7,'related_ids':[_0x12a658['id']],'name_value_list':[],'delete':0x0})}});}exports[_0xff34('0x52')]=function(_0x4787b8,_0x27f707,_0x1e3e1e,_0x2e65e2,_0x5af7dc,_0x537411){var _0x5b04d2,_0x3265cb,_0x528338,_0x4eaec8;_0x537411[_0xff34('0x53')]=intUtil[_0xff34('0x54')](_0x537411[_0xff34('0x53')]);_0x537411[_0xff34('0x55')]=intUtil['stripTrailingSlash'](_0x537411[_0xff34('0x55')]);def[_0xff34('0x56')]=util['format'](_0xff34('0x57'),_0x537411[_0xff34('0x53')]);if(_0x5af7dc&&_0x5af7dc[_0xff34('0x58')]){logger[_0xff34('0xa')](_0xff34('0x59'),_0xff34('0x5a'));_0x27f707[_0xff34('0x5b')]=util[_0xff34('0x24')](_0xff34('0x5c'),_0x537411[_0xff34('0x55')],_0x27f707[_0xff34('0x5d')],md5(_0x27f707[_0xff34('0x5d')]));}else{_0x27f707[_0xff34('0x5b')]='';}return getConnection(_0x537411)[_0xff34('0x3e')](function(_0x3a4214){_0x4eaec8=_0x3a4214;return getUser(_0x537411,_0x2e65e2[_0xff34('0xb')],_0x4eaec8);})[_0xff34('0x3e')](function(_0x562f88){_0x5b04d2=_0x562f88;logger[_0xff34('0xa')]('The\x20User\x20ID\x20is:',_0x5b04d2['id']);return getEndUser(_0x537411,_0x27f707['calleridname'],_0x27f707[_0xff34('0x5e')],_0x4eaec8);})[_0xff34('0x3e')](function(_0x490fad){_0x3265cb=_0x490fad;logger['info']('The\x20Enduser\x20ID\x20is:',_0x3265cb['id']);return getTicket(_0x537411,_0x5b04d2,_0x3265cb,_0x1e3e1e,_0x27f707,_0x1e3e1e[_0xff34('0x5f')],_0x4eaec8,_0xff34('0x60'));})[_0xff34('0x3e')](function(_0x181f90){_0x528338=_0x181f90;logger['info'](_0xff34('0x61'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x528338['id']);return setRelationship(_0x4eaec8,_0x5b04d2,_0x528338,'users');})[_0xff34('0x3e')](function(){return setRelationship(_0x4eaec8,_0x3265cb,_0x528338,'contacts');})[_0xff34('0x3e')](function(){return getServerInfo(_0x4eaec8);})[_0xff34('0x3e')](function(_0x1fbc6d){var _0x31ab78=parseInt(_0x1fbc6d[_0xff34('0x62')][_0xff34('0x63')](0x0));var _0x5a38aa=util[_0xff34('0x24')](_0xff34('0x64'),_0x537411[_0xff34('0x53')],_0x528338['id']);if(_0x31ab78>0x6){_0x5a38aa=util[_0xff34('0x24')](_0xff34('0x65'),_0x537411['remoteUri'],_0x528338['id']);}logger[_0xff34('0xa')](_0xff34('0x59'),_0xff34('0x66'));emit(util['format'](_0xff34('0x67'),_0x2e65e2[_0xff34('0xb')]),_0xff34('0x68'),{'uri':_0x5a38aa});})['catch'](function(_0x2e7b1c){logger[_0xff34('0x69')](_0xff34('0x59'),JSON[_0xff34('0x22')](_0x2e7b1c));});};exports['outbound']=function(_0x1f5bf4,_0x1e78ab,_0x1ee0a1,_0x4f6668,_0x331fd3,_0x44d61a,_0x422b27){var _0x35a525,_0x4b9846,_0x327418,_0x2c2d89;_0x44d61a[_0xff34('0x53')]=intUtil['stripTrailingSlash'](_0x44d61a[_0xff34('0x53')]);_0x44d61a['serverUrl']=intUtil[_0xff34('0x54')](_0x44d61a[_0xff34('0x55')]);def['uri']=util[_0xff34('0x24')](_0xff34('0x57'),_0x44d61a[_0xff34('0x53')]);if(_0x422b27&&_0x422b27['recordingFormat']&&_0x422b27[_0xff34('0x6a')]!==_0xff34('0x6b')){logger[_0xff34('0xa')](_0xff34('0x6c'),_0xff34('0x5a'));_0x1e78ab[_0xff34('0x5b')]=util[_0xff34('0x24')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x44d61a['serverUrl'],_0x1e78ab[_0xff34('0x5d')],md5(_0x1e78ab[_0xff34('0x5d')]));}return getConnection(_0x44d61a)[_0xff34('0x3e')](function(_0x44b19d){_0x2c2d89=_0x44b19d;return getUser(_0x44d61a,_0x4f6668[_0xff34('0xb')],_0x2c2d89);})[_0xff34('0x3e')](function(_0x2f10fc){_0x35a525=_0x2f10fc;logger[_0xff34('0xa')](_0xff34('0x6d'),_0x35a525['id']);return getEndUser(_0x44d61a,_0x1e78ab['destcalleridname'],_0x1e78ab[_0xff34('0x6e')],_0x2c2d89);})[_0xff34('0x3e')](function(_0x1d89dd){_0x4b9846=_0x1d89dd;logger[_0xff34('0xa')](_0xff34('0x6f'),_0x4b9846['id']);return getTicket(_0x44d61a,_0x35a525,_0x4b9846,_0x1ee0a1,_0x1e78ab,_0x1ee0a1[_0xff34('0x5f')],_0x2c2d89,_0xff34('0x70'));})[_0xff34('0x3e')](function(_0x2bda40){_0x327418=_0x2bda40;logger['info'](_0xff34('0x61'));logger[_0xff34('0xa')]('The\x20Ticket\x20ID\x20is:',_0x327418['id']);return setRelationship(_0x2c2d89,_0x35a525,_0x327418,_0xff34('0x71'));})[_0xff34('0x3e')](function(){return setRelationship(_0x2c2d89,_0x4b9846,_0x327418,_0xff34('0x72'));})[_0xff34('0x3e')](function(){return getServerInfo(_0x2c2d89);})['then'](function(_0x75a364){var _0x3f7ac4=parseInt(_0x75a364['version']['charAt'](0x0));var _0x298546=util[_0xff34('0x24')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x44d61a['remoteUri'],_0x327418['id']);if(_0x3f7ac4>0x6){_0x298546=util[_0xff34('0x24')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x44d61a[_0xff34('0x53')],_0x327418['id']);}logger['info'](_0xff34('0x6c'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xff34('0x24')](_0xff34('0x67'),_0x4f6668[_0xff34('0xb')]),'trigger:browser:url',{'uri':_0x298546});})[_0xff34('0x73')](function(_0x223df8){logger[_0xff34('0x69')](_0xff34('0x6c'),JSON[_0xff34('0x22')](_0x223df8));});};exports['unmanaged']=function(_0x3202a6,_0x246160,_0x4f8f4e,_0x311e04,_0x9a441b,_0x3ebcbf){var _0x413d48,_0x59c9f1,_0x5a4de7,_0x371aaf;_0x3ebcbf[_0xff34('0x53')]=intUtil[_0xff34('0x54')](_0x3ebcbf[_0xff34('0x53')]);_0x3ebcbf[_0xff34('0x55')]=intUtil[_0xff34('0x54')](_0x3ebcbf['serverUrl']);def[_0xff34('0x56')]=util[_0xff34('0x24')](_0xff34('0x57'),_0x3ebcbf[_0xff34('0x53')]);if(_0x9a441b&&_0x9a441b[_0xff34('0x58')]){logger['info']('['+_0x246160[_0xff34('0x74')][_0xff34('0x75')]()+']',_0xff34('0x5a'));_0x246160['recordingURL']=util['format'](_0xff34('0x5c'),_0x3ebcbf[_0xff34('0x55')],_0x246160[_0xff34('0x5d')],md5(_0x246160['uniqueid']));}else{_0x246160[_0xff34('0x5b')]='';}return getConnection(_0x3ebcbf)['then'](function(_0x365cd7){_0x371aaf=_0x365cd7;if(!_['isNil'](_0x311e04)){return getUser(_0x3ebcbf,_0x311e04['name'],_0x371aaf);}else{return getUser(_0x3ebcbf,null,_0x371aaf);}})[_0xff34('0x3e')](function(_0x435fee){_0x413d48=_0x435fee;logger[_0xff34('0xa')](_0xff34('0x6d'),_0x413d48['id']);return getEndUser(_0x3ebcbf,_0x246160[_0xff34('0x76')],_0x246160[_0xff34('0x5e')],_0x371aaf);})[_0xff34('0x3e')](function(_0x1bd81d){_0x59c9f1=_0x1bd81d;logger['info'](_0xff34('0x6f'),_0x59c9f1['id']);return getTicket(_0x3ebcbf,_0x413d48,_0x59c9f1,_0x4f8f4e,_0x246160,_0x4f8f4e['Fields'],_0x371aaf,_0xff34('0x60'));})[_0xff34('0x3e')](function(_0x10e143){_0x5a4de7=_0x10e143;logger[_0xff34('0xa')](_0xff34('0x61'));logger['info'](_0xff34('0x77'),_0x5a4de7['id']);return setRelationship(_0x371aaf,_0x413d48,_0x5a4de7,_0xff34('0x71'));})[_0xff34('0x3e')](function(){return setRelationship(_0x371aaf,_0x59c9f1,_0x5a4de7,_0xff34('0x72'));})[_0xff34('0x3e')](function(){return getServerInfo(_0x371aaf);})[_0xff34('0x73')](function(_0x4e0347){logger[_0xff34('0x69')]('['+_0x246160[_0xff34('0x74')][_0xff34('0x75')]()+']',JSON[_0xff34('0x22')](_0x4e0347));});};
\ No newline at end of file
+var _0xfbfb=['destcalleridnum','Outbound','version','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','unmanaged','lastevent','toUpperCase','Recording\x20is\x20enabled!','The\x20User\x20ID\x20is:','Fields','Inbound','lodash','request-promise','util','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','POST','Creating\x20new\x20ticket...','name','getString','Subjects','assigned_user_id','created_by','description','Descriptions','date_start','toISOString','slice','replace','duration_hours','duration_minutes','parent_id','parent_type','Contacts','parent_name','direction','length','variableName','push','idField','set_entry','JSON','stringify','Calls','format','toString','base64','get_server_info','isNil','Getting\x20agent\x20with\x20name','then','entry_list','find','name_value_list','user_name','value','info','resolve','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','Caller\x20-\x20%s','debug','[HTTP]','map','forEach','type','toLowerCase','content','string','customField','custom_fields','variable','customVariable','Variable','username','password','PLAIN','xCALLY\x20Motion\x20integration','Account\x20%d\x20is\x20not\x20valid','set_relationship','remoteUri','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','contacts','charAt','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','user:%s','trigger:browser:url','catch','error','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname'];(function(_0x1d92e2,_0x4822a0){var _0x3abb76=function(_0x2879ba){while(--_0x2879ba){_0x1d92e2['push'](_0x1d92e2['shift']());}};_0x3abb76(++_0x4822a0);}(_0xfbfb,0xfa));var _0xbfbf=function(_0x2b4649,_0x27e75b){_0x2b4649=_0x2b4649-0x0;var _0x41e253=_0xfbfb[_0x2b4649];return _0x41e253;};'use strict';var _=require(_0xbfbf('0x0'));var rp=require(_0xbfbf('0x1'));var BPromise=require('bluebird');var md5=require('md5');var util=require(_0xbfbf('0x2'));var Redis=require(_0xbfbf('0x3'));var intUtil=require(_0xbfbf('0x4'));var config=require(_0xbfbf('0x5'));var logger=require(_0xbfbf('0x6'))('sugarcrm');config[_0xbfbf('0x7')]=_[_0xbfbf('0x8')](config[_0xbfbf('0x7')],{'host':_0xbfbf('0x9'),'port':0x18eb});var io=require(_0xbfbf('0xa'))(new Redis(config[_0xbfbf('0x7')]));var def={'method':_0xbfbf('0xb'),'json':!![]};function emit(_0x53b602,_0x42addb,_0x3c7923){io['to'](_0x53b602)['emit'](_0x42addb,_0x3c7923);}function getTicket(_0x448353,_0x319218,_0x40cce1,_0x40a252,_0x2f6623,_0x195dc4,_0x59c82c,_0x2b6cba){logger['info'](_0xbfbf('0xc'));var _0xbe07d1=new Date();var _0x3bb99d=[{'name':_0xbfbf('0xd'),'value':intUtil[_0xbfbf('0xe')](_0x40a252[_0xbfbf('0xf')],_0x2f6623,'\x20')},{'name':_0xbfbf('0x10'),'value':_0x319218['id']},{'name':_0xbfbf('0x11'),'value':_0x319218['id']},{'name':_0xbfbf('0x12'),'value':intUtil[_0xbfbf('0xe')](_0x40a252[_0xbfbf('0x13')],_0x2f6623,'\x0a')},{'name':_0xbfbf('0x14'),'value':_0xbe07d1[_0xbfbf('0x15')]()[_0xbfbf('0x16')](0x0,0x13)[_0xbfbf('0x17')]('T','\x20')},{'name':_0xbfbf('0x18'),'value':'0'},{'name':_0xbfbf('0x19'),'value':'15'},{'name':_0xbfbf('0x1a'),'value':_0x40cce1['id']},{'name':_0xbfbf('0x1b'),'value':_0xbfbf('0x1c')},{'name':_0xbfbf('0x1d'),'value':_0x40cce1[_0xbfbf('0xd')]},{'name':_0xbfbf('0x1e'),'value':_0x2b6cba}];if(_0x195dc4[_0xbfbf('0x1f')]){_['forEach'](_0x195dc4,function(_0x1af756){if(_0x2f6623[_0x1af756[_0xbfbf('0x20')]]){_0x3bb99d[_0xbfbf('0x21')]({'name':_0x1af756[_0xbfbf('0x22')],'value':_0x2f6623[_0x1af756[_0xbfbf('0x20')]]});}});}return request({'form':{'method':_0xbfbf('0x23'),'input_type':_0xbfbf('0x24'),'response_type':_0xbfbf('0x24'),'rest_data':JSON[_0xbfbf('0x25')]({'session':_0x59c82c['id'],'module_name':_0xbfbf('0x26'),'name_value_list':_0x3bb99d})}});}function getAuth(_0x583d32){return util[_0xbfbf('0x27')]('Basic\x20%s',new Buffer(_0x583d32['apiKey']+':X')[_0xbfbf('0x28')](_0xbfbf('0x29')));}function getServerInfo(_0x596bbd){return request({'form':{'method':_0xbfbf('0x2a'),'input_type':_0xbfbf('0x24'),'response_type':_0xbfbf('0x24'),'rest_data':JSON[_0xbfbf('0x25')]({'session':_0x596bbd['id']})}});}function getUser(_0x48b9a5,_0xb9b155,_0x4ec2d3){if(!_[_0xbfbf('0x2b')](_0xb9b155)){logger['info'](_0xbfbf('0x2c'),_0xb9b155);return request({'form':{'method':'get_entry_list','input_type':_0xbfbf('0x24'),'response_type':_0xbfbf('0x24'),'rest_data':JSON[_0xbfbf('0x25')]({'session':_0x4ec2d3['id'],'module_name':'Employees','query':util[_0xbfbf('0x27')]('INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200',_0xb9b155),'order_by':'','offset':'0','select_fields':['id',_0xbfbf('0xd'),'user_name'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xbfbf('0x2d')](function(_0x335b09){if(_0x335b09[_0xbfbf('0x2e')][_0xbfbf('0x1f')]){var _0x59de91=_[_0xbfbf('0x2f')](_0x335b09[_0xbfbf('0x2e')],function(_0xe71a68){return _0xe71a68[_0xbfbf('0x30')][_0xbfbf('0x31')][_0xbfbf('0x32')]===_0xb9b155;});if(_0x59de91){logger[_0xbfbf('0x33')]('Agent\x20found!');return BPromise[_0xbfbf('0x34')]({'id':_0x59de91[_0xbfbf('0x30')]['id'][_0xbfbf('0x32')],'name':_0x59de91[_0xbfbf('0x30')][_0xbfbf('0xd')][_0xbfbf('0x32')]});}}logger[_0xbfbf('0x33')](_0xbfbf('0x35'));return BPromise[_0xbfbf('0x34')]({'id':_0x4ec2d3['name_value_list']['user_id'][_0xbfbf('0x32')],'name':_0x4ec2d3['name_value_list'][_0xbfbf('0x31')][_0xbfbf('0x32')]});});}else{logger[_0xbfbf('0x33')]('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise[_0xbfbf('0x34')]({'id':_0x4ec2d3['name_value_list'][_0xbfbf('0x36')][_0xbfbf('0x32')],'name':_0x4ec2d3[_0xbfbf('0x30')][_0xbfbf('0x31')]['value']});}}function getEndUser(_0x3b9ee3,_0x58146b,_0x381e1d,_0x3a7911){logger['info']('Searching\x20enduser\x20with\x20phone',_0x381e1d);return request({'form':{'method':'get_entry_list','input_type':_0xbfbf('0x24'),'response_type':_0xbfbf('0x24'),'rest_data':JSON['stringify']({'session':_0x3a7911['id'],'module_name':'Contacts','query':util[_0xbfbf('0x27')](_0xbfbf('0x37'),_0x381e1d),'order_by':'','offset':'0','select_fields':['id',_0xbfbf('0xd'),_0xbfbf('0x38')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xbfbf('0x2d')](function(_0x3de65d){if(_0x3de65d[_0xbfbf('0x2e')][_0xbfbf('0x1f')]){var _0x25ebb6=_[_0xbfbf('0x2f')](_0x3de65d[_0xbfbf('0x2e')],function(_0x481767){return _0x481767[_0xbfbf('0x30')][_0xbfbf('0x38')][_0xbfbf('0x32')]===_0x381e1d;});if(_0x25ebb6){logger[_0xbfbf('0x33')]('Enduser\x20found!');return BPromise[_0xbfbf('0x34')]({'id':_0x25ebb6[_0xbfbf('0x30')]['id'][_0xbfbf('0x32')],'name':_0x25ebb6[_0xbfbf('0x30')]['name'][_0xbfbf('0x32')],'phone':_0x25ebb6['name_value_list'][_0xbfbf('0x38')]['value']});}}else{logger[_0xbfbf('0x33')](_0xbfbf('0x39'));return request({'form':{'method':_0xbfbf('0x23'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0xbfbf('0x25')]({'session':_0x3a7911['id'],'module_name':_0xbfbf('0x1c'),'name_value_list':[{'name':_0xbfbf('0x3a'),'value':_0x58146b!=='<unknown>'?_0x58146b:util[_0xbfbf('0x27')](_0xbfbf('0x3b'),_0x381e1d)},{'name':_0xbfbf('0x38'),'value':_0x381e1d}]})}})['then'](function(_0xc86152){logger[_0xbfbf('0x33')]('Enduser\x20created.');return BPromise[_0xbfbf('0x34')]({'id':_0xc86152['id'],'name':_0xc86152[_0xbfbf('0x2e')][_0xbfbf('0x3a')][_0xbfbf('0x32')],'phone':_0xc86152[_0xbfbf('0x2e')][_0xbfbf('0x38')][_0xbfbf('0x32')]});});}});}function request(_0x87f1c){logger[_0xbfbf('0x3c')](_0xbfbf('0x3d'),JSON[_0xbfbf('0x25')](_0x87f1c));return rp(_['merge'](def,_0x87f1c));}function getTags(_0x3fd84d,_0xe94cfc){var _0x56e103=[];if(_0x3fd84d&&_0x3fd84d[_0xbfbf('0x1f')]>0x0){_0x56e103=_[_0xbfbf('0x3e')](_0x3fd84d,_0xe94cfc);}return _0x56e103;}function getCustomFields(_0x1595b1,_0x2ee204){var _0x14996a=[];var _0x1ebd1f={'custom_fields':[]};if(_0x1595b1[_0xbfbf('0x1f')]>0x0){_[_0xbfbf('0x3f')](_0x1595b1,function(_0x4ce003){if(_0x4ce003[_0xbfbf('0x40')]==='string'&&_0x4ce003['nameField']&&!_0x4ce003['customField']){_0x1ebd1f[_0x4ce003['nameField'][_0xbfbf('0x41')]()]=_0x4ce003[_0xbfbf('0x42')][_0xbfbf('0x28')]();}else if(_0x4ce003['type']===_0xbfbf('0x43')&&_0x4ce003[_0xbfbf('0x22')]&&_0x4ce003[_0xbfbf('0x44')]){_0x1ebd1f[_0xbfbf('0x45')][_0xbfbf('0x21')]({'id':_0x4ce003[_0xbfbf('0x22')],'value':_0x4ce003[_0xbfbf('0x42')][_0xbfbf('0x28')]()});}else if(_0x4ce003[_0xbfbf('0x40')]===_0xbfbf('0x46')&&_0x4ce003[_0xbfbf('0x20')]&&_0x4ce003['idField']&&_0x4ce003[_0xbfbf('0x44')]){_0x2ee204[_0x4ce003['variableName']]&&_0x1ebd1f[_0xbfbf('0x45')]['push']({'id':_0x4ce003[_0xbfbf('0x22')],'value':_0x2ee204[_0x4ce003[_0xbfbf('0x20')]][_0xbfbf('0x28')]()});}else if(_0x4ce003['type']===_0xbfbf('0x47')&&_0x4ce003[_0xbfbf('0x48')]&&_0x4ce003[_0xbfbf('0x48')][_0xbfbf('0xd')]&&_0x4ce003[_0xbfbf('0x22')]&&_0x4ce003['customField']){_0x2ee204[_0x4ce003[_0xbfbf('0x48')]['name'][_0xbfbf('0x41')]()]&&_0x1ebd1f['custom_fields'][_0xbfbf('0x21')]({'id':_0x4ce003['idField'],'value':_0x2ee204[_0x4ce003[_0xbfbf('0x48')]['name'][_0xbfbf('0x41')]()]['toString']()});}});}return _0x1ebd1f;}function getConnection(_0x4d615e){return request({'method':'POST','form':{'method':'login','input_type':_0xbfbf('0x24'),'response_type':_0xbfbf('0x24'),'rest_data':JSON[_0xbfbf('0x25')]({'user_auth':{'user_name':_0x4d615e[_0xbfbf('0x49')],'password':_0x4d615e[_0xbfbf('0x4a')],'encryption':_0xbfbf('0x4b')},'application':_0xbfbf('0x4c')})}})[_0xbfbf('0x2d')](function(_0x10a48b){var _0x490e9a=_0x10a48b;if(_0x490e9a['id']){def['sessionID']=_0x490e9a['id'];return BPromise[_0xbfbf('0x34')](_0x490e9a);}else{throw new Error(util[_0xbfbf('0x27')](_0xbfbf('0x4d'),_0x4d615e['id']));}});}function setRelationship(_0x487e91,_0x531ea7,_0x67189a,_0x200d0a){return request({'form':{'method':_0xbfbf('0x4e'),'input_type':_0xbfbf('0x24'),'response_type':'JSON','rest_data':JSON[_0xbfbf('0x25')]({'session':_0x487e91['id'],'module_name':_0xbfbf('0x26'),'module_id':_0x67189a['id'],'link_field_name':_0x200d0a,'related_ids':[_0x531ea7['id']],'name_value_list':[],'delete':0x0})}});}exports['queue']=function(_0x43cc5f,_0x5acf67,_0x50a704,_0x54e8f8,_0x16af43,_0x3a0e5d){var _0x41484a,_0x50c09e,_0xc245ba,_0x3635e0;_0x3a0e5d[_0xbfbf('0x4f')]=intUtil[_0xbfbf('0x50')](_0x3a0e5d['remoteUri']);_0x3a0e5d[_0xbfbf('0x51')]=intUtil[_0xbfbf('0x50')](_0x3a0e5d[_0xbfbf('0x51')]);def[_0xbfbf('0x52')]=util[_0xbfbf('0x27')](_0xbfbf('0x53'),_0x3a0e5d[_0xbfbf('0x4f')]);if(_0x16af43&&_0x16af43[_0xbfbf('0x54')]){logger[_0xbfbf('0x33')](_0xbfbf('0x55'),'Recording\x20is\x20enabled!');_0x5acf67['recordingURL']=util[_0xbfbf('0x27')](_0xbfbf('0x56'),_0x3a0e5d[_0xbfbf('0x51')],_0x5acf67[_0xbfbf('0x57')],md5(_0x5acf67[_0xbfbf('0x57')]));}else{_0x5acf67[_0xbfbf('0x58')]='';}return getConnection(_0x3a0e5d)[_0xbfbf('0x2d')](function(_0x3bba7b){_0x3635e0=_0x3bba7b;return getUser(_0x3a0e5d,_0x54e8f8[_0xbfbf('0xd')],_0x3635e0);})[_0xbfbf('0x2d')](function(_0x3d49b6){_0x41484a=_0x3d49b6;logger['info']('The\x20User\x20ID\x20is:',_0x41484a['id']);return getEndUser(_0x3a0e5d,_0x5acf67[_0xbfbf('0x59')],_0x5acf67[_0xbfbf('0x5a')],_0x3635e0);})[_0xbfbf('0x2d')](function(_0x430fcc){_0x50c09e=_0x430fcc;logger[_0xbfbf('0x33')](_0xbfbf('0x5b'),_0x50c09e['id']);return getTicket(_0x3a0e5d,_0x41484a,_0x50c09e,_0x50a704,_0x5acf67,_0x50a704['Fields'],_0x3635e0,'Inbound');})[_0xbfbf('0x2d')](function(_0x428e90){_0xc245ba=_0x428e90;logger[_0xbfbf('0x33')](_0xbfbf('0x5c'));logger[_0xbfbf('0x33')](_0xbfbf('0x5d'),_0xc245ba['id']);return setRelationship(_0x3635e0,_0x41484a,_0xc245ba,_0xbfbf('0x5e'));})[_0xbfbf('0x2d')](function(){return setRelationship(_0x3635e0,_0x50c09e,_0xc245ba,_0xbfbf('0x5f'));})['then'](function(){return getServerInfo(_0x3635e0);})[_0xbfbf('0x2d')](function(_0x543ed5){var _0x5469ff=parseInt(_0x543ed5['version'][_0xbfbf('0x60')](0x0));var _0x45ab71=util[_0xbfbf('0x27')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x3a0e5d[_0xbfbf('0x4f')],_0xc245ba['id']);if(_0x5469ff>0x6){_0x45ab71=util[_0xbfbf('0x27')](_0xbfbf('0x61'),_0x3a0e5d[_0xbfbf('0x4f')],_0xc245ba['id']);}logger[_0xbfbf('0x33')](_0xbfbf('0x55'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xbfbf('0x27')](_0xbfbf('0x62'),_0x54e8f8[_0xbfbf('0xd')]),_0xbfbf('0x63'),{'uri':_0x45ab71});})[_0xbfbf('0x64')](function(_0x5c8f4a){logger[_0xbfbf('0x65')]('[QUEUE]',JSON['stringify'](_0x5c8f4a));});};exports[_0xbfbf('0x66')]=function(_0x49a7a8,_0x9d0c87,_0x355e3f,_0x2e6b47,_0x465ae9,_0x2a194c,_0x361434){var _0x1d07fa,_0x42c795,_0x1c1511,_0x491072;_0x2a194c[_0xbfbf('0x4f')]=intUtil[_0xbfbf('0x50')](_0x2a194c[_0xbfbf('0x4f')]);_0x2a194c[_0xbfbf('0x51')]=intUtil['stripTrailingSlash'](_0x2a194c[_0xbfbf('0x51')]);def['uri']=util[_0xbfbf('0x27')]('%s/service/v4_1/rest.php',_0x2a194c[_0xbfbf('0x4f')]);if(_0x361434&&_0x361434[_0xbfbf('0x67')]&&_0x361434[_0xbfbf('0x67')]!==_0xbfbf('0x68')){logger[_0xbfbf('0x33')](_0xbfbf('0x69'),'Recording\x20is\x20enabled!');_0x9d0c87[_0xbfbf('0x58')]=util[_0xbfbf('0x27')](_0xbfbf('0x56'),_0x2a194c[_0xbfbf('0x51')],_0x9d0c87[_0xbfbf('0x57')],md5(_0x9d0c87[_0xbfbf('0x57')]));}return getConnection(_0x2a194c)[_0xbfbf('0x2d')](function(_0x3f4f55){_0x491072=_0x3f4f55;return getUser(_0x2a194c,_0x2e6b47[_0xbfbf('0xd')],_0x491072);})[_0xbfbf('0x2d')](function(_0x34b363){_0x1d07fa=_0x34b363;logger[_0xbfbf('0x33')]('The\x20User\x20ID\x20is:',_0x1d07fa['id']);return getEndUser(_0x2a194c,_0x9d0c87[_0xbfbf('0x6a')],_0x9d0c87[_0xbfbf('0x6b')],_0x491072);})[_0xbfbf('0x2d')](function(_0x519b7e){_0x42c795=_0x519b7e;logger[_0xbfbf('0x33')](_0xbfbf('0x5b'),_0x42c795['id']);return getTicket(_0x2a194c,_0x1d07fa,_0x42c795,_0x355e3f,_0x9d0c87,_0x355e3f['Fields'],_0x491072,_0xbfbf('0x6c'));})[_0xbfbf('0x2d')](function(_0x1753fd){_0x1c1511=_0x1753fd;logger[_0xbfbf('0x33')](_0xbfbf('0x5c'));logger['info'](_0xbfbf('0x5d'),_0x1c1511['id']);return setRelationship(_0x491072,_0x1d07fa,_0x1c1511,'users');})[_0xbfbf('0x2d')](function(){return setRelationship(_0x491072,_0x42c795,_0x1c1511,_0xbfbf('0x5f'));})[_0xbfbf('0x2d')](function(){return getServerInfo(_0x491072);})['then'](function(_0x1a7027){var _0x389844=parseInt(_0x1a7027[_0xbfbf('0x6d')][_0xbfbf('0x60')](0x0));var _0x247767=util[_0xbfbf('0x27')](_0xbfbf('0x6e'),_0x2a194c[_0xbfbf('0x4f')],_0x1c1511['id']);if(_0x389844>0x6){_0x247767=util['format'](_0xbfbf('0x61'),_0x2a194c[_0xbfbf('0x4f')],_0x1c1511['id']);}logger[_0xbfbf('0x33')](_0xbfbf('0x69'),_0xbfbf('0x6f'));emit(util[_0xbfbf('0x27')](_0xbfbf('0x62'),_0x2e6b47[_0xbfbf('0xd')]),'trigger:browser:url',{'uri':_0x247767});})['catch'](function(_0x47d94d){logger[_0xbfbf('0x65')]('[OUTBOUND]',JSON[_0xbfbf('0x25')](_0x47d94d));});};exports[_0xbfbf('0x70')]=function(_0x5974d1,_0x3e4966,_0x2e685f,_0x59a36f,_0x6b9591,_0x37c31b){var _0x25935d,_0x3bcbd2,_0x55b5a0,_0x3ec190;_0x37c31b[_0xbfbf('0x4f')]=intUtil[_0xbfbf('0x50')](_0x37c31b[_0xbfbf('0x4f')]);_0x37c31b[_0xbfbf('0x51')]=intUtil[_0xbfbf('0x50')](_0x37c31b[_0xbfbf('0x51')]);def[_0xbfbf('0x52')]=util['format'](_0xbfbf('0x53'),_0x37c31b[_0xbfbf('0x4f')]);if(_0x6b9591&&_0x6b9591['monitor_format']){logger[_0xbfbf('0x33')]('['+_0x3e4966[_0xbfbf('0x71')][_0xbfbf('0x72')]()+']',_0xbfbf('0x73'));_0x3e4966[_0xbfbf('0x58')]=util[_0xbfbf('0x27')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x37c31b[_0xbfbf('0x51')],_0x3e4966[_0xbfbf('0x57')],md5(_0x3e4966['uniqueid']));}else{_0x3e4966[_0xbfbf('0x58')]='';}return getConnection(_0x37c31b)['then'](function(_0x2857cc){_0x3ec190=_0x2857cc;if(!_[_0xbfbf('0x2b')](_0x59a36f)){return getUser(_0x37c31b,_0x59a36f[_0xbfbf('0xd')],_0x3ec190);}else{return getUser(_0x37c31b,null,_0x3ec190);}})['then'](function(_0x59a246){_0x25935d=_0x59a246;logger['info'](_0xbfbf('0x74'),_0x25935d['id']);return getEndUser(_0x37c31b,_0x3e4966[_0xbfbf('0x59')],_0x3e4966['calleridnum'],_0x3ec190);})[_0xbfbf('0x2d')](function(_0x2a9c11){_0x3bcbd2=_0x2a9c11;logger[_0xbfbf('0x33')](_0xbfbf('0x5b'),_0x3bcbd2['id']);return getTicket(_0x37c31b,_0x25935d,_0x3bcbd2,_0x2e685f,_0x3e4966,_0x2e685f[_0xbfbf('0x75')],_0x3ec190,_0xbfbf('0x76'));})['then'](function(_0x5432ad){_0x55b5a0=_0x5432ad;logger[_0xbfbf('0x33')](_0xbfbf('0x5c'));logger[_0xbfbf('0x33')](_0xbfbf('0x5d'),_0x55b5a0['id']);return setRelationship(_0x3ec190,_0x25935d,_0x55b5a0,'users');})[_0xbfbf('0x2d')](function(){return setRelationship(_0x3ec190,_0x3bcbd2,_0x55b5a0,'contacts');})[_0xbfbf('0x2d')](function(){return getServerInfo(_0x3ec190);})['catch'](function(_0x4d7fa4){logger['error']('['+_0x3e4966[_0xbfbf('0x71')][_0xbfbf('0x72')]()+']',JSON[_0xbfbf('0x25')](_0x4d7fa4));});};
\ No newline at end of file