Built motion from commit 511216ff.|2.6.34
[motion2.git] / server / services / ami / trigger / integration / sugarcrm.js
index a0c5a8a..9c42415 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2d37=['getString','Subjects','created_by','Descriptions','date_start','slice','replace','duration_hours','duration_minutes','parent_id','parent_type','Contacts','parent_name','direction','length','forEach','push','set_entry','JSON','format','Basic\x20%s','toString','base64','get_server_info','stringify','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','Agent\x20found!','resolve','value','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','<unknown>','Caller\x20-\x20%s','Enduser\x20created.','debug','[HTTP]','merge','map','type','string','nameField','customField','toLowerCase','content','idField','variableName','Variable','POST','login','username','password','set_relationship','Calls','queue','stripTrailingSlash','remoteUri','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','contacts','version','charAt','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','user:%s','trigger:browser:url','catch','error','outbound','recordingFormat','none','destcalleridnum','Outbound','[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','lastevent','toUpperCase','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','isNil','lodash','md5','./util','../../../../config/environment','../../../../config/logger','redis','localhost','socket.io-emitter','emit','info','Creating\x20new\x20ticket...','name'];(function(_0x4cf8bb,_0x12c8fe){var _0x555be3=function(_0x31c2e8){while(--_0x31c2e8){_0x4cf8bb['push'](_0x4cf8bb['shift']());}};_0x555be3(++_0x12c8fe);}(_0x2d37,0xe0));var _0x72d3=function(_0x39b552,_0x2949ea){_0x39b552=_0x39b552-0x0;var _0x35d4d1=_0x2d37[_0x39b552];return _0x35d4d1;};'use strict';var _=require(_0x72d3('0x0'));var rp=require('request-promise');var BPromise=require('bluebird');var md5=require(_0x72d3('0x1'));var util=require('util');var Redis=require('ioredis');var intUtil=require(_0x72d3('0x2'));var config=require(_0x72d3('0x3'));var logger=require(_0x72d3('0x4'))('sugarcrm');config[_0x72d3('0x5')]=_['defaults'](config[_0x72d3('0x5')],{'host':_0x72d3('0x6'),'port':0x18eb});var io=require(_0x72d3('0x7'))(new Redis(config[_0x72d3('0x5')]));var def={'method':'POST','json':!![]};function emit(_0x17e907,_0x72dba8,_0x3f3503){io['to'](_0x17e907)[_0x72d3('0x8')](_0x72dba8,_0x3f3503);}function getTicket(_0x5da36a,_0x5b511a,_0x3f9a85,_0xf7710c,_0x333b2e,_0x36fd57,_0x3f8701,_0x1f5d65){logger[_0x72d3('0x9')](_0x72d3('0xa'));var _0x36bc1=new Date();var _0x1e770b=[{'name':_0x72d3('0xb'),'value':intUtil[_0x72d3('0xc')](_0xf7710c[_0x72d3('0xd')],_0x333b2e,'\x20')},{'name':'assigned_user_id','value':_0x5b511a['id']},{'name':_0x72d3('0xe'),'value':_0x5b511a['id']},{'name':'description','value':intUtil[_0x72d3('0xc')](_0xf7710c[_0x72d3('0xf')],_0x333b2e,'\x0a')},{'name':_0x72d3('0x10'),'value':_0x36bc1['toISOString']()[_0x72d3('0x11')](0x0,0x13)[_0x72d3('0x12')]('T','\x20')},{'name':_0x72d3('0x13'),'value':'0'},{'name':_0x72d3('0x14'),'value':'15'},{'name':_0x72d3('0x15'),'value':_0x3f9a85['id']},{'name':_0x72d3('0x16'),'value':_0x72d3('0x17')},{'name':_0x72d3('0x18'),'value':_0x3f9a85[_0x72d3('0xb')]},{'name':_0x72d3('0x19'),'value':_0x1f5d65}];if(_0x36fd57[_0x72d3('0x1a')]){_[_0x72d3('0x1b')](_0x36fd57,function(_0x28af10){if(_0x333b2e[_0x28af10['variableName']]){_0x1e770b[_0x72d3('0x1c')]({'name':_0x28af10['idField'],'value':_0x333b2e[_0x28af10['variableName']]});}});}return request({'form':{'method':_0x72d3('0x1d'),'input_type':'JSON','response_type':_0x72d3('0x1e'),'rest_data':JSON['stringify']({'session':_0x3f8701['id'],'module_name':'Calls','name_value_list':_0x1e770b})}});}function getAuth(_0x40e399){return util[_0x72d3('0x1f')](_0x72d3('0x20'),new Buffer(_0x40e399['apiKey']+':X')[_0x72d3('0x21')](_0x72d3('0x22')));}function getServerInfo(_0x45fd45){return request({'form':{'method':_0x72d3('0x23'),'input_type':'JSON','response_type':_0x72d3('0x1e'),'rest_data':JSON[_0x72d3('0x24')]({'session':_0x45fd45['id']})}});}function getUser(_0x4e9406,_0x391998,_0x30295e){if(!_['isNil'](_0x391998)){logger['info'](_0x72d3('0x25'),_0x391998);return request({'form':{'method':_0x72d3('0x26'),'input_type':_0x72d3('0x1e'),'response_type':_0x72d3('0x1e'),'rest_data':JSON['stringify']({'session':_0x30295e['id'],'module_name':_0x72d3('0x27'),'query':util['format'](_0x72d3('0x28'),_0x391998),'order_by':'','offset':'0','select_fields':['id','name',_0x72d3('0x29')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x72d3('0x2a')](function(_0xaafe53){if(_0xaafe53[_0x72d3('0x2b')][_0x72d3('0x1a')]){var _0x33fc64=_[_0x72d3('0x2c')](_0xaafe53[_0x72d3('0x2b')],function(_0x3be408){return _0x3be408[_0x72d3('0x2d')][_0x72d3('0x29')]['value']===_0x391998;});if(_0x33fc64){logger[_0x72d3('0x9')](_0x72d3('0x2e'));return BPromise[_0x72d3('0x2f')]({'id':_0x33fc64[_0x72d3('0x2d')]['id'][_0x72d3('0x30')],'name':_0x33fc64[_0x72d3('0x2d')][_0x72d3('0xb')][_0x72d3('0x30')]});}}logger[_0x72d3('0x9')](_0x72d3('0x31'));return BPromise[_0x72d3('0x2f')]({'id':_0x30295e[_0x72d3('0x2d')]['user_id']['value'],'name':_0x30295e['name_value_list'][_0x72d3('0x29')]['value']});});}else{logger[_0x72d3('0x9')]('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise['resolve']({'id':_0x30295e[_0x72d3('0x2d')][_0x72d3('0x32')][_0x72d3('0x30')],'name':_0x30295e[_0x72d3('0x2d')][_0x72d3('0x29')][_0x72d3('0x30')]});}}function getEndUser(_0x48d306,_0x935a7d,_0x6ba79d,_0x1beddc){logger[_0x72d3('0x9')](_0x72d3('0x33'),_0x6ba79d);return request({'form':{'method':_0x72d3('0x26'),'input_type':'JSON','response_type':_0x72d3('0x1e'),'rest_data':JSON['stringify']({'session':_0x1beddc['id'],'module_name':'Contacts','query':util['format'](_0x72d3('0x34'),_0x6ba79d),'order_by':'','offset':'0','select_fields':['id','name',_0x72d3('0x35')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x865ce){if(_0x865ce[_0x72d3('0x2b')][_0x72d3('0x1a')]){var _0x575e4c=_[_0x72d3('0x2c')](_0x865ce[_0x72d3('0x2b')],function(_0xd67a08){return _0xd67a08[_0x72d3('0x2d')][_0x72d3('0x35')][_0x72d3('0x30')]===_0x6ba79d;});if(_0x575e4c){logger[_0x72d3('0x9')](_0x72d3('0x36'));return BPromise[_0x72d3('0x2f')]({'id':_0x575e4c['name_value_list']['id'][_0x72d3('0x30')],'name':_0x575e4c[_0x72d3('0x2d')][_0x72d3('0xb')]['value'],'phone':_0x575e4c[_0x72d3('0x2d')][_0x72d3('0x35')][_0x72d3('0x30')]});}}else{logger[_0x72d3('0x9')](_0x72d3('0x37'));return request({'form':{'method':_0x72d3('0x1d'),'input_type':_0x72d3('0x1e'),'response_type':'JSON','rest_data':JSON[_0x72d3('0x24')]({'session':_0x1beddc['id'],'module_name':_0x72d3('0x17'),'name_value_list':[{'name':_0x72d3('0x38'),'value':_0x935a7d!==_0x72d3('0x39')?_0x935a7d:util['format'](_0x72d3('0x3a'),_0x6ba79d)},{'name':_0x72d3('0x35'),'value':_0x6ba79d}]})}})[_0x72d3('0x2a')](function(_0xe2cc52){logger[_0x72d3('0x9')](_0x72d3('0x3b'));return BPromise[_0x72d3('0x2f')]({'id':_0xe2cc52['id'],'name':_0xe2cc52[_0x72d3('0x2b')]['first_name'][_0x72d3('0x30')],'phone':_0xe2cc52['entry_list'][_0x72d3('0x35')][_0x72d3('0x30')]});});}});}function request(_0x47905f){logger[_0x72d3('0x3c')](_0x72d3('0x3d'),JSON[_0x72d3('0x24')](_0x47905f));return rp(_[_0x72d3('0x3e')](def,_0x47905f));}function getTags(_0x10874c,_0x14be40){var _0x4f766e=[];if(_0x10874c&&_0x10874c['length']>0x0){_0x4f766e=_[_0x72d3('0x3f')](_0x10874c,_0x14be40);}return _0x4f766e;}function getCustomFields(_0xf1b214,_0x27be34){var _0x5bde4a=[];var _0x4442b9={'custom_fields':[]};if(_0xf1b214[_0x72d3('0x1a')]>0x0){_[_0x72d3('0x1b')](_0xf1b214,function(_0x41d5aa){if(_0x41d5aa[_0x72d3('0x40')]===_0x72d3('0x41')&&_0x41d5aa[_0x72d3('0x42')]&&!_0x41d5aa[_0x72d3('0x43')]){_0x4442b9[_0x41d5aa[_0x72d3('0x42')][_0x72d3('0x44')]()]=_0x41d5aa[_0x72d3('0x45')][_0x72d3('0x21')]();}else if(_0x41d5aa['type']==='string'&&_0x41d5aa[_0x72d3('0x46')]&&_0x41d5aa[_0x72d3('0x43')]){_0x4442b9['custom_fields']['push']({'id':_0x41d5aa['idField'],'value':_0x41d5aa[_0x72d3('0x45')][_0x72d3('0x21')]()});}else if(_0x41d5aa['type']==='variable'&&_0x41d5aa['variableName']&&_0x41d5aa[_0x72d3('0x46')]&&_0x41d5aa['customField']){_0x27be34[_0x41d5aa[_0x72d3('0x47')]]&&_0x4442b9['custom_fields']['push']({'id':_0x41d5aa[_0x72d3('0x46')],'value':_0x27be34[_0x41d5aa['variableName']][_0x72d3('0x21')]()});}else if(_0x41d5aa[_0x72d3('0x40')]==='customVariable'&&_0x41d5aa['Variable']&&_0x41d5aa[_0x72d3('0x48')][_0x72d3('0xb')]&&_0x41d5aa[_0x72d3('0x46')]&&_0x41d5aa[_0x72d3('0x43')]){_0x27be34[_0x41d5aa[_0x72d3('0x48')][_0x72d3('0xb')][_0x72d3('0x44')]()]&&_0x4442b9['custom_fields'][_0x72d3('0x1c')]({'id':_0x41d5aa[_0x72d3('0x46')],'value':_0x27be34[_0x41d5aa[_0x72d3('0x48')]['name'][_0x72d3('0x44')]()][_0x72d3('0x21')]()});}});}return _0x4442b9;}function getConnection(_0x168f3a){return request({'method':_0x72d3('0x49'),'form':{'method':_0x72d3('0x4a'),'input_type':_0x72d3('0x1e'),'response_type':'JSON','rest_data':JSON['stringify']({'user_auth':{'user_name':_0x168f3a[_0x72d3('0x4b')],'password':_0x168f3a[_0x72d3('0x4c')],'encryption':'PLAIN'},'application':'xCALLY\x20Motion\x20integration'})}})[_0x72d3('0x2a')](function(_0x32810a){var _0x523fc4=_0x32810a;if(_0x523fc4['id']){def['sessionID']=_0x523fc4['id'];return BPromise[_0x72d3('0x2f')](_0x523fc4);}else{throw new Error(util[_0x72d3('0x1f')]('Account\x20%d\x20is\x20not\x20valid',_0x168f3a['id']));}});}function setRelationship(_0x5cae47,_0x40de4e,_0x2061f1,_0x973243){return request({'form':{'method':_0x72d3('0x4d'),'input_type':_0x72d3('0x1e'),'response_type':_0x72d3('0x1e'),'rest_data':JSON[_0x72d3('0x24')]({'session':_0x5cae47['id'],'module_name':_0x72d3('0x4e'),'module_id':_0x2061f1['id'],'link_field_name':_0x973243,'related_ids':[_0x40de4e['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x72d3('0x4f')]=function(_0x3b6a19,_0x119c74,_0x112633,_0x38ca23,_0x206b66,_0x1950a5){var _0x54f3b5,_0x5e2f23,_0x48cf67,_0x448c24;_0x1950a5['remoteUri']=intUtil[_0x72d3('0x50')](_0x1950a5[_0x72d3('0x51')]);_0x1950a5[_0x72d3('0x52')]=intUtil[_0x72d3('0x50')](_0x1950a5[_0x72d3('0x52')]);def[_0x72d3('0x53')]=util['format'](_0x72d3('0x54'),_0x1950a5[_0x72d3('0x51')]);if(_0x206b66&&_0x206b66[_0x72d3('0x55')]){logger['info'](_0x72d3('0x56'),_0x72d3('0x57'));_0x119c74[_0x72d3('0x58')]=util[_0x72d3('0x1f')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1950a5[_0x72d3('0x52')],_0x119c74[_0x72d3('0x59')],md5(_0x119c74[_0x72d3('0x59')]));}else{_0x119c74[_0x72d3('0x58')]='';}return getConnection(_0x1950a5)[_0x72d3('0x2a')](function(_0x60cd04){_0x448c24=_0x60cd04;return getUser(_0x1950a5,_0x38ca23[_0x72d3('0xb')],_0x448c24);})[_0x72d3('0x2a')](function(_0x29da50){_0x54f3b5=_0x29da50;logger['info'](_0x72d3('0x5a'),_0x54f3b5['id']);return getEndUser(_0x1950a5,_0x119c74[_0x72d3('0x5b')],_0x119c74[_0x72d3('0x5c')],_0x448c24);})[_0x72d3('0x2a')](function(_0x4c9657){_0x5e2f23=_0x4c9657;logger[_0x72d3('0x9')](_0x72d3('0x5d'),_0x5e2f23['id']);return getTicket(_0x1950a5,_0x54f3b5,_0x5e2f23,_0x112633,_0x119c74,_0x112633[_0x72d3('0x5e')],_0x448c24,_0x72d3('0x5f'));})[_0x72d3('0x2a')](function(_0xd25de5){_0x48cf67=_0xd25de5;logger[_0x72d3('0x9')](_0x72d3('0x60'));logger[_0x72d3('0x9')](_0x72d3('0x61'),_0x48cf67['id']);return setRelationship(_0x448c24,_0x54f3b5,_0x48cf67,_0x72d3('0x62'));})['then'](function(){return setRelationship(_0x448c24,_0x5e2f23,_0x48cf67,_0x72d3('0x63'));})[_0x72d3('0x2a')](function(){return getServerInfo(_0x448c24);})['then'](function(_0x577415){var _0x30d2b9=parseInt(_0x577415[_0x72d3('0x64')][_0x72d3('0x65')](0x0));var _0x4dba58=util[_0x72d3('0x1f')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x1950a5[_0x72d3('0x51')],_0x48cf67['id']);if(_0x30d2b9>0x6){_0x4dba58=util[_0x72d3('0x1f')](_0x72d3('0x66'),_0x1950a5[_0x72d3('0x51')],_0x48cf67['id']);}logger[_0x72d3('0x9')](_0x72d3('0x56'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0x72d3('0x67'),_0x38ca23[_0x72d3('0xb')]),_0x72d3('0x68'),{'uri':_0x4dba58});})[_0x72d3('0x69')](function(_0x5041e6){logger[_0x72d3('0x6a')](_0x72d3('0x56'),JSON['stringify'](_0x5041e6));});};exports[_0x72d3('0x6b')]=function(_0x5ebd5e,_0x2a0fc0,_0xd9e252,_0x12cca8,_0x5243b2,_0x201980,_0x2cc9d0){var _0x56b27a,_0x40279d,_0x3c3d25,_0x1bda1c;_0x201980[_0x72d3('0x51')]=intUtil[_0x72d3('0x50')](_0x201980[_0x72d3('0x51')]);_0x201980[_0x72d3('0x52')]=intUtil[_0x72d3('0x50')](_0x201980['serverUrl']);def[_0x72d3('0x53')]=util[_0x72d3('0x1f')]('%s/service/v4_1/rest.php',_0x201980[_0x72d3('0x51')]);if(_0x2cc9d0&&_0x2cc9d0[_0x72d3('0x6c')]&&_0x2cc9d0['recordingFormat']!==_0x72d3('0x6d')){logger[_0x72d3('0x9')]('[OUTBOUND]',_0x72d3('0x57'));_0x2a0fc0[_0x72d3('0x58')]=util[_0x72d3('0x1f')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x201980[_0x72d3('0x52')],_0x2a0fc0[_0x72d3('0x59')],md5(_0x2a0fc0[_0x72d3('0x59')]));}return getConnection(_0x201980)['then'](function(_0x119d61){_0x1bda1c=_0x119d61;return getUser(_0x201980,_0x12cca8[_0x72d3('0xb')],_0x1bda1c);})[_0x72d3('0x2a')](function(_0x359cfc){_0x56b27a=_0x359cfc;logger[_0x72d3('0x9')]('The\x20User\x20ID\x20is:',_0x56b27a['id']);return getEndUser(_0x201980,_0x2a0fc0['destcalleridname'],_0x2a0fc0[_0x72d3('0x6e')],_0x1bda1c);})[_0x72d3('0x2a')](function(_0x340875){_0x40279d=_0x340875;logger[_0x72d3('0x9')](_0x72d3('0x5d'),_0x40279d['id']);return getTicket(_0x201980,_0x56b27a,_0x40279d,_0xd9e252,_0x2a0fc0,_0xd9e252['Fields'],_0x1bda1c,_0x72d3('0x6f'));})[_0x72d3('0x2a')](function(_0x2f59b8){_0x3c3d25=_0x2f59b8;logger[_0x72d3('0x9')](_0x72d3('0x60'));logger[_0x72d3('0x9')](_0x72d3('0x61'),_0x3c3d25['id']);return setRelationship(_0x1bda1c,_0x56b27a,_0x3c3d25,_0x72d3('0x62'));})[_0x72d3('0x2a')](function(){return setRelationship(_0x1bda1c,_0x40279d,_0x3c3d25,_0x72d3('0x63'));})[_0x72d3('0x2a')](function(){return getServerInfo(_0x1bda1c);})[_0x72d3('0x2a')](function(_0x4d9056){var _0xa94e0b=parseInt(_0x4d9056[_0x72d3('0x64')][_0x72d3('0x65')](0x0));var _0x1ab9d4=util[_0x72d3('0x1f')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x201980['remoteUri'],_0x3c3d25['id']);if(_0xa94e0b>0x6){_0x1ab9d4=util[_0x72d3('0x1f')](_0x72d3('0x66'),_0x201980[_0x72d3('0x51')],_0x3c3d25['id']);}logger[_0x72d3('0x9')](_0x72d3('0x70'),_0x72d3('0x71'));emit(util[_0x72d3('0x1f')](_0x72d3('0x67'),_0x12cca8[_0x72d3('0xb')]),_0x72d3('0x68'),{'uri':_0x1ab9d4});})['catch'](function(_0x46798a){logger['error'](_0x72d3('0x70'),JSON[_0x72d3('0x24')](_0x46798a));});};exports['unmanaged']=function(_0x2594fe,_0x39c665,_0x532f2a,_0x3427b2,_0x5a8f0d,_0x474d21){var _0x4e3c6c,_0xa80d57,_0x444559,_0x25ebcb;_0x474d21[_0x72d3('0x51')]=intUtil[_0x72d3('0x50')](_0x474d21[_0x72d3('0x51')]);_0x474d21['serverUrl']=intUtil['stripTrailingSlash'](_0x474d21['serverUrl']);def[_0x72d3('0x53')]=util[_0x72d3('0x1f')](_0x72d3('0x54'),_0x474d21[_0x72d3('0x51')]);if(_0x5a8f0d&&_0x5a8f0d[_0x72d3('0x55')]){logger[_0x72d3('0x9')]('['+_0x39c665[_0x72d3('0x72')][_0x72d3('0x73')]()+']',_0x72d3('0x57'));_0x39c665[_0x72d3('0x58')]=util[_0x72d3('0x1f')](_0x72d3('0x74'),_0x474d21['serverUrl'],_0x39c665[_0x72d3('0x59')],md5(_0x39c665['uniqueid']));}else{_0x39c665[_0x72d3('0x58')]='';}return getConnection(_0x474d21)[_0x72d3('0x2a')](function(_0x543730){_0x25ebcb=_0x543730;if(!_[_0x72d3('0x75')](_0x3427b2)){return getUser(_0x474d21,_0x3427b2[_0x72d3('0xb')],_0x25ebcb);}else{return getUser(_0x474d21,null,_0x25ebcb);}})['then'](function(_0x417ca0){_0x4e3c6c=_0x417ca0;logger[_0x72d3('0x9')]('The\x20User\x20ID\x20is:',_0x4e3c6c['id']);return getEndUser(_0x474d21,_0x39c665['calleridname'],_0x39c665[_0x72d3('0x5c')],_0x25ebcb);})[_0x72d3('0x2a')](function(_0x18aa03){_0xa80d57=_0x18aa03;logger[_0x72d3('0x9')](_0x72d3('0x5d'),_0xa80d57['id']);return getTicket(_0x474d21,_0x4e3c6c,_0xa80d57,_0x532f2a,_0x39c665,_0x532f2a['Fields'],_0x25ebcb,'Inbound');})[_0x72d3('0x2a')](function(_0x1ca762){_0x444559=_0x1ca762;logger[_0x72d3('0x9')](_0x72d3('0x60'));logger[_0x72d3('0x9')]('The\x20Ticket\x20ID\x20is:',_0x444559['id']);return setRelationship(_0x25ebcb,_0x4e3c6c,_0x444559,'users');})[_0x72d3('0x2a')](function(){return setRelationship(_0x25ebcb,_0xa80d57,_0x444559,_0x72d3('0x63'));})[_0x72d3('0x2a')](function(){return getServerInfo(_0x25ebcb);})[_0x72d3('0x69')](function(_0x15d097){logger[_0x72d3('0x6a')]('['+_0x39c665[_0x72d3('0x72')][_0x72d3('0x73')]()+']',JSON[_0x72d3('0x24')](_0x15d097));});};
\ No newline at end of file
+var _0xf219=['%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','[OUTBOUND]','unmanaged','uri','lastevent','toUpperCase','lodash','request-promise','bluebird','md5','util','ioredis','../../../../config/environment','../../../../config/logger','sugarcrm','defaults','redis','localhost','socket.io-emitter','emit','info','Creating\x20new\x20ticket...','Subjects','getString','toISOString','replace','duration_hours','duration_minutes','Contacts','name','length','forEach','variableName','idField','set_entry','JSON','stringify','Calls','format','apiKey','toString','base64','get_server_info','Getting\x20agent\x20with\x20name','get_entry_list','Employees','user_name','then','entry_list','name_value_list','value','Agent\x20found!','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','find','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','<unknown>','Caller\x20-\x20%s','Enduser\x20created.','debug','[HTTP]','merge','map','type','string','nameField','push','content','variable','customField','custom_fields','Variable','toLowerCase','POST','login','username','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','set_relationship','queue','remoteUri','stripTrailingSlash','serverUrl','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','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','outbound','recordingFormat','Recording\x20is\x20enabled!','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','Fields','charAt'];(function(_0x9f9ed5,_0x56f438){var _0xbc71e3=function(_0x1de828){while(--_0x1de828){_0x9f9ed5['push'](_0x9f9ed5['shift']());}};_0xbc71e3(++_0x56f438);}(_0xf219,0x171));var _0x9f21=function(_0x36bbbb,_0x3f6709){_0x36bbbb=_0x36bbbb-0x0;var _0x3ca0eb=_0xf219[_0x36bbbb];return _0x3ca0eb;};'use strict';var _=require(_0x9f21('0x0'));var rp=require(_0x9f21('0x1'));var BPromise=require(_0x9f21('0x2'));var md5=require(_0x9f21('0x3'));var util=require(_0x9f21('0x4'));var Redis=require(_0x9f21('0x5'));var intUtil=require('./util');var config=require(_0x9f21('0x6'));var logger=require(_0x9f21('0x7'))(_0x9f21('0x8'));config['redis']=_[_0x9f21('0x9')](config[_0x9f21('0xa')],{'host':_0x9f21('0xb'),'port':0x18eb});var io=require(_0x9f21('0xc'))(new Redis(config[_0x9f21('0xa')]));var def={'method':'POST','json':!![]};function emit(_0x4f7610,_0x1b8262,_0xa9683){io['to'](_0x4f7610)[_0x9f21('0xd')](_0x1b8262,_0xa9683);}function getTicket(_0xf50977,_0x394e49,_0xe637a1,_0x113b0f,_0xd9e129,_0xb54d04,_0x227687,_0x1a28cc){logger[_0x9f21('0xe')](_0x9f21('0xf'));var _0x4b22b2=new Date();var _0x3313e2=[{'name':'name','value':intUtil['getString'](_0x113b0f[_0x9f21('0x10')],_0xd9e129,'\x20')},{'name':'assigned_user_id','value':_0x394e49['id']},{'name':'created_by','value':_0x394e49['id']},{'name':'description','value':intUtil[_0x9f21('0x11')](_0x113b0f['Descriptions'],_0xd9e129,'\x0a')},{'name':'date_start','value':_0x4b22b2[_0x9f21('0x12')]()['slice'](0x0,0x13)[_0x9f21('0x13')]('T','\x20')},{'name':_0x9f21('0x14'),'value':'0'},{'name':_0x9f21('0x15'),'value':'15'},{'name':'parent_id','value':_0xe637a1['id']},{'name':'parent_type','value':_0x9f21('0x16')},{'name':'parent_name','value':_0xe637a1[_0x9f21('0x17')]},{'name':'direction','value':_0x1a28cc}];if(_0xb54d04[_0x9f21('0x18')]){_[_0x9f21('0x19')](_0xb54d04,function(_0x164faf){if(_0xd9e129[_0x164faf[_0x9f21('0x1a')]]){_0x3313e2['push']({'name':_0x164faf[_0x9f21('0x1b')],'value':_0xd9e129[_0x164faf['variableName']]});}});}return request({'form':{'method':_0x9f21('0x1c'),'input_type':'JSON','response_type':_0x9f21('0x1d'),'rest_data':JSON[_0x9f21('0x1e')]({'session':_0x227687['id'],'module_name':_0x9f21('0x1f'),'name_value_list':_0x3313e2})}});}function getAuth(_0x4c1a96){return util[_0x9f21('0x20')]('Basic\x20%s',new Buffer(_0x4c1a96[_0x9f21('0x21')]+':X')[_0x9f21('0x22')](_0x9f21('0x23')));}function getServerInfo(_0x506b0e){return request({'form':{'method':_0x9f21('0x24'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0x9f21('0x1e')]({'session':_0x506b0e['id']})}});}function getUser(_0x4c8f42,_0x53e0b5,_0x55344e){if(!_['isNil'](_0x53e0b5)){logger[_0x9f21('0xe')](_0x9f21('0x25'),_0x53e0b5);return request({'form':{'method':_0x9f21('0x26'),'input_type':'JSON','response_type':_0x9f21('0x1d'),'rest_data':JSON[_0x9f21('0x1e')]({'session':_0x55344e['id'],'module_name':_0x9f21('0x27'),'query':util[_0x9f21('0x20')]('INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200',_0x53e0b5),'order_by':'','offset':'0','select_fields':['id',_0x9f21('0x17'),_0x9f21('0x28')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x9f21('0x29')](function(_0xb023ad){if(_0xb023ad[_0x9f21('0x2a')][_0x9f21('0x18')]){var _0x496db9=_['find'](_0xb023ad[_0x9f21('0x2a')],function(_0x47fe4d){return _0x47fe4d[_0x9f21('0x2b')][_0x9f21('0x28')][_0x9f21('0x2c')]===_0x53e0b5;});if(_0x496db9){logger['info'](_0x9f21('0x2d'));return BPromise[_0x9f21('0x2e')]({'id':_0x496db9[_0x9f21('0x2b')]['id'][_0x9f21('0x2c')],'name':_0x496db9[_0x9f21('0x2b')][_0x9f21('0x17')][_0x9f21('0x2c')]});}}logger[_0x9f21('0xe')](_0x9f21('0x2f'));return BPromise[_0x9f21('0x2e')]({'id':_0x55344e[_0x9f21('0x2b')][_0x9f21('0x30')][_0x9f21('0x2c')],'name':_0x55344e['name_value_list'][_0x9f21('0x28')]['value']});});}else{logger[_0x9f21('0xe')](_0x9f21('0x31'));return BPromise[_0x9f21('0x2e')]({'id':_0x55344e[_0x9f21('0x2b')]['user_id']['value'],'name':_0x55344e['name_value_list'][_0x9f21('0x28')][_0x9f21('0x2c')]});}}function getEndUser(_0x37765f,_0x5f127d,_0x2430e8,_0x1f78f5){logger[_0x9f21('0xe')](_0x9f21('0x32'),_0x2430e8);return request({'form':{'method':_0x9f21('0x26'),'input_type':_0x9f21('0x1d'),'response_type':_0x9f21('0x1d'),'rest_data':JSON['stringify']({'session':_0x1f78f5['id'],'module_name':_0x9f21('0x16'),'query':util[_0x9f21('0x20')](_0x9f21('0x33'),_0x2430e8),'order_by':'','offset':'0','select_fields':['id',_0x9f21('0x17'),_0x9f21('0x34')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x9f21('0x29')](function(_0x1dd06c){if(_0x1dd06c[_0x9f21('0x2a')]['length']){var _0x4c1d07=_[_0x9f21('0x35')](_0x1dd06c[_0x9f21('0x2a')],function(_0x1e813a){return _0x1e813a[_0x9f21('0x2b')]['phone_home'][_0x9f21('0x2c')]===_0x2430e8;});if(_0x4c1d07){logger[_0x9f21('0xe')](_0x9f21('0x36'));return BPromise[_0x9f21('0x2e')]({'id':_0x4c1d07[_0x9f21('0x2b')]['id'][_0x9f21('0x2c')],'name':_0x4c1d07[_0x9f21('0x2b')][_0x9f21('0x17')][_0x9f21('0x2c')],'phone':_0x4c1d07[_0x9f21('0x2b')][_0x9f21('0x34')][_0x9f21('0x2c')]});}}else{logger[_0x9f21('0xe')](_0x9f21('0x37'));return request({'form':{'method':'set_entry','input_type':'JSON','response_type':'JSON','rest_data':JSON[_0x9f21('0x1e')]({'session':_0x1f78f5['id'],'module_name':'Contacts','name_value_list':[{'name':_0x9f21('0x38'),'value':_0x5f127d!==_0x9f21('0x39')?_0x5f127d:util['format'](_0x9f21('0x3a'),_0x2430e8)},{'name':_0x9f21('0x34'),'value':_0x2430e8}]})}})[_0x9f21('0x29')](function(_0x354c97){logger[_0x9f21('0xe')](_0x9f21('0x3b'));return BPromise[_0x9f21('0x2e')]({'id':_0x354c97['id'],'name':_0x354c97[_0x9f21('0x2a')][_0x9f21('0x38')]['value'],'phone':_0x354c97['entry_list'][_0x9f21('0x34')][_0x9f21('0x2c')]});});}});}function request(_0x4e2fb1){logger[_0x9f21('0x3c')](_0x9f21('0x3d'),JSON[_0x9f21('0x1e')](_0x4e2fb1));return rp(_[_0x9f21('0x3e')](def,_0x4e2fb1));}function getTags(_0x4f36f3,_0x5b4198){var _0x4b12b2=[];if(_0x4f36f3&&_0x4f36f3[_0x9f21('0x18')]>0x0){_0x4b12b2=_[_0x9f21('0x3f')](_0x4f36f3,_0x5b4198);}return _0x4b12b2;}function getCustomFields(_0x236f1a,_0x29fdf3){var _0x25805d=[];var _0x4eddfc={'custom_fields':[]};if(_0x236f1a[_0x9f21('0x18')]>0x0){_['forEach'](_0x236f1a,function(_0x38ac68){if(_0x38ac68[_0x9f21('0x40')]===_0x9f21('0x41')&&_0x38ac68[_0x9f21('0x42')]&&!_0x38ac68['customField']){_0x4eddfc[_0x38ac68[_0x9f21('0x42')]['toLowerCase']()]=_0x38ac68['content'][_0x9f21('0x22')]();}else if(_0x38ac68[_0x9f21('0x40')]===_0x9f21('0x41')&&_0x38ac68['idField']&&_0x38ac68['customField']){_0x4eddfc['custom_fields'][_0x9f21('0x43')]({'id':_0x38ac68[_0x9f21('0x1b')],'value':_0x38ac68[_0x9f21('0x44')][_0x9f21('0x22')]()});}else if(_0x38ac68[_0x9f21('0x40')]===_0x9f21('0x45')&&_0x38ac68[_0x9f21('0x1a')]&&_0x38ac68['idField']&&_0x38ac68[_0x9f21('0x46')]){_0x29fdf3[_0x38ac68[_0x9f21('0x1a')]]&&_0x4eddfc[_0x9f21('0x47')][_0x9f21('0x43')]({'id':_0x38ac68[_0x9f21('0x1b')],'value':_0x29fdf3[_0x38ac68['variableName']][_0x9f21('0x22')]()});}else if(_0x38ac68[_0x9f21('0x40')]==='customVariable'&&_0x38ac68[_0x9f21('0x48')]&&_0x38ac68[_0x9f21('0x48')][_0x9f21('0x17')]&&_0x38ac68[_0x9f21('0x1b')]&&_0x38ac68['customField']){_0x29fdf3[_0x38ac68[_0x9f21('0x48')][_0x9f21('0x17')][_0x9f21('0x49')]()]&&_0x4eddfc['custom_fields'][_0x9f21('0x43')]({'id':_0x38ac68[_0x9f21('0x1b')],'value':_0x29fdf3[_0x38ac68[_0x9f21('0x48')][_0x9f21('0x17')][_0x9f21('0x49')]()]['toString']()});}});}return _0x4eddfc;}function getConnection(_0x205b62){return request({'method':_0x9f21('0x4a'),'form':{'method':_0x9f21('0x4b'),'input_type':_0x9f21('0x1d'),'response_type':_0x9f21('0x1d'),'rest_data':JSON[_0x9f21('0x1e')]({'user_auth':{'user_name':_0x205b62[_0x9f21('0x4c')],'password':_0x205b62[_0x9f21('0x4d')],'encryption':_0x9f21('0x4e')},'application':_0x9f21('0x4f')})}})[_0x9f21('0x29')](function(_0x4ec90e){var _0x2c82a9=_0x4ec90e;if(_0x2c82a9['id']){def[_0x9f21('0x50')]=_0x2c82a9['id'];return BPromise[_0x9f21('0x2e')](_0x2c82a9);}else{throw new Error(util[_0x9f21('0x20')]('Account\x20%d\x20is\x20not\x20valid',_0x205b62['id']));}});}function setRelationship(_0x260aef,_0x15ce1a,_0x19f7ba,_0x23ed68){return request({'form':{'method':_0x9f21('0x51'),'input_type':'JSON','response_type':_0x9f21('0x1d'),'rest_data':JSON[_0x9f21('0x1e')]({'session':_0x260aef['id'],'module_name':_0x9f21('0x1f'),'module_id':_0x19f7ba['id'],'link_field_name':_0x23ed68,'related_ids':[_0x15ce1a['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x9f21('0x52')]=function(_0x411800,_0x19165e,_0x37d088,_0x49feac,_0x14c6ec,_0x222c88){var _0xba34cd,_0x35ba71,_0xd84602,_0x34b483;_0x222c88[_0x9f21('0x53')]=intUtil[_0x9f21('0x54')](_0x222c88[_0x9f21('0x53')]);_0x222c88[_0x9f21('0x55')]=intUtil[_0x9f21('0x54')](_0x222c88['serverUrl']);def['uri']=util[_0x9f21('0x20')](_0x9f21('0x56'),_0x222c88['remoteUri']);if(_0x14c6ec&&_0x14c6ec[_0x9f21('0x57')]){logger[_0x9f21('0xe')](_0x9f21('0x58'),'Recording\x20is\x20enabled!');_0x19165e[_0x9f21('0x59')]=util['format'](_0x9f21('0x5a'),_0x222c88[_0x9f21('0x55')],_0x19165e[_0x9f21('0x5b')],md5(_0x19165e[_0x9f21('0x5b')]));}else{_0x19165e[_0x9f21('0x59')]='';}return getConnection(_0x222c88)['then'](function(_0x15ea57){_0x34b483=_0x15ea57;return getUser(_0x222c88,_0x49feac[_0x9f21('0x17')],_0x34b483);})[_0x9f21('0x29')](function(_0x4edc0b){_0xba34cd=_0x4edc0b;logger[_0x9f21('0xe')]('The\x20User\x20ID\x20is:',_0xba34cd['id']);return getEndUser(_0x222c88,_0x19165e[_0x9f21('0x5c')],_0x19165e[_0x9f21('0x5d')],_0x34b483);})[_0x9f21('0x29')](function(_0x4e383d){_0x35ba71=_0x4e383d;logger[_0x9f21('0xe')](_0x9f21('0x5e'),_0x35ba71['id']);return getTicket(_0x222c88,_0xba34cd,_0x35ba71,_0x37d088,_0x19165e,_0x37d088['Fields'],_0x34b483,_0x9f21('0x5f'));})[_0x9f21('0x29')](function(_0x4a0116){_0xd84602=_0x4a0116;logger[_0x9f21('0xe')](_0x9f21('0x60'));logger['info'](_0x9f21('0x61'),_0xd84602['id']);return setRelationship(_0x34b483,_0xba34cd,_0xd84602,_0x9f21('0x62'));})[_0x9f21('0x29')](function(){return setRelationship(_0x34b483,_0x35ba71,_0xd84602,_0x9f21('0x63'));})['then'](function(){return getServerInfo(_0x34b483);})['then'](function(_0xcbe297){var _0x148729=parseInt(_0xcbe297[_0x9f21('0x64')]['charAt'](0x0));var _0xd802c2=util[_0x9f21('0x20')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x222c88[_0x9f21('0x53')],_0xd84602['id']);if(_0x148729>0x6){_0xd802c2=util[_0x9f21('0x20')](_0x9f21('0x65'),_0x222c88[_0x9f21('0x53')],_0xd84602['id']);}logger[_0x9f21('0xe')](_0x9f21('0x58'),_0x9f21('0x66'));emit(util[_0x9f21('0x20')](_0x9f21('0x67'),_0x49feac[_0x9f21('0x17')]),_0x9f21('0x68'),{'uri':_0xd802c2});})[_0x9f21('0x69')](function(_0x4ceae1){logger[_0x9f21('0x6a')](_0x9f21('0x58'),JSON[_0x9f21('0x1e')](_0x4ceae1));});};exports[_0x9f21('0x6b')]=function(_0x229a31,_0x5aa435,_0x1c13cd,_0x1da687,_0x3d65b7,_0x18db16,_0x32b0f5){var _0x5bf96d,_0x2214cb,_0x3777fc,_0xcd8d01;_0x18db16[_0x9f21('0x53')]=intUtil[_0x9f21('0x54')](_0x18db16[_0x9f21('0x53')]);_0x18db16[_0x9f21('0x55')]=intUtil['stripTrailingSlash'](_0x18db16['serverUrl']);def['uri']=util[_0x9f21('0x20')](_0x9f21('0x56'),_0x18db16[_0x9f21('0x53')]);if(_0x32b0f5&&_0x32b0f5['recordingFormat']&&_0x32b0f5[_0x9f21('0x6c')]!=='none'){logger[_0x9f21('0xe')]('[OUTBOUND]',_0x9f21('0x6d'));_0x5aa435['recordingURL']=util['format'](_0x9f21('0x5a'),_0x18db16[_0x9f21('0x55')],_0x5aa435[_0x9f21('0x5b')],md5(_0x5aa435['uniqueid']));}return getConnection(_0x18db16)[_0x9f21('0x29')](function(_0x4a1b39){_0xcd8d01=_0x4a1b39;return getUser(_0x18db16,_0x1da687[_0x9f21('0x17')],_0xcd8d01);})[_0x9f21('0x29')](function(_0x1b8d0f){_0x5bf96d=_0x1b8d0f;logger[_0x9f21('0xe')](_0x9f21('0x6e'),_0x5bf96d['id']);return getEndUser(_0x18db16,_0x5aa435[_0x9f21('0x6f')],_0x5aa435[_0x9f21('0x70')],_0xcd8d01);})['then'](function(_0x5bad7d){_0x2214cb=_0x5bad7d;logger['info'](_0x9f21('0x5e'),_0x2214cb['id']);return getTicket(_0x18db16,_0x5bf96d,_0x2214cb,_0x1c13cd,_0x5aa435,_0x1c13cd[_0x9f21('0x71')],_0xcd8d01,'Outbound');})[_0x9f21('0x29')](function(_0x19c1ae){_0x3777fc=_0x19c1ae;logger['info'](_0x9f21('0x60'));logger['info'](_0x9f21('0x61'),_0x3777fc['id']);return setRelationship(_0xcd8d01,_0x5bf96d,_0x3777fc,'users');})['then'](function(){return setRelationship(_0xcd8d01,_0x2214cb,_0x3777fc,_0x9f21('0x63'));})[_0x9f21('0x29')](function(){return getServerInfo(_0xcd8d01);})[_0x9f21('0x29')](function(_0x3d53d6){var _0x1c59c0=parseInt(_0x3d53d6[_0x9f21('0x64')][_0x9f21('0x72')](0x0));var _0x55f3c5=util[_0x9f21('0x20')](_0x9f21('0x73'),_0x18db16[_0x9f21('0x53')],_0x3777fc['id']);if(_0x1c59c0>0x6){_0x55f3c5=util[_0x9f21('0x20')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x18db16['remoteUri'],_0x3777fc['id']);}logger[_0x9f21('0xe')](_0x9f21('0x74'),_0x9f21('0x66'));emit(util['format'](_0x9f21('0x67'),_0x1da687[_0x9f21('0x17')]),_0x9f21('0x68'),{'uri':_0x55f3c5});})[_0x9f21('0x69')](function(_0x24a86a){logger[_0x9f21('0x6a')](_0x9f21('0x74'),JSON['stringify'](_0x24a86a));});};exports[_0x9f21('0x75')]=function(_0x4c395f,_0x348f1f,_0x9a01a1,_0x1b42ee,_0x20be9a,_0x43e350){var _0x20fe75,_0x4a0c21,_0x16b748,_0x106837;_0x43e350['remoteUri']=intUtil[_0x9f21('0x54')](_0x43e350[_0x9f21('0x53')]);_0x43e350[_0x9f21('0x55')]=intUtil[_0x9f21('0x54')](_0x43e350['serverUrl']);def[_0x9f21('0x76')]=util[_0x9f21('0x20')](_0x9f21('0x56'),_0x43e350['remoteUri']);if(_0x20be9a&&_0x20be9a[_0x9f21('0x57')]){logger['info']('['+_0x348f1f[_0x9f21('0x77')][_0x9f21('0x78')]()+']','Recording\x20is\x20enabled!');_0x348f1f[_0x9f21('0x59')]=util[_0x9f21('0x20')](_0x9f21('0x5a'),_0x43e350[_0x9f21('0x55')],_0x348f1f[_0x9f21('0x5b')],md5(_0x348f1f[_0x9f21('0x5b')]));}else{_0x348f1f[_0x9f21('0x59')]='';}return getConnection(_0x43e350)[_0x9f21('0x29')](function(_0x377452){_0x106837=_0x377452;if(!_['isNil'](_0x1b42ee)){return getUser(_0x43e350,_0x1b42ee['name'],_0x106837);}else{return getUser(_0x43e350,null,_0x106837);}})[_0x9f21('0x29')](function(_0x4887bf){_0x20fe75=_0x4887bf;logger['info'](_0x9f21('0x6e'),_0x20fe75['id']);return getEndUser(_0x43e350,_0x348f1f[_0x9f21('0x5c')],_0x348f1f[_0x9f21('0x5d')],_0x106837);})['then'](function(_0x109caf){_0x4a0c21=_0x109caf;logger[_0x9f21('0xe')](_0x9f21('0x5e'),_0x4a0c21['id']);return getTicket(_0x43e350,_0x20fe75,_0x4a0c21,_0x9a01a1,_0x348f1f,_0x9a01a1[_0x9f21('0x71')],_0x106837,_0x9f21('0x5f'));})[_0x9f21('0x29')](function(_0x3bb853){_0x16b748=_0x3bb853;logger[_0x9f21('0xe')]('Ticket\x20created!');logger[_0x9f21('0xe')]('The\x20Ticket\x20ID\x20is:',_0x16b748['id']);return setRelationship(_0x106837,_0x20fe75,_0x16b748,_0x9f21('0x62'));})[_0x9f21('0x29')](function(){return setRelationship(_0x106837,_0x4a0c21,_0x16b748,_0x9f21('0x63'));})[_0x9f21('0x29')](function(){return getServerInfo(_0x106837);})[_0x9f21('0x69')](function(_0x40bf2b){logger[_0x9f21('0x6a')]('['+_0x348f1f['lastevent'][_0x9f21('0x78')]()+']',JSON[_0x9f21('0x1e')](_0x40bf2b));});};
\ No newline at end of file