Built motion from commit (unavailable).|2.5.14
[motion2.git] / server / services / ami / trigger / integration / sugarcrm.js
index 0311953..ff27331 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xeabf=['users','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','[QUEUE]','user:%s','trigger:browser:url','catch','error','recordingFormat','none','[OUTBOUND]','destcalleridname','Outbound','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','unmanaged','toUpperCase','calleridname','contacts','lastevent','lodash','request-promise','bluebird','md5','util','./util','../../../../config/logger','sugarcrm','redis','defaults','localhost','POST','emit','info','Creating\x20new\x20ticket...','name','getString','Subjects','assigned_user_id','description','Descriptions','date_start','toISOString','replace','duration_hours','duration_minutes','parent_type','Contacts','parent_name','length','forEach','variableName','push','idField','set_entry','JSON','stringify','Calls','format','Basic\x20%s','apiKey','toString','get_server_info','isNil','Getting\x20agent\x20with\x20name','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','find','name_value_list','value','resolve','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','<unknown>','Caller\x20-\x20%s','Enduser\x20created.','[HTTP]','merge','map','type','string','nameField','toLowerCase','content','custom_fields','variable','customField','customVariable','Variable','login','username','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','remoteUri','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xeabf,0x90));var _0xfeab=function(_0x5e105d,_0x5297fc){_0x5e105d=_0x5e105d-0x0;var _0x56bffe=_0xeabf[_0x5e105d];return _0x56bffe;};'use strict';var _=require(_0xfeab('0x0'));var rp=require(_0xfeab('0x1'));var BPromise=require(_0xfeab('0x2'));var md5=require(_0xfeab('0x3'));var util=require(_0xfeab('0x4'));var Redis=require('ioredis');var intUtil=require(_0xfeab('0x5'));var config=require('../../../../config/environment');var logger=require(_0xfeab('0x6'))(_0xfeab('0x7'));config[_0xfeab('0x8')]=_[_0xfeab('0x9')](config[_0xfeab('0x8')],{'host':_0xfeab('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var def={'method':_0xfeab('0xb'),'json':!![]};function emit(_0x38b6c1,_0x29be32,_0x52bd53){io['to'](_0x38b6c1)[_0xfeab('0xc')](_0x29be32,_0x52bd53);}function getTicket(_0x38a48f,_0x84b71d,_0x469f1d,_0x3fc6ba,_0x55e9fc,_0x23f15b,_0x45c132,_0x3d4620){logger[_0xfeab('0xd')](_0xfeab('0xe'));var _0x53818f=new Date();var _0x2e183b=[{'name':_0xfeab('0xf'),'value':intUtil[_0xfeab('0x10')](_0x3fc6ba[_0xfeab('0x11')],_0x55e9fc,'\x20')},{'name':_0xfeab('0x12'),'value':_0x84b71d['id']},{'name':'created_by','value':_0x84b71d['id']},{'name':_0xfeab('0x13'),'value':intUtil['getString'](_0x3fc6ba[_0xfeab('0x14')],_0x55e9fc,'\x0a')},{'name':_0xfeab('0x15'),'value':_0x53818f[_0xfeab('0x16')]()['slice'](0x0,0x13)[_0xfeab('0x17')]('T','\x20')},{'name':_0xfeab('0x18'),'value':'0'},{'name':_0xfeab('0x19'),'value':'15'},{'name':'parent_id','value':_0x469f1d['id']},{'name':_0xfeab('0x1a'),'value':_0xfeab('0x1b')},{'name':_0xfeab('0x1c'),'value':_0x469f1d[_0xfeab('0xf')]},{'name':'direction','value':_0x3d4620}];if(_0x23f15b[_0xfeab('0x1d')]){_[_0xfeab('0x1e')](_0x23f15b,function(_0x5ec192){if(_0x55e9fc[_0x5ec192[_0xfeab('0x1f')]]){_0x2e183b[_0xfeab('0x20')]({'name':_0x5ec192[_0xfeab('0x21')],'value':_0x55e9fc[_0x5ec192['variableName']]});}});}return request({'form':{'method':_0xfeab('0x22'),'input_type':_0xfeab('0x23'),'response_type':_0xfeab('0x23'),'rest_data':JSON[_0xfeab('0x24')]({'session':_0x45c132['id'],'module_name':_0xfeab('0x25'),'name_value_list':_0x2e183b})}});}function getAuth(_0x309f95){return util[_0xfeab('0x26')](_0xfeab('0x27'),new Buffer(_0x309f95[_0xfeab('0x28')]+':X')[_0xfeab('0x29')]('base64'));}function getServerInfo(_0xac2d31){return request({'form':{'method':_0xfeab('0x2a'),'input_type':_0xfeab('0x23'),'response_type':'JSON','rest_data':JSON[_0xfeab('0x24')]({'session':_0xac2d31['id']})}});}function getUser(_0x3fe8aa,_0x29385e,_0x286876){if(!_[_0xfeab('0x2b')](_0x29385e)){logger[_0xfeab('0xd')](_0xfeab('0x2c'),_0x29385e);return request({'form':{'method':_0xfeab('0x2d'),'input_type':_0xfeab('0x23'),'response_type':_0xfeab('0x23'),'rest_data':JSON[_0xfeab('0x24')]({'session':_0x286876['id'],'module_name':_0xfeab('0x2e'),'query':util[_0xfeab('0x26')](_0xfeab('0x2f'),_0x29385e),'order_by':'','offset':'0','select_fields':['id',_0xfeab('0xf'),_0xfeab('0x30')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xfeab('0x31')](function(_0x10c993){if(_0x10c993[_0xfeab('0x32')]['length']){var _0x40df5f=_[_0xfeab('0x33')](_0x10c993['entry_list'],function(_0x11058f){return _0x11058f[_0xfeab('0x34')][_0xfeab('0x30')][_0xfeab('0x35')]===_0x29385e;});if(_0x40df5f){logger[_0xfeab('0xd')]('Agent\x20found!');return BPromise[_0xfeab('0x36')]({'id':_0x40df5f[_0xfeab('0x34')]['id'][_0xfeab('0x35')],'name':_0x40df5f[_0xfeab('0x34')][_0xfeab('0xf')][_0xfeab('0x35')]});}}logger[_0xfeab('0xd')](_0xfeab('0x37'));return BPromise[_0xfeab('0x36')]({'id':_0x286876[_0xfeab('0x34')][_0xfeab('0x38')][_0xfeab('0x35')],'name':_0x286876[_0xfeab('0x34')]['user_name'][_0xfeab('0x35')]});});}else{logger[_0xfeab('0xd')](_0xfeab('0x39'));return BPromise[_0xfeab('0x36')]({'id':_0x286876[_0xfeab('0x34')][_0xfeab('0x38')][_0xfeab('0x35')],'name':_0x286876[_0xfeab('0x34')]['user_name'][_0xfeab('0x35')]});}}function getEndUser(_0x1fe93b,_0x3742d7,_0x40660a,_0x4baae0){logger[_0xfeab('0xd')](_0xfeab('0x3a'),_0x40660a);return request({'form':{'method':_0xfeab('0x2d'),'input_type':_0xfeab('0x23'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x4baae0['id'],'module_name':_0xfeab('0x1b'),'query':util[_0xfeab('0x26')](_0xfeab('0x3b'),_0x40660a),'order_by':'','offset':'0','select_fields':['id',_0xfeab('0xf'),'phone_home'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x308bba){if(_0x308bba[_0xfeab('0x32')][_0xfeab('0x1d')]){var _0x2542b3=_[_0xfeab('0x33')](_0x308bba[_0xfeab('0x32')],function(_0x4b2116){return _0x4b2116[_0xfeab('0x34')][_0xfeab('0x3c')][_0xfeab('0x35')]===_0x40660a;});if(_0x2542b3){logger[_0xfeab('0xd')]('Enduser\x20found!');return BPromise[_0xfeab('0x36')]({'id':_0x2542b3[_0xfeab('0x34')]['id']['value'],'name':_0x2542b3[_0xfeab('0x34')][_0xfeab('0xf')][_0xfeab('0x35')],'phone':_0x2542b3['name_value_list'][_0xfeab('0x3c')][_0xfeab('0x35')]});}}else{logger[_0xfeab('0xd')](_0xfeab('0x3d'));return request({'form':{'method':_0xfeab('0x22'),'input_type':_0xfeab('0x23'),'response_type':_0xfeab('0x23'),'rest_data':JSON[_0xfeab('0x24')]({'session':_0x4baae0['id'],'module_name':_0xfeab('0x1b'),'name_value_list':[{'name':_0xfeab('0x3e'),'value':_0x3742d7!==_0xfeab('0x3f')?_0x3742d7:util['format'](_0xfeab('0x40'),_0x40660a)},{'name':_0xfeab('0x3c'),'value':_0x40660a}]})}})[_0xfeab('0x31')](function(_0x5182ce){logger[_0xfeab('0xd')](_0xfeab('0x41'));return BPromise[_0xfeab('0x36')]({'id':_0x5182ce['id'],'name':_0x5182ce['entry_list'][_0xfeab('0x3e')][_0xfeab('0x35')],'phone':_0x5182ce[_0xfeab('0x32')][_0xfeab('0x3c')][_0xfeab('0x35')]});});}});}function request(_0x50935f){logger['debug'](_0xfeab('0x42'),JSON['stringify'](_0x50935f));return rp(_[_0xfeab('0x43')](def,_0x50935f));}function getTags(_0x22f3f1,_0x24a001){var _0x27eb65=[];if(_0x22f3f1&&_0x22f3f1[_0xfeab('0x1d')]>0x0){_0x27eb65=_[_0xfeab('0x44')](_0x22f3f1,_0x24a001);}return _0x27eb65;}function getCustomFields(_0x4e812a,_0x33107){var _0x2a4cbb=[];var _0x497764={'custom_fields':[]};if(_0x4e812a[_0xfeab('0x1d')]>0x0){_['forEach'](_0x4e812a,function(_0x3ceefd){if(_0x3ceefd[_0xfeab('0x45')]===_0xfeab('0x46')&&_0x3ceefd[_0xfeab('0x47')]&&!_0x3ceefd['customField']){_0x497764[_0x3ceefd[_0xfeab('0x47')][_0xfeab('0x48')]()]=_0x3ceefd[_0xfeab('0x49')]['toString']();}else if(_0x3ceefd[_0xfeab('0x45')]===_0xfeab('0x46')&&_0x3ceefd['idField']&&_0x3ceefd['customField']){_0x497764[_0xfeab('0x4a')]['push']({'id':_0x3ceefd[_0xfeab('0x21')],'value':_0x3ceefd[_0xfeab('0x49')][_0xfeab('0x29')]()});}else if(_0x3ceefd['type']===_0xfeab('0x4b')&&_0x3ceefd[_0xfeab('0x1f')]&&_0x3ceefd[_0xfeab('0x21')]&&_0x3ceefd[_0xfeab('0x4c')]){_0x33107[_0x3ceefd['variableName']]&&_0x497764['custom_fields'][_0xfeab('0x20')]({'id':_0x3ceefd[_0xfeab('0x21')],'value':_0x33107[_0x3ceefd[_0xfeab('0x1f')]]['toString']()});}else if(_0x3ceefd[_0xfeab('0x45')]===_0xfeab('0x4d')&&_0x3ceefd['Variable']&&_0x3ceefd[_0xfeab('0x4e')][_0xfeab('0xf')]&&_0x3ceefd['idField']&&_0x3ceefd['customField']){_0x33107[_0x3ceefd[_0xfeab('0x4e')]['name'][_0xfeab('0x48')]()]&&_0x497764[_0xfeab('0x4a')]['push']({'id':_0x3ceefd[_0xfeab('0x21')],'value':_0x33107[_0x3ceefd['Variable']['name']['toLowerCase']()][_0xfeab('0x29')]()});}});}return _0x497764;}function getConnection(_0xe58e60){return request({'method':_0xfeab('0xb'),'form':{'method':_0xfeab('0x4f'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0xfeab('0x24')]({'user_auth':{'user_name':_0xe58e60[_0xfeab('0x50')],'password':_0xe58e60['password'],'encryption':'PLAIN'},'application':_0xfeab('0x51')})}})[_0xfeab('0x31')](function(_0x12b23a){var _0x596e41=_0x12b23a;if(_0x596e41['id']){def[_0xfeab('0x52')]=_0x596e41['id'];return BPromise['resolve'](_0x596e41);}else{throw new Error(util[_0xfeab('0x26')](_0xfeab('0x53'),_0xe58e60['id']));}});}function setRelationship(_0x5a9276,_0x42955d,_0xb5e6cb,_0x588d19){return request({'form':{'method':_0xfeab('0x54'),'input_type':_0xfeab('0x23'),'response_type':_0xfeab('0x23'),'rest_data':JSON[_0xfeab('0x24')]({'session':_0x5a9276['id'],'module_name':'Calls','module_id':_0xb5e6cb['id'],'link_field_name':_0x588d19,'related_ids':[_0x42955d['id']],'name_value_list':[],'delete':0x0})}});}exports[_0xfeab('0x55')]=function(_0x239e88,_0x4dc440,_0x25434d,_0x1dd2ef,_0x5afe70,_0x2c6b9e){var _0x2c17cf,_0x1d94f4,_0x1d9ff0,_0x36a083;_0x2c6b9e[_0xfeab('0x56')]=intUtil[_0xfeab('0x57')](_0x2c6b9e[_0xfeab('0x56')]);_0x2c6b9e[_0xfeab('0x58')]=intUtil[_0xfeab('0x57')](_0x2c6b9e['serverUrl']);def[_0xfeab('0x59')]=util[_0xfeab('0x26')](_0xfeab('0x5a'),_0x2c6b9e[_0xfeab('0x56')]);if(_0x5afe70&&_0x5afe70['monitor_format']){logger[_0xfeab('0xd')]('[QUEUE]',_0xfeab('0x5b'));_0x4dc440[_0xfeab('0x5c')]=util[_0xfeab('0x26')](_0xfeab('0x5d'),_0x2c6b9e[_0xfeab('0x58')],_0x4dc440[_0xfeab('0x5e')],md5(_0x4dc440[_0xfeab('0x5e')]));}else{_0x4dc440[_0xfeab('0x5c')]='';}return getConnection(_0x2c6b9e)[_0xfeab('0x31')](function(_0x409856){_0x36a083=_0x409856;return getUser(_0x2c6b9e,_0x1dd2ef[_0xfeab('0xf')],_0x36a083);})[_0xfeab('0x31')](function(_0x284497){_0x2c17cf=_0x284497;logger[_0xfeab('0xd')](_0xfeab('0x5f'),_0x2c17cf['id']);return getEndUser(_0x2c6b9e,_0x4dc440['calleridname'],_0x4dc440[_0xfeab('0x60')],_0x36a083);})[_0xfeab('0x31')](function(_0x177711){_0x1d94f4=_0x177711;logger[_0xfeab('0xd')](_0xfeab('0x61'),_0x1d94f4['id']);return getTicket(_0x2c6b9e,_0x2c17cf,_0x1d94f4,_0x25434d,_0x4dc440,_0x25434d[_0xfeab('0x62')],_0x36a083,_0xfeab('0x63'));})[_0xfeab('0x31')](function(_0x4dc8fc){_0x1d9ff0=_0x4dc8fc;logger[_0xfeab('0xd')](_0xfeab('0x64'));logger[_0xfeab('0xd')](_0xfeab('0x65'),_0x1d9ff0['id']);return setRelationship(_0x36a083,_0x2c17cf,_0x1d9ff0,_0xfeab('0x66'));})['then'](function(){return setRelationship(_0x36a083,_0x1d94f4,_0x1d9ff0,'contacts');})['then'](function(){return getServerInfo(_0x36a083);})[_0xfeab('0x31')](function(_0x5c941e){var _0x503123=parseInt(_0x5c941e[_0xfeab('0x67')][_0xfeab('0x68')](0x0));var _0x537570=util[_0xfeab('0x26')](_0xfeab('0x69'),_0x2c6b9e['remoteUri'],_0x1d9ff0['id']);if(_0x503123>0x6){_0x537570=util[_0xfeab('0x26')](_0xfeab('0x6a'),_0x2c6b9e[_0xfeab('0x56')],_0x1d9ff0['id']);}logger['info'](_0xfeab('0x6b'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0xfeab('0x6c'),_0x1dd2ef['name']),_0xfeab('0x6d'),{'uri':_0x537570});})[_0xfeab('0x6e')](function(_0xf482f4){logger[_0xfeab('0x6f')](_0xfeab('0x6b'),JSON[_0xfeab('0x24')](_0xf482f4));});};exports['outbound']=function(_0x1cb86a,_0x3da3b2,_0xd56f06,_0x14967a,_0x4affaa,_0x298b89,_0x4a230e){var _0x5ced27,_0x34cde4,_0xb90fef,_0x30ad88;_0x298b89[_0xfeab('0x56')]=intUtil[_0xfeab('0x57')](_0x298b89[_0xfeab('0x56')]);_0x298b89[_0xfeab('0x58')]=intUtil[_0xfeab('0x57')](_0x298b89[_0xfeab('0x58')]);def[_0xfeab('0x59')]=util[_0xfeab('0x26')]('%s/service/v4_1/rest.php',_0x298b89[_0xfeab('0x56')]);if(_0x4a230e&&_0x4a230e['recordingFormat']&&_0x4a230e[_0xfeab('0x70')]!==_0xfeab('0x71')){logger[_0xfeab('0xd')](_0xfeab('0x72'),_0xfeab('0x5b'));_0x3da3b2['recordingURL']=util[_0xfeab('0x26')](_0xfeab('0x5d'),_0x298b89[_0xfeab('0x58')],_0x3da3b2[_0xfeab('0x5e')],md5(_0x3da3b2[_0xfeab('0x5e')]));}return getConnection(_0x298b89)['then'](function(_0x1b729b){_0x30ad88=_0x1b729b;return getUser(_0x298b89,_0x14967a[_0xfeab('0xf')],_0x30ad88);})[_0xfeab('0x31')](function(_0x236d2f){_0x5ced27=_0x236d2f;logger[_0xfeab('0xd')]('The\x20User\x20ID\x20is:',_0x5ced27['id']);return getEndUser(_0x298b89,_0x3da3b2[_0xfeab('0x73')],_0x3da3b2['destcalleridnum'],_0x30ad88);})[_0xfeab('0x31')](function(_0x253165){_0x34cde4=_0x253165;logger[_0xfeab('0xd')](_0xfeab('0x61'),_0x34cde4['id']);return getTicket(_0x298b89,_0x5ced27,_0x34cde4,_0xd56f06,_0x3da3b2,_0xd56f06[_0xfeab('0x62')],_0x30ad88,_0xfeab('0x74'));})[_0xfeab('0x31')](function(_0x4e71f3){_0xb90fef=_0x4e71f3;logger[_0xfeab('0xd')](_0xfeab('0x64'));logger['info'](_0xfeab('0x65'),_0xb90fef['id']);return setRelationship(_0x30ad88,_0x5ced27,_0xb90fef,_0xfeab('0x66'));})[_0xfeab('0x31')](function(){return setRelationship(_0x30ad88,_0x34cde4,_0xb90fef,'contacts');})[_0xfeab('0x31')](function(){return getServerInfo(_0x30ad88);})[_0xfeab('0x31')](function(_0x4e5722){var _0x321a8a=parseInt(_0x4e5722[_0xfeab('0x67')]['charAt'](0x0));var _0x52ece4=util[_0xfeab('0x26')](_0xfeab('0x69'),_0x298b89[_0xfeab('0x56')],_0xb90fef['id']);if(_0x321a8a>0x6){_0x52ece4=util[_0xfeab('0x26')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x298b89['remoteUri'],_0xb90fef['id']);}logger[_0xfeab('0xd')](_0xfeab('0x72'),_0xfeab('0x75'));emit(util['format'](_0xfeab('0x6c'),_0x14967a[_0xfeab('0xf')]),_0xfeab('0x6d'),{'uri':_0x52ece4});})[_0xfeab('0x6e')](function(_0x328752){logger['error'](_0xfeab('0x72'),JSON['stringify'](_0x328752));});};exports[_0xfeab('0x76')]=function(_0x3e05dc,_0x32215d,_0x487a67,_0x32b958,_0x584386,_0x5c8c7c){var _0x56d2a3,_0x42d65e,_0x19a699,_0x29f499;_0x5c8c7c[_0xfeab('0x56')]=intUtil['stripTrailingSlash'](_0x5c8c7c[_0xfeab('0x56')]);_0x5c8c7c[_0xfeab('0x58')]=intUtil[_0xfeab('0x57')](_0x5c8c7c['serverUrl']);def[_0xfeab('0x59')]=util[_0xfeab('0x26')](_0xfeab('0x5a'),_0x5c8c7c[_0xfeab('0x56')]);if(_0x584386&&_0x584386['monitor_format']){logger[_0xfeab('0xd')]('['+_0x32215d['lastevent'][_0xfeab('0x77')]()+']','Recording\x20is\x20enabled!');_0x32215d[_0xfeab('0x5c')]=util[_0xfeab('0x26')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5c8c7c[_0xfeab('0x58')],_0x32215d['uniqueid'],md5(_0x32215d[_0xfeab('0x5e')]));}else{_0x32215d['recordingURL']='';}return getConnection(_0x5c8c7c)[_0xfeab('0x31')](function(_0x4d35ad){_0x29f499=_0x4d35ad;if(!_['isNil'](_0x32b958)){return getUser(_0x5c8c7c,_0x32b958['name'],_0x29f499);}else{return getUser(_0x5c8c7c,null,_0x29f499);}})['then'](function(_0x2a4a6d){_0x56d2a3=_0x2a4a6d;logger[_0xfeab('0xd')]('The\x20User\x20ID\x20is:',_0x56d2a3['id']);return getEndUser(_0x5c8c7c,_0x32215d[_0xfeab('0x78')],_0x32215d[_0xfeab('0x60')],_0x29f499);})['then'](function(_0x5cc486){_0x42d65e=_0x5cc486;logger[_0xfeab('0xd')](_0xfeab('0x61'),_0x42d65e['id']);return getTicket(_0x5c8c7c,_0x56d2a3,_0x42d65e,_0x487a67,_0x32215d,_0x487a67[_0xfeab('0x62')],_0x29f499,_0xfeab('0x63'));})[_0xfeab('0x31')](function(_0x26965d){_0x19a699=_0x26965d;logger[_0xfeab('0xd')](_0xfeab('0x64'));logger[_0xfeab('0xd')](_0xfeab('0x65'),_0x19a699['id']);return setRelationship(_0x29f499,_0x56d2a3,_0x19a699,'users');})['then'](function(){return setRelationship(_0x29f499,_0x42d65e,_0x19a699,_0xfeab('0x79'));})[_0xfeab('0x31')](function(){return getServerInfo(_0x29f499);})[_0xfeab('0x6e')](function(_0x1225bd){logger['error']('['+_0x32215d[_0xfeab('0x7a')][_0xfeab('0x77')]()+']',JSON[_0xfeab('0x24')](_0x1225bd));});};
\ No newline at end of file
+var _0xa5d7=['request-promise','bluebird','md5','ioredis','../../../../config/environment','sugarcrm','defaults','redis','localhost','POST','emit','info','Creating\x20new\x20ticket...','name','getString','Subjects','description','Descriptions','date_start','toISOString','slice','replace','duration_hours','parent_id','parent_type','Contacts','parent_name','length','forEach','push','idField','set_entry','JSON','Calls','Basic\x20%s','toString','get_server_info','get_entry_list','stringify','Employees','format','user_name','entry_list','name_value_list','value','Agent\x20found!','resolve','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','then','find','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','<unknown>','Enduser\x20created.','debug','[HTTP]','merge','map','type','nameField','customField','toLowerCase','content','string','variableName','customVariable','Variable','custom_fields','login','username','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','remoteUri','stripTrailingSlash','serverUrl','%s/service/v4_1/rest.php','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','The\x20User\x20ID\x20is:','calleridname','Inbound','contacts','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','catch','error','outbound','uri','recordingFormat','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridnum','Fields','Outbound','The\x20Ticket\x20ID\x20is:','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','unmanaged','users','lastevent','toUpperCase','lodash'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xa5d7,0x1c3));var _0x7a5d=function(_0x907c23,_0x2d6267){_0x907c23=_0x907c23-0x0;var _0x18930d=_0xa5d7[_0x907c23];return _0x18930d;};'use strict';var _=require(_0x7a5d('0x0'));var rp=require(_0x7a5d('0x1'));var BPromise=require(_0x7a5d('0x2'));var md5=require(_0x7a5d('0x3'));var util=require('util');var Redis=require(_0x7a5d('0x4'));var intUtil=require('./util');var config=require(_0x7a5d('0x5'));var logger=require('../../../../config/logger')(_0x7a5d('0x6'));config['redis']=_[_0x7a5d('0x7')](config[_0x7a5d('0x8')],{'host':_0x7a5d('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x7a5d('0x8')]));var def={'method':_0x7a5d('0xa'),'json':!![]};function emit(_0x5e6442,_0x33aeaa,_0x5d793f){io['to'](_0x5e6442)[_0x7a5d('0xb')](_0x33aeaa,_0x5d793f);}function getTicket(_0x1057e5,_0x28b554,_0x58cb5d,_0x130ec4,_0x8f88a8,_0x25da61,_0xd91332,_0x593a68){logger[_0x7a5d('0xc')](_0x7a5d('0xd'));var _0x42d2cc=new Date();var _0x196db3=[{'name':_0x7a5d('0xe'),'value':intUtil[_0x7a5d('0xf')](_0x130ec4[_0x7a5d('0x10')],_0x8f88a8,'\x20')},{'name':'assigned_user_id','value':_0x28b554['id']},{'name':'created_by','value':_0x28b554['id']},{'name':_0x7a5d('0x11'),'value':intUtil['getString'](_0x130ec4[_0x7a5d('0x12')],_0x8f88a8,'\x0a')},{'name':_0x7a5d('0x13'),'value':_0x42d2cc[_0x7a5d('0x14')]()[_0x7a5d('0x15')](0x0,0x13)[_0x7a5d('0x16')]('T','\x20')},{'name':_0x7a5d('0x17'),'value':'0'},{'name':'duration_minutes','value':'15'},{'name':_0x7a5d('0x18'),'value':_0x58cb5d['id']},{'name':_0x7a5d('0x19'),'value':_0x7a5d('0x1a')},{'name':_0x7a5d('0x1b'),'value':_0x58cb5d[_0x7a5d('0xe')]},{'name':'direction','value':_0x593a68}];if(_0x25da61[_0x7a5d('0x1c')]){_[_0x7a5d('0x1d')](_0x25da61,function(_0x4af635){if(_0x8f88a8[_0x4af635['variableName']]){_0x196db3[_0x7a5d('0x1e')]({'name':_0x4af635[_0x7a5d('0x1f')],'value':_0x8f88a8[_0x4af635['variableName']]});}});}return request({'form':{'method':_0x7a5d('0x20'),'input_type':'JSON','response_type':_0x7a5d('0x21'),'rest_data':JSON['stringify']({'session':_0xd91332['id'],'module_name':_0x7a5d('0x22'),'name_value_list':_0x196db3})}});}function getAuth(_0x334d3d){return util['format'](_0x7a5d('0x23'),new Buffer(_0x334d3d['apiKey']+':X')[_0x7a5d('0x24')]('base64'));}function getServerInfo(_0x56183a){return request({'form':{'method':_0x7a5d('0x25'),'input_type':_0x7a5d('0x21'),'response_type':_0x7a5d('0x21'),'rest_data':JSON['stringify']({'session':_0x56183a['id']})}});}function getUser(_0x7b8ce1,_0x45377a,_0x1bd069){if(!_['isNil'](_0x45377a)){logger[_0x7a5d('0xc')]('Getting\x20agent\x20with\x20name',_0x45377a);return request({'form':{'method':_0x7a5d('0x26'),'input_type':_0x7a5d('0x21'),'response_type':_0x7a5d('0x21'),'rest_data':JSON[_0x7a5d('0x27')]({'session':_0x1bd069['id'],'module_name':_0x7a5d('0x28'),'query':util[_0x7a5d('0x29')]('INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200',_0x45377a),'order_by':'','offset':'0','select_fields':['id',_0x7a5d('0xe'),_0x7a5d('0x2a')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x1c33f5){if(_0x1c33f5[_0x7a5d('0x2b')][_0x7a5d('0x1c')]){var _0x72bedd=_['find'](_0x1c33f5[_0x7a5d('0x2b')],function(_0x2f922d){return _0x2f922d[_0x7a5d('0x2c')][_0x7a5d('0x2a')][_0x7a5d('0x2d')]===_0x45377a;});if(_0x72bedd){logger[_0x7a5d('0xc')](_0x7a5d('0x2e'));return BPromise[_0x7a5d('0x2f')]({'id':_0x72bedd['name_value_list']['id'][_0x7a5d('0x2d')],'name':_0x72bedd[_0x7a5d('0x2c')][_0x7a5d('0xe')][_0x7a5d('0x2d')]});}}logger[_0x7a5d('0xc')](_0x7a5d('0x30'));return BPromise[_0x7a5d('0x2f')]({'id':_0x1bd069[_0x7a5d('0x2c')][_0x7a5d('0x31')][_0x7a5d('0x2d')],'name':_0x1bd069[_0x7a5d('0x2c')][_0x7a5d('0x2a')][_0x7a5d('0x2d')]});});}else{logger[_0x7a5d('0xc')]('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise[_0x7a5d('0x2f')]({'id':_0x1bd069['name_value_list'][_0x7a5d('0x31')][_0x7a5d('0x2d')],'name':_0x1bd069[_0x7a5d('0x2c')]['user_name'][_0x7a5d('0x2d')]});}}function getEndUser(_0x1251ab,_0x358bba,_0x1966c2,_0x53789d){logger[_0x7a5d('0xc')](_0x7a5d('0x32'),_0x1966c2);return request({'form':{'method':_0x7a5d('0x26'),'input_type':_0x7a5d('0x21'),'response_type':_0x7a5d('0x21'),'rest_data':JSON[_0x7a5d('0x27')]({'session':_0x53789d['id'],'module_name':'Contacts','query':util[_0x7a5d('0x29')](_0x7a5d('0x33'),_0x1966c2),'order_by':'','offset':'0','select_fields':['id',_0x7a5d('0xe'),'phone_home'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x7a5d('0x34')](function(_0x2b5edf){if(_0x2b5edf[_0x7a5d('0x2b')][_0x7a5d('0x1c')]){var _0x305e61=_[_0x7a5d('0x35')](_0x2b5edf[_0x7a5d('0x2b')],function(_0x292055){return _0x292055[_0x7a5d('0x2c')][_0x7a5d('0x36')][_0x7a5d('0x2d')]===_0x1966c2;});if(_0x305e61){logger[_0x7a5d('0xc')](_0x7a5d('0x37'));return BPromise[_0x7a5d('0x2f')]({'id':_0x305e61['name_value_list']['id'][_0x7a5d('0x2d')],'name':_0x305e61[_0x7a5d('0x2c')][_0x7a5d('0xe')][_0x7a5d('0x2d')],'phone':_0x305e61[_0x7a5d('0x2c')][_0x7a5d('0x36')][_0x7a5d('0x2d')]});}}else{logger[_0x7a5d('0xc')](_0x7a5d('0x38'));return request({'form':{'method':'set_entry','input_type':_0x7a5d('0x21'),'response_type':'JSON','rest_data':JSON[_0x7a5d('0x27')]({'session':_0x53789d['id'],'module_name':'Contacts','name_value_list':[{'name':_0x7a5d('0x39'),'value':_0x358bba!==_0x7a5d('0x3a')?_0x358bba:util[_0x7a5d('0x29')]('Caller\x20-\x20%s',_0x1966c2)},{'name':_0x7a5d('0x36'),'value':_0x1966c2}]})}})['then'](function(_0x5b669f){logger[_0x7a5d('0xc')](_0x7a5d('0x3b'));return BPromise['resolve']({'id':_0x5b669f['id'],'name':_0x5b669f[_0x7a5d('0x2b')][_0x7a5d('0x39')][_0x7a5d('0x2d')],'phone':_0x5b669f['entry_list'][_0x7a5d('0x36')][_0x7a5d('0x2d')]});});}});}function request(_0x4cadfe){logger[_0x7a5d('0x3c')](_0x7a5d('0x3d'),JSON[_0x7a5d('0x27')](_0x4cadfe));return rp(_[_0x7a5d('0x3e')](def,_0x4cadfe));}function getTags(_0x42f33e,_0x3bf875){var _0x33f5b9=[];if(_0x42f33e&&_0x42f33e['length']>0x0){_0x33f5b9=_[_0x7a5d('0x3f')](_0x42f33e,_0x3bf875);}return _0x33f5b9;}function getCustomFields(_0x425381,_0x391313){var _0x2248f1=[];var _0x1170c9={'custom_fields':[]};if(_0x425381[_0x7a5d('0x1c')]>0x0){_[_0x7a5d('0x1d')](_0x425381,function(_0x2cf395){if(_0x2cf395[_0x7a5d('0x40')]==='string'&&_0x2cf395[_0x7a5d('0x41')]&&!_0x2cf395[_0x7a5d('0x42')]){_0x1170c9[_0x2cf395[_0x7a5d('0x41')][_0x7a5d('0x43')]()]=_0x2cf395[_0x7a5d('0x44')][_0x7a5d('0x24')]();}else if(_0x2cf395['type']===_0x7a5d('0x45')&&_0x2cf395[_0x7a5d('0x1f')]&&_0x2cf395[_0x7a5d('0x42')]){_0x1170c9['custom_fields'][_0x7a5d('0x1e')]({'id':_0x2cf395[_0x7a5d('0x1f')],'value':_0x2cf395['content'][_0x7a5d('0x24')]()});}else if(_0x2cf395[_0x7a5d('0x40')]==='variable'&&_0x2cf395[_0x7a5d('0x46')]&&_0x2cf395['idField']&&_0x2cf395[_0x7a5d('0x42')]){_0x391313[_0x2cf395[_0x7a5d('0x46')]]&&_0x1170c9['custom_fields'][_0x7a5d('0x1e')]({'id':_0x2cf395['idField'],'value':_0x391313[_0x2cf395[_0x7a5d('0x46')]][_0x7a5d('0x24')]()});}else if(_0x2cf395[_0x7a5d('0x40')]===_0x7a5d('0x47')&&_0x2cf395[_0x7a5d('0x48')]&&_0x2cf395[_0x7a5d('0x48')][_0x7a5d('0xe')]&&_0x2cf395[_0x7a5d('0x1f')]&&_0x2cf395['customField']){_0x391313[_0x2cf395[_0x7a5d('0x48')][_0x7a5d('0xe')][_0x7a5d('0x43')]()]&&_0x1170c9[_0x7a5d('0x49')]['push']({'id':_0x2cf395[_0x7a5d('0x1f')],'value':_0x391313[_0x2cf395[_0x7a5d('0x48')][_0x7a5d('0xe')][_0x7a5d('0x43')]()]['toString']()});}});}return _0x1170c9;}function getConnection(_0x255d90){return request({'method':'POST','form':{'method':_0x7a5d('0x4a'),'input_type':_0x7a5d('0x21'),'response_type':'JSON','rest_data':JSON['stringify']({'user_auth':{'user_name':_0x255d90[_0x7a5d('0x4b')],'password':_0x255d90[_0x7a5d('0x4c')],'encryption':_0x7a5d('0x4d')},'application':_0x7a5d('0x4e')})}})[_0x7a5d('0x34')](function(_0x50f589){var _0x151d9a=_0x50f589;if(_0x151d9a['id']){def[_0x7a5d('0x4f')]=_0x151d9a['id'];return BPromise[_0x7a5d('0x2f')](_0x151d9a);}else{throw new Error(util[_0x7a5d('0x29')](_0x7a5d('0x50'),_0x255d90['id']));}});}function setRelationship(_0x110b3b,_0x13f598,_0x1c60aa,_0x4630b4){return request({'form':{'method':_0x7a5d('0x51'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0x7a5d('0x27')]({'session':_0x110b3b['id'],'module_name':_0x7a5d('0x22'),'module_id':_0x1c60aa['id'],'link_field_name':_0x4630b4,'related_ids':[_0x13f598['id']],'name_value_list':[],'delete':0x0})}});}exports['queue']=function(_0x24e989,_0x84cbf,_0x410e26,_0x3e0e3b,_0x3c91d2,_0x1d62e8){var _0x5099cc,_0x14366e,_0xc05cda,_0x540ca4;_0x1d62e8[_0x7a5d('0x52')]=intUtil[_0x7a5d('0x53')](_0x1d62e8['remoteUri']);_0x1d62e8[_0x7a5d('0x54')]=intUtil['stripTrailingSlash'](_0x1d62e8['serverUrl']);def['uri']=util[_0x7a5d('0x29')](_0x7a5d('0x55'),_0x1d62e8[_0x7a5d('0x52')]);if(_0x3c91d2&&_0x3c91d2['monitor_format']){logger[_0x7a5d('0xc')](_0x7a5d('0x56'),_0x7a5d('0x57'));_0x84cbf[_0x7a5d('0x58')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1d62e8[_0x7a5d('0x54')],_0x84cbf[_0x7a5d('0x59')],md5(_0x84cbf[_0x7a5d('0x59')]));}else{_0x84cbf[_0x7a5d('0x58')]='';}return getConnection(_0x1d62e8)[_0x7a5d('0x34')](function(_0x44c0ad){_0x540ca4=_0x44c0ad;return getUser(_0x1d62e8,_0x3e0e3b['name'],_0x540ca4);})[_0x7a5d('0x34')](function(_0x34d739){_0x5099cc=_0x34d739;logger[_0x7a5d('0xc')](_0x7a5d('0x5a'),_0x5099cc['id']);return getEndUser(_0x1d62e8,_0x84cbf[_0x7a5d('0x5b')],_0x84cbf['calleridnum'],_0x540ca4);})[_0x7a5d('0x34')](function(_0x4b1abd){_0x14366e=_0x4b1abd;logger[_0x7a5d('0xc')]('The\x20Enduser\x20ID\x20is:',_0x14366e['id']);return getTicket(_0x1d62e8,_0x5099cc,_0x14366e,_0x410e26,_0x84cbf,_0x410e26['Fields'],_0x540ca4,_0x7a5d('0x5c'));})[_0x7a5d('0x34')](function(_0x12b36e){_0xc05cda=_0x12b36e;logger[_0x7a5d('0xc')]('Ticket\x20created!');logger[_0x7a5d('0xc')]('The\x20Ticket\x20ID\x20is:',_0xc05cda['id']);return setRelationship(_0x540ca4,_0x5099cc,_0xc05cda,'users');})[_0x7a5d('0x34')](function(){return setRelationship(_0x540ca4,_0x14366e,_0xc05cda,_0x7a5d('0x5d'));})['then'](function(){return getServerInfo(_0x540ca4);})[_0x7a5d('0x34')](function(_0x4c8fdc){var _0x11fc99=parseInt(_0x4c8fdc['version']['charAt'](0x0));var _0x59cdbb=util[_0x7a5d('0x29')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x1d62e8[_0x7a5d('0x52')],_0xc05cda['id']);if(_0x11fc99>0x6){_0x59cdbb=util[_0x7a5d('0x29')](_0x7a5d('0x5e'),_0x1d62e8['remoteUri'],_0xc05cda['id']);}logger[_0x7a5d('0xc')](_0x7a5d('0x56'),_0x7a5d('0x5f'));emit(util[_0x7a5d('0x29')]('user:%s',_0x3e0e3b[_0x7a5d('0xe')]),_0x7a5d('0x60'),{'uri':_0x59cdbb});})[_0x7a5d('0x61')](function(_0x427644){logger[_0x7a5d('0x62')](_0x7a5d('0x56'),JSON[_0x7a5d('0x27')](_0x427644));});};exports[_0x7a5d('0x63')]=function(_0x1d7e7e,_0x4348bf,_0x27247a,_0x29c612,_0x357556,_0x408c0e,_0x2ff2d2){var _0x3b263c,_0x2d2355,_0x21e1d1,_0x37c3fe;_0x408c0e[_0x7a5d('0x52')]=intUtil['stripTrailingSlash'](_0x408c0e[_0x7a5d('0x52')]);_0x408c0e[_0x7a5d('0x54')]=intUtil['stripTrailingSlash'](_0x408c0e[_0x7a5d('0x54')]);def[_0x7a5d('0x64')]=util[_0x7a5d('0x29')](_0x7a5d('0x55'),_0x408c0e[_0x7a5d('0x52')]);if(_0x2ff2d2&&_0x2ff2d2[_0x7a5d('0x65')]&&_0x2ff2d2[_0x7a5d('0x65')]!=='none'){logger[_0x7a5d('0xc')](_0x7a5d('0x66'),_0x7a5d('0x57'));_0x4348bf[_0x7a5d('0x58')]=util[_0x7a5d('0x29')](_0x7a5d('0x67'),_0x408c0e[_0x7a5d('0x54')],_0x4348bf['uniqueid'],md5(_0x4348bf['uniqueid']));}return getConnection(_0x408c0e)[_0x7a5d('0x34')](function(_0x1a6668){_0x37c3fe=_0x1a6668;return getUser(_0x408c0e,_0x29c612[_0x7a5d('0xe')],_0x37c3fe);})[_0x7a5d('0x34')](function(_0x5b3e3d){_0x3b263c=_0x5b3e3d;logger[_0x7a5d('0xc')]('The\x20User\x20ID\x20is:',_0x3b263c['id']);return getEndUser(_0x408c0e,_0x4348bf['destcalleridname'],_0x4348bf[_0x7a5d('0x68')],_0x37c3fe);})[_0x7a5d('0x34')](function(_0x5a7db5){_0x2d2355=_0x5a7db5;logger[_0x7a5d('0xc')]('The\x20Enduser\x20ID\x20is:',_0x2d2355['id']);return getTicket(_0x408c0e,_0x3b263c,_0x2d2355,_0x27247a,_0x4348bf,_0x27247a[_0x7a5d('0x69')],_0x37c3fe,_0x7a5d('0x6a'));})[_0x7a5d('0x34')](function(_0xd450bc){_0x21e1d1=_0xd450bc;logger[_0x7a5d('0xc')]('Ticket\x20created!');logger['info'](_0x7a5d('0x6b'),_0x21e1d1['id']);return setRelationship(_0x37c3fe,_0x3b263c,_0x21e1d1,'users');})[_0x7a5d('0x34')](function(){return setRelationship(_0x37c3fe,_0x2d2355,_0x21e1d1,_0x7a5d('0x5d'));})['then'](function(){return getServerInfo(_0x37c3fe);})[_0x7a5d('0x34')](function(_0x2c65a9){var _0x33e36c=parseInt(_0x2c65a9['version']['charAt'](0x0));var _0x54f2a8=util['format'](_0x7a5d('0x6c'),_0x408c0e[_0x7a5d('0x52')],_0x21e1d1['id']);if(_0x33e36c>0x6){_0x54f2a8=util[_0x7a5d('0x29')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x408c0e[_0x7a5d('0x52')],_0x21e1d1['id']);}logger[_0x7a5d('0xc')](_0x7a5d('0x66'),_0x7a5d('0x5f'));emit(util[_0x7a5d('0x29')]('user:%s',_0x29c612[_0x7a5d('0xe')]),_0x7a5d('0x60'),{'uri':_0x54f2a8});})[_0x7a5d('0x61')](function(_0x2ddfff){logger[_0x7a5d('0x62')](_0x7a5d('0x66'),JSON['stringify'](_0x2ddfff));});};exports[_0x7a5d('0x6d')]=function(_0x5a844e,_0x5a2840,_0xc041b2,_0x66b40c,_0x375c3e,_0x598e65){var _0x20b292,_0x477169,_0x4b5041,_0x204b72;_0x598e65[_0x7a5d('0x52')]=intUtil['stripTrailingSlash'](_0x598e65['remoteUri']);_0x598e65[_0x7a5d('0x54')]=intUtil[_0x7a5d('0x53')](_0x598e65[_0x7a5d('0x54')]);def[_0x7a5d('0x64')]=util['format']('%s/service/v4_1/rest.php',_0x598e65[_0x7a5d('0x52')]);if(_0x375c3e&&_0x375c3e['monitor_format']){logger[_0x7a5d('0xc')]('['+_0x5a2840['lastevent']['toUpperCase']()+']',_0x7a5d('0x57'));_0x5a2840['recordingURL']=util[_0x7a5d('0x29')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x598e65['serverUrl'],_0x5a2840[_0x7a5d('0x59')],md5(_0x5a2840[_0x7a5d('0x59')]));}else{_0x5a2840[_0x7a5d('0x58')]='';}return getConnection(_0x598e65)['then'](function(_0x56a03f){_0x204b72=_0x56a03f;if(!_['isNil'](_0x66b40c)){return getUser(_0x598e65,_0x66b40c['name'],_0x204b72);}else{return getUser(_0x598e65,null,_0x204b72);}})[_0x7a5d('0x34')](function(_0x45fa9e){_0x20b292=_0x45fa9e;logger[_0x7a5d('0xc')](_0x7a5d('0x5a'),_0x20b292['id']);return getEndUser(_0x598e65,_0x5a2840[_0x7a5d('0x5b')],_0x5a2840['calleridnum'],_0x204b72);})[_0x7a5d('0x34')](function(_0x495870){_0x477169=_0x495870;logger[_0x7a5d('0xc')]('The\x20Enduser\x20ID\x20is:',_0x477169['id']);return getTicket(_0x598e65,_0x20b292,_0x477169,_0xc041b2,_0x5a2840,_0xc041b2[_0x7a5d('0x69')],_0x204b72,_0x7a5d('0x5c'));})[_0x7a5d('0x34')](function(_0x5d5e22){_0x4b5041=_0x5d5e22;logger['info']('Ticket\x20created!');logger[_0x7a5d('0xc')]('The\x20Ticket\x20ID\x20is:',_0x4b5041['id']);return setRelationship(_0x204b72,_0x20b292,_0x4b5041,_0x7a5d('0x6e'));})[_0x7a5d('0x34')](function(){return setRelationship(_0x204b72,_0x477169,_0x4b5041,_0x7a5d('0x5d'));})[_0x7a5d('0x34')](function(){return getServerInfo(_0x204b72);})[_0x7a5d('0x61')](function(_0xd9fa44){logger[_0x7a5d('0x62')]('['+_0x5a2840[_0x7a5d('0x6f')][_0x7a5d('0x70')]()+']',JSON[_0x7a5d('0x27')](_0xd9fa44));});};
\ No newline at end of file