Built motion from commit ff78e754.|2.6.29
[motion2.git] / server / api / chatMessage / chatMessage.controller.js
index 6c8bbeb..38ffd6c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xcf3a=['get','ChatInteractionId','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','role','stringify','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','manual','SIP/%s','channel','motionChannel','event','EventManager','parse','ChatInteraction','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','ContactId','internal','interface','rejectmessage','formData','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','socket.io-emitter','./chatMessage.socket','register','jayson/promise','client','http','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','code','error','message','catch','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','reject','update','end','stack','name','send','index','map','ChatMessage','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','rawAttributes','create','body','params','destroy','find','describe','chat-interactions','accept','chat','read','readAt','format','UserId','user','agent'];(function(_0x9c93f5,_0x2fe9c8){var _0x5e613a=function(_0x25c92f){while(--_0x25c92f){_0x9c93f5['push'](_0x9c93f5['shift']());}};_0x5e613a(++_0x2fe9c8);}(_0xcf3a,0x134));var _0xacf3=function(_0x276c4,_0x4a4554){_0x276c4=_0x276c4-0x0;var _0x4e069e=_0xcf3a[_0x276c4];return _0x4e069e;};'use strict';var emlformat=require(_0xacf3('0x0'));var rimraf=require(_0xacf3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xacf3('0x2'));var rp=require(_0xacf3('0x3'));var moment=require(_0xacf3('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xacf3('0x5'));var util=require(_0xacf3('0x6'));var path=require(_0xacf3('0x7'));var sox=require(_0xacf3('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xacf3('0x9'));var _=require(_0xacf3('0xa'));var squel=require(_0xacf3('0xb'));var crypto=require(_0xacf3('0xc'));var jsforce=require(_0xacf3('0xd'));var deskjs=require(_0xacf3('0xe'));var toCsv=require(_0xacf3('0xf'));var querystring=require('querystring');var Papa=require(_0xacf3('0x10'));var Redis=require('ioredis');var authService=require(_0xacf3('0x11'));var qs=require(_0xacf3('0x12'));var as=require(_0xacf3('0x13'));var hardwareService=require(_0xacf3('0x14'));var logger=require(_0xacf3('0x15'))(_0xacf3('0x16'));var utils=require(_0xacf3('0x17'));var config=require(_0xacf3('0x18'));var licenseUtil=require(_0xacf3('0x19'));var db=require('../../mysqldb')['db'];config[_0xacf3('0x1a')]=_['defaults'](config[_0xacf3('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0xacf3('0x1b'))(new Redis(config[_0xacf3('0x1a')]));require(_0xacf3('0x1c'))[_0xacf3('0x1d')](socket);var jayson=require(_0xacf3('0x1e'));var client=jayson[_0xacf3('0x1f')][_0xacf3('0x20')]({'port':0x232c});var client9002=jayson[_0xacf3('0x1f')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2b1eaa,_0x2c9a96,_0x39bb5a,_0x52023b){return new BPromise(function(_0x24000a,_0x5eb36d){var _0x10a9b2=_0x52023b||client;return _0x10a9b2[_0xacf3('0x21')](_0x2b1eaa,_0x39bb5a)[_0xacf3('0x22')](function(_0x571dcb){logger[_0xacf3('0x23')](_0xacf3('0x24'),_0x2c9a96,_0xacf3('0x25'));logger[_0xacf3('0x26')](_0xacf3('0x27'),_0x2c9a96,_0xacf3('0x25'),JSON['stringify'](_0x571dcb));if(_0x571dcb['error']){if(_0x571dcb['error'][_0xacf3('0x28')]===0x1f4){logger[_0xacf3('0x29')](_0xacf3('0x24'),_0x2c9a96,_0x571dcb[_0xacf3('0x29')][_0xacf3('0x2a')]);return _0x5eb36d(_0x571dcb[_0xacf3('0x29')]['message']);}logger[_0xacf3('0x29')](_0xacf3('0x24'),_0x2c9a96,_0x571dcb['error'][_0xacf3('0x2a')]);return _0x24000a(_0x571dcb[_0xacf3('0x29')]['message']);}else{logger[_0xacf3('0x23')](_0xacf3('0x24'),_0x2c9a96,'request\x20sent');_0x24000a(_0x571dcb['result'][_0xacf3('0x2a')]);}})[_0xacf3('0x2b')](function(_0x5f38e6){logger['error'](_0xacf3('0x24'),_0x2c9a96,_0x5f38e6);_0x5eb36d(_0x5f38e6);});});}function respondWithStatusCode(_0x101ff5,_0x24b034){_0x24b034=_0x24b034||0xcc;return function(_0x18bde0){if(_0x18bde0){return _0x101ff5[_0xacf3('0x2c')](_0x24b034);}return _0x101ff5[_0xacf3('0x2d')](_0x24b034)['end']();};}function respondWithResult(_0x55e58d,_0x1151ad){_0x1151ad=_0x1151ad||0xc8;return function(_0x4a7144){if(_0x4a7144){return _0x55e58d['status'](_0x1151ad)[_0xacf3('0x2e')](_0x4a7144);}};}function respondWithFilteredResult(_0xdb7154,_0x9fe300){return function(_0x588470){if(_0x588470){var _0x4a61b8=typeof _0x9fe300['offset']===_0xacf3('0x2f')&&typeof _0x9fe300[_0xacf3('0x30')]===_0xacf3('0x2f');var _0x3e3327=_0x588470[_0xacf3('0x31')];var _0xa2ad56=_0x4a61b8?0x0:_0x9fe300[_0xacf3('0x32')];var _0x41987e=_0x4a61b8?_0x588470[_0xacf3('0x31')]:_0x9fe300[_0xacf3('0x32')]+_0x9fe300[_0xacf3('0x30')];var _0x383cf0;if(_0x41987e>=_0x3e3327){_0x41987e=_0x3e3327;_0x383cf0=0xc8;}else{_0x383cf0=0xce;}_0xdb7154[_0xacf3('0x2d')](_0x383cf0);return _0xdb7154[_0xacf3('0x33')](_0xacf3('0x34'),_0xa2ad56+'-'+_0x41987e+'/'+_0x3e3327)['json'](_0x588470);}return null;};}function patchUpdates(_0x18fb6c){return function(_0x5df785){try{jsonpatch['apply'](_0x5df785,_0x18fb6c,!![]);}catch(_0x4dba40){return BPromise[_0xacf3('0x35')](_0x4dba40);}return _0x5df785['save']();};}function saveUpdates(_0x3e47bf,_0x3b91db){return function(_0x5c915e){if(_0x5c915e){return _0x5c915e[_0xacf3('0x36')](_0x3e47bf)[_0xacf3('0x22')](function(_0x565a4a){return _0x565a4a;});}return null;};}function removeEntity(_0x4738ff,_0x1d6c0e){return function(_0x484b85){if(_0x484b85){return _0x484b85['destroy']()['then'](function(){_0x4738ff[_0xacf3('0x2d')](0xcc)[_0xacf3('0x37')]();});}};}function handleEntityNotFound(_0x540f58,_0x387318){return function(_0x4cfc8f){if(!_0x4cfc8f){_0x540f58[_0xacf3('0x2c')](0x194);}return _0x4cfc8f;};}function handleError(_0x3fd93b,_0xb912d9){_0xb912d9=_0xb912d9||0x1f4;return function(_0x4c0495){logger[_0xacf3('0x29')](_0x4c0495[_0xacf3('0x38')]);if(_0x4c0495[_0xacf3('0x39')]){delete _0x4c0495['name'];}_0x3fd93b[_0xacf3('0x2d')](_0xb912d9)[_0xacf3('0x3a')](_0x4c0495);};}exports[_0xacf3('0x3b')]=function(_0x369562,_0x19903c){var _0x2e5555={},_0x2fa405={},_0x4a25d8={'count':0x0,'rows':[]};var _0x1e8517=_[_0xacf3('0x3c')](db[_0xacf3('0x3d')]['rawAttributes'],function(_0x3c0ed7){return{'name':_0x3c0ed7[_0xacf3('0x3e')],'type':_0x3c0ed7[_0xacf3('0x3f')][_0xacf3('0x40')]};});_0x2fa405['model']=_[_0xacf3('0x3c')](_0x1e8517,'name');_0x2fa405[_0xacf3('0x41')]=_[_0xacf3('0x42')](_0x369562[_0xacf3('0x41')]);_0x2fa405[_0xacf3('0x43')]=_[_0xacf3('0x44')](_0x2fa405[_0xacf3('0x45')],_0x2fa405[_0xacf3('0x41')]);_0x2e5555[_0xacf3('0x46')]=_['intersection'](_0x2fa405[_0xacf3('0x45')],qs[_0xacf3('0x47')](_0x369562['query'][_0xacf3('0x47')]));_0x2e5555[_0xacf3('0x46')]=_0x2e5555[_0xacf3('0x46')][_0xacf3('0x48')]?_0x2e5555['attributes']:_0x2fa405[_0xacf3('0x45')];if(!_0x369562[_0xacf3('0x41')][_0xacf3('0x49')](_0xacf3('0x4a'))){_0x2e5555['limit']=qs[_0xacf3('0x30')](_0x369562[_0xacf3('0x41')][_0xacf3('0x30')]);_0x2e5555[_0xacf3('0x32')]=qs[_0xacf3('0x32')](_0x369562[_0xacf3('0x41')]['offset']);}_0x2e5555[_0xacf3('0x4b')]=qs[_0xacf3('0x4c')](_0x369562[_0xacf3('0x41')][_0xacf3('0x4c')]);_0x2e5555[_0xacf3('0x4d')]=qs[_0xacf3('0x43')](_[_0xacf3('0x4e')](_0x369562[_0xacf3('0x41')],_0x2fa405[_0xacf3('0x43')]),_0x1e8517);if(_0x369562[_0xacf3('0x41')]['filter']){_0x2e5555[_0xacf3('0x4d')]=_['merge'](_0x2e5555[_0xacf3('0x4d')],{'$or':_[_0xacf3('0x3c')](_0x1e8517,function(_0x3af3e7){if(_0x3af3e7[_0xacf3('0x3f')]!==_0xacf3('0x4f')){var _0x217c1e={};_0x217c1e[_0x3af3e7[_0xacf3('0x39')]]={'$like':'%'+_0x369562[_0xacf3('0x41')][_0xacf3('0x50')]+'%'};return _0x217c1e;}})});}_0x2e5555=_[_0xacf3('0x51')]({},_0x2e5555,_0x369562[_0xacf3('0x52')]);var _0x3c3079={'where':_0x2e5555[_0xacf3('0x4d')]};return db[_0xacf3('0x3d')]['count'](_0x3c3079)['then'](function(_0x3e0eaa){_0x4a25d8[_0xacf3('0x31')]=_0x3e0eaa;if(_0x369562[_0xacf3('0x41')][_0xacf3('0x53')]){_0x2e5555[_0xacf3('0x54')]=[{'all':!![]}];}return db['ChatMessage'][_0xacf3('0x55')](_0x2e5555);})[_0xacf3('0x22')](function(_0x55d0d6){_0x4a25d8[_0xacf3('0x56')]=_0x55d0d6;return _0x4a25d8;})[_0xacf3('0x22')](respondWithFilteredResult(_0x19903c,_0x2e5555))[_0xacf3('0x2b')](handleError(_0x19903c,null));};exports['show']=function(_0x39f451,_0x455cff){var _0xeaf848={'raw':!![],'where':{'id':_0x39f451['params']['id']}},_0x10ecfd={};_0x10ecfd[_0xacf3('0x45')]=_[_0xacf3('0x42')](db[_0xacf3('0x3d')][_0xacf3('0x57')]);_0x10ecfd[_0xacf3('0x41')]=_['keys'](_0x39f451[_0xacf3('0x41')]);_0x10ecfd[_0xacf3('0x43')]=_[_0xacf3('0x44')](_0x10ecfd[_0xacf3('0x45')],_0x10ecfd[_0xacf3('0x41')]);_0xeaf848[_0xacf3('0x46')]=_[_0xacf3('0x44')](_0x10ecfd[_0xacf3('0x45')],qs[_0xacf3('0x47')](_0x39f451[_0xacf3('0x41')][_0xacf3('0x47')]));_0xeaf848['attributes']=_0xeaf848[_0xacf3('0x46')][_0xacf3('0x48')]?_0xeaf848[_0xacf3('0x46')]:_0x10ecfd[_0xacf3('0x45')];if(_0x39f451[_0xacf3('0x41')]['includeAll']){_0xeaf848[_0xacf3('0x54')]=[{'all':!![]}];}_0xeaf848=_[_0xacf3('0x51')]({},_0xeaf848,_0x39f451[_0xacf3('0x52')]);return db['ChatMessage']['find'](_0xeaf848)[_0xacf3('0x22')](handleEntityNotFound(_0x455cff,null))[_0xacf3('0x22')](respondWithResult(_0x455cff,null))[_0xacf3('0x2b')](handleError(_0x455cff,null));};exports[_0xacf3('0x58')]=function(_0x31ffd0,_0x3693bb){return db[_0xacf3('0x3d')][_0xacf3('0x58')](_0x31ffd0[_0xacf3('0x59')],{})[_0xacf3('0x22')](respondWithResult(_0x3693bb,0xc9))[_0xacf3('0x2b')](handleError(_0x3693bb,null));};exports['update']=function(_0x3a7296,_0x1d4d43){if(_0x3a7296[_0xacf3('0x59')]['id']){delete _0x3a7296[_0xacf3('0x59')]['id'];}return db[_0xacf3('0x3d')]['find']({'where':{'id':_0x3a7296[_0xacf3('0x5a')]['id']}})[_0xacf3('0x22')](handleEntityNotFound(_0x1d4d43,null))[_0xacf3('0x22')](saveUpdates(_0x3a7296[_0xacf3('0x59')],null))[_0xacf3('0x22')](respondWithResult(_0x1d4d43,null))[_0xacf3('0x2b')](handleError(_0x1d4d43,null));};exports[_0xacf3('0x5b')]=function(_0x2db410,_0x16147a){return db[_0xacf3('0x3d')][_0xacf3('0x5c')]({'where':{'id':_0x2db410[_0xacf3('0x5a')]['id']}})['then'](handleEntityNotFound(_0x16147a,null))[_0xacf3('0x22')](removeEntity(_0x16147a,null))[_0xacf3('0x2b')](handleError(_0x16147a,null));};exports['describe']=function(_0x561c8e,_0x129240){return db[_0xacf3('0x3d')][_0xacf3('0x5d')]()[_0xacf3('0x22')](respondWithResult(_0x129240,null))['catch'](handleError(_0x129240,null));};var interaction_log=require(_0xacf3('0x15'))(_0xacf3('0x5e'));exports[_0xacf3('0x5f')]=function(_0x1305b4,_0x2fbca5,_0x2c558e){var _0x1ff991={'agent':{},'channel':_0xacf3('0x60')};if(_0x1305b4['body']['id']){delete _0x1305b4[_0xacf3('0x59')]['id'];}_0x1305b4[_0xacf3('0x59')][_0xacf3('0x61')]=!![];_0x1305b4[_0xacf3('0x59')][_0xacf3('0x62')]=moment()[_0xacf3('0x63')]('YYYY-MM-DD\x20HH:mm:ss');_0x1305b4[_0xacf3('0x59')][_0xacf3('0x64')]=_0x1305b4[_0xacf3('0x59')][_0xacf3('0x64')]||_0x1305b4[_0xacf3('0x65')]['id'];_0x1ff991[_0xacf3('0x66')]['id']=_0x1305b4[_0xacf3('0x59')][_0xacf3('0x64')];return db[_0xacf3('0x3d')][_0xacf3('0x5c')]({'where':{'id':_0x1305b4[_0xacf3('0x5a')]['id'],'UserId':null}})[_0xacf3('0x22')](handleEntityNotFound(_0x2fbca5,null))[_0xacf3('0x22')](saveUpdates(_0x1305b4['body'],null))[_0xacf3('0x22')](function(_0x39a9c6){if(_0x39a9c6){_0x1ff991[_0xacf3('0x2a')]=_0x39a9c6[_0xacf3('0x67')]({'plain':!![]});return db['ChatInteraction'][_0xacf3('0x5c')]({'where':{'id':_0x39a9c6[_0xacf3('0x68')]}});}return null;})[_0xacf3('0x22')](handleEntityNotFound(_0x2fbca5,null))[_0xacf3('0x22')](function(_0x40b9e0){if(_0x40b9e0){return _0x40b9e0[_0xacf3('0x36')]({'UserId':_0x1305b4['body'][_0xacf3('0x64')],'read1stAt':_['isNil'](_0x40b9e0[_0xacf3('0x69')])?moment()['format'](_0xacf3('0x6a')):undefined});}return null;})[_0xacf3('0x22')](function(_0x1c8fde){if(_0x1c8fde){_0x1ff991[_0xacf3('0x6b')]=_0x1c8fde[_0xacf3('0x67')]({'plain':!![]});interaction_log[_0xacf3('0x23')]('[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x1305b4[_0xacf3('0x65')]['id'],_0x1305b4[_0xacf3('0x65')]['name'],_0x1305b4[_0xacf3('0x65')][_0xacf3('0x6c')],_0x1ff991['interaction']['id'],_0x1305b4['body']?JSON[_0xacf3('0x6d')](_0x1305b4[_0xacf3('0x59')]):'null');return respondWithRpcPromise(_0xacf3('0x6e'),_0xacf3('0x6f'),_0x1ff991);}return null;})[_0xacf3('0x22')](function(_0xdcacda){var _0x1e63fa=_0xacf3('0x70')+_0xdcacda[_0xacf3('0x2a')]['ContactId'];return db[_0xacf3('0x71')][_0xacf3('0x41')](_0x1e63fa,{'type':db[_0xacf3('0x72')][_0xacf3('0x73')][_0xacf3('0x74')],'raw':!![]})['then'](function(_0x3b9521){return _0x3b9521;});})[_0xacf3('0x22')](function(_0x3a14a9){if(_0x3a14a9){_0x1ff991[_0xacf3('0x2a')][_0xacf3('0x75')]=_0x3a14a9[0x0];if(!_0x1305b4['body'][_0xacf3('0x64')])return;return db[_0xacf3('0x76')][_0xacf3('0x5c')]({'where':{'id':_0x1305b4['body'][_0xacf3('0x64')],'role':_0xacf3('0x66')},'attributes':['id',_0xacf3('0x39'),_0xacf3('0x77'),'email','internal'],'raw':!![]});}return null;})[_0xacf3('0x22')](function(_0x8d617a){if(!_0x8d617a)return null;_0x1ff991[_0xacf3('0x2a')][_0xacf3('0x66')]=_0x8d617a;return _0x1ff991;})['then'](function(_0x2e4905){if(_0x2e4905){if(_0x1305b4['body'][_0xacf3('0x78')]){_0x1ff991[_0xacf3('0x2a')]['interface']=util[_0xacf3('0x63')](_0xacf3('0x79'),_0x1305b4[_0xacf3('0x65')][_0xacf3('0x39')]);_0x1ff991[_0xacf3('0x2a')][_0xacf3('0x7a')]=_0x1ff991[_0xacf3('0x7a')];_0x1ff991[_0xacf3('0x2a')][_0xacf3('0x7b')]=_0x1ff991[_0xacf3('0x7a')];_0x1ff991[_0xacf3('0x2a')][_0xacf3('0x7c')]='accept';return respondWithRpcPromise(_0xacf3('0x7d'),'EventManager',{'event':'acceptmessage','message':_[_0xacf3('0x51')](_0x1ff991[_0xacf3('0x2a')],JSON[_0xacf3('0x7e')](_0x1ff991[_0xacf3('0x6b')]['formData']))},client9002)[_0xacf3('0x22')](function(){return _0x1ff991;});}return _0x1ff991;}return null;})[_0xacf3('0x22')](respondWithResult(_0x2fbca5,null))[_0xacf3('0x2b')](handleError(_0x2fbca5,null));};var interaction_log=require(_0xacf3('0x15'))(_0xacf3('0x5e'));exports[_0xacf3('0x35')]=function(_0x41a78e,_0x35261c,_0x3fcae2){var _0x28e950={'agent':{},'channel':_0xacf3('0x60')};if(_0x41a78e[_0xacf3('0x59')]['id']){delete _0x41a78e['body']['id'];}_0x41a78e[_0xacf3('0x59')]['UserId']=_0x41a78e['body'][_0xacf3('0x64')]||_0x41a78e[_0xacf3('0x65')]['id'];_0x28e950[_0xacf3('0x66')]['id']=_0x41a78e['body'][_0xacf3('0x64')];return db[_0xacf3('0x3d')]['find']({'where':{'id':_0x41a78e[_0xacf3('0x5a')]['id'],'UserId':null}})[_0xacf3('0x22')](handleEntityNotFound(_0x35261c,null))[_0xacf3('0x22')](function(_0x33720c){if(_0x33720c){_0x28e950[_0xacf3('0x2a')]=_0x33720c['get']({'plain':!![]});return db[_0xacf3('0x7f')][_0xacf3('0x5c')]({'where':{'id':_0x33720c['ChatInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x35261c,null))['then'](function(_0x2c4eba){if(_0x2c4eba){_0x28e950[_0xacf3('0x6b')]=_0x2c4eba['get']({'plain':!![]});interaction_log[_0xacf3('0x23')](_0xacf3('0x80'),_0x41a78e['user']['id'],_0x41a78e[_0xacf3('0x65')]['name'],_0x41a78e[_0xacf3('0x65')][_0xacf3('0x6c')],_0x28e950[_0xacf3('0x6b')]['id'],_0x41a78e[_0xacf3('0x59')]?JSON[_0xacf3('0x6d')](_0x41a78e['body']):_0xacf3('0x81'));return respondWithRpcPromise(_0xacf3('0x82'),_0xacf3('0x83'),_0x28e950);}return null;})[_0xacf3('0x22')](function(_0x524aa9){var _0x390ba2=_0xacf3('0x70')+_0x524aa9[_0xacf3('0x2a')][_0xacf3('0x84')];return db[_0xacf3('0x71')]['query'](_0x390ba2,{'type':db[_0xacf3('0x72')][_0xacf3('0x73')][_0xacf3('0x74')],'raw':!![]})[_0xacf3('0x22')](function(_0x5b2ac1){return _0x5b2ac1;});})[_0xacf3('0x22')](function(_0x51dcc5){if(_0x51dcc5){_0x28e950[_0xacf3('0x2a')][_0xacf3('0x75')]=_0x51dcc5[0x0];if(!_0x41a78e[_0xacf3('0x59')][_0xacf3('0x64')])return;return db[_0xacf3('0x76')][_0xacf3('0x5c')]({'where':{'id':_0x41a78e['body'][_0xacf3('0x64')],'role':_0xacf3('0x66')},'attributes':['id','name',_0xacf3('0x77'),'email',_0xacf3('0x85')],'raw':!![]});}return null;})[_0xacf3('0x22')](function(_0x58516c){if(!_0x58516c)return null;_0x28e950[_0xacf3('0x2a')][_0xacf3('0x66')]=_0x58516c;return _0x28e950;})[_0xacf3('0x22')](function(_0xa6fa83){if(_0xa6fa83){_0xa6fa83[_0xacf3('0x2a')][_0xacf3('0x86')]=util[_0xacf3('0x63')](_0xacf3('0x79'),_0x41a78e[_0xacf3('0x65')][_0xacf3('0x39')]);_0xa6fa83[_0xacf3('0x2a')][_0xacf3('0x7a')]=_0x28e950[_0xacf3('0x7a')];_0xa6fa83[_0xacf3('0x2a')][_0xacf3('0x7b')]=_0x28e950[_0xacf3('0x7a')];_0xa6fa83['message']['event']=_0xacf3('0x35');respondWithRpcPromise(_0xacf3('0x7d'),_0xacf3('0x7d'),{'event':_0xacf3('0x87'),'message':_['merge'](_0x28e950['message'],JSON[_0xacf3('0x7e')](_0x28e950[_0xacf3('0x6b')][_0xacf3('0x88')]))},client9002);return _0x28e950;}return null;})[_0xacf3('0x22')](respondWithResult(_0x35261c,null))[_0xacf3('0x2b')](handleError(_0x35261c,null));};
\ No newline at end of file
+var _0xaca9=['user','agent','get','ChatInteraction','isNil','read1stAt','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','contact','User','fullname','email','manual','SIP/%s','channel','motionChannel','accept','EventManager','parse','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','Sequelize','SELECT','interface','event','rejectmessage','formData','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./chatMessage.socket','jayson/promise','http','request','ChatMessage,\x20%s,\x20%s','ChatMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','then','destroy','status','sendStatus','stack','name','send','map','type','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','VIRTUAL','merge','options','includeAll','include','ChatMessage','rows','catch','params','rawAttributes','find','create','body','update','describe','../../config/logger','chat-interactions','chat','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId'];(function(_0x111068,_0x4e1daf){var _0x1670c4=function(_0x55d110){while(--_0x55d110){_0x111068['push'](_0x111068['shift']());}};_0x1670c4(++_0x4e1daf);}(_0xaca9,0x1b5));var _0x9aca=function(_0x4ff09b,_0x53f67d){_0x4ff09b=_0x4ff09b-0x0;var _0x3f5c2e=_0xaca9[_0x4ff09b];return _0x3f5c2e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9aca('0x0'));var zipdir=require(_0x9aca('0x1'));var jsonpatch=require(_0x9aca('0x2'));var rp=require('request-promise');var moment=require(_0x9aca('0x3'));var BPromise=require(_0x9aca('0x4'));var Mustache=require(_0x9aca('0x5'));var util=require(_0x9aca('0x6'));var path=require(_0x9aca('0x7'));var sox=require(_0x9aca('0x8'));var csv=require('to-csv');var ejs=require(_0x9aca('0x9'));var fs=require('fs');var fs_extra=require(_0x9aca('0xa'));var _=require(_0x9aca('0xb'));var squel=require(_0x9aca('0xc'));var crypto=require(_0x9aca('0xd'));var jsforce=require(_0x9aca('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x9aca('0xf'));var Papa=require(_0x9aca('0x10'));var Redis=require('ioredis');var authService=require(_0x9aca('0x11'));var qs=require(_0x9aca('0x12'));var as=require(_0x9aca('0x13'));var hardwareService=require(_0x9aca('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x9aca('0x15'));var config=require(_0x9aca('0x16'));var licenseUtil=require(_0x9aca('0x17'));var db=require(_0x9aca('0x18'))['db'];config['redis']=_[_0x9aca('0x19')](config[_0x9aca('0x1a')],{'host':_0x9aca('0x1b'),'port':0x18eb});var socket=require(_0x9aca('0x1c'))(new Redis(config[_0x9aca('0x1a')]));require(_0x9aca('0x1d'))['register'](socket);var jayson=require(_0x9aca('0x1e'));var client=jayson['client'][_0x9aca('0x1f')]({'port':0x232c});var client9002=jayson['client'][_0x9aca('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x45d7bf,_0x47d2fa,_0x3429f3,_0x497951){return new BPromise(function(_0x106a40,_0x43116e){var _0x480062=_0x497951||client;return _0x480062[_0x9aca('0x20')](_0x45d7bf,_0x3429f3)['then'](function(_0x4008ca){logger['info'](_0x9aca('0x21'),_0x47d2fa,'request\x20sent');logger['debug'](_0x9aca('0x22'),_0x47d2fa,_0x9aca('0x23'),JSON[_0x9aca('0x24')](_0x4008ca));if(_0x4008ca[_0x9aca('0x25')]){if(_0x4008ca['error'][_0x9aca('0x26')]===0x1f4){logger[_0x9aca('0x25')](_0x9aca('0x21'),_0x47d2fa,_0x4008ca['error'][_0x9aca('0x27')]);return _0x43116e(_0x4008ca[_0x9aca('0x25')][_0x9aca('0x27')]);}logger[_0x9aca('0x25')]('ChatMessage,\x20%s,\x20%s',_0x47d2fa,_0x4008ca['error'][_0x9aca('0x27')]);return _0x106a40(_0x4008ca['error']['message']);}else{logger[_0x9aca('0x28')](_0x9aca('0x21'),_0x47d2fa,_0x9aca('0x23'));_0x106a40(_0x4008ca[_0x9aca('0x29')][_0x9aca('0x27')]);}})['catch'](function(_0x3e9ee4){logger[_0x9aca('0x25')](_0x9aca('0x21'),_0x47d2fa,_0x3e9ee4);_0x43116e(_0x3e9ee4);});});}function respondWithStatusCode(_0x2f8878,_0x179030){_0x179030=_0x179030||0xcc;return function(_0x253ff8){if(_0x253ff8){return _0x2f8878['sendStatus'](_0x179030);}return _0x2f8878['status'](_0x179030)[_0x9aca('0x2a')]();};}function respondWithResult(_0x3c25d9,_0x1fbf7b){_0x1fbf7b=_0x1fbf7b||0xc8;return function(_0x207966){if(_0x207966){return _0x3c25d9['status'](_0x1fbf7b)[_0x9aca('0x2b')](_0x207966);}};}function respondWithFilteredResult(_0x5659c9,_0x25056f){return function(_0x528a96){if(_0x528a96){var _0x2b3eec=typeof _0x25056f[_0x9aca('0x2c')]===_0x9aca('0x2d')&&typeof _0x25056f['limit']===_0x9aca('0x2d');var _0x39993f=_0x528a96[_0x9aca('0x2e')];var _0x457894=_0x2b3eec?0x0:_0x25056f[_0x9aca('0x2c')];var _0xf0bdfa=_0x2b3eec?_0x528a96['count']:_0x25056f['offset']+_0x25056f[_0x9aca('0x2f')];var _0x3de1be;if(_0xf0bdfa>=_0x39993f){_0xf0bdfa=_0x39993f;_0x3de1be=0xc8;}else{_0x3de1be=0xce;}_0x5659c9['status'](_0x3de1be);return _0x5659c9[_0x9aca('0x30')](_0x9aca('0x31'),_0x457894+'-'+_0xf0bdfa+'/'+_0x39993f)[_0x9aca('0x2b')](_0x528a96);}return null;};}function patchUpdates(_0x3b3aaf){return function(_0x337a1c){try{jsonpatch[_0x9aca('0x32')](_0x337a1c,_0x3b3aaf,!![]);}catch(_0x4e424e){return BPromise[_0x9aca('0x33')](_0x4e424e);}return _0x337a1c['save']();};}function saveUpdates(_0x27cd3c,_0x279128){return function(_0x3ea166){if(_0x3ea166){return _0x3ea166['update'](_0x27cd3c)[_0x9aca('0x34')](function(_0x44351f){return _0x44351f;});}return null;};}function removeEntity(_0x28bc68,_0xdddb1c){return function(_0x3d5986){if(_0x3d5986){return _0x3d5986[_0x9aca('0x35')]()[_0x9aca('0x34')](function(){_0x28bc68[_0x9aca('0x36')](0xcc)[_0x9aca('0x2a')]();});}};}function handleEntityNotFound(_0x2a87d8,_0xb623ed){return function(_0x4dad53){if(!_0x4dad53){_0x2a87d8[_0x9aca('0x37')](0x194);}return _0x4dad53;};}function handleError(_0x599b16,_0x5c9aac){_0x5c9aac=_0x5c9aac||0x1f4;return function(_0x2559b4){logger[_0x9aca('0x25')](_0x2559b4[_0x9aca('0x38')]);if(_0x2559b4[_0x9aca('0x39')]){delete _0x2559b4[_0x9aca('0x39')];}_0x599b16[_0x9aca('0x36')](_0x5c9aac)[_0x9aca('0x3a')](_0x2559b4);};}exports['index']=function(_0x272765,_0x577173){var _0x4665b4={},_0xb0bfb5={},_0x4f1923={'count':0x0,'rows':[]};var _0x2f95fa=_[_0x9aca('0x3b')](db['ChatMessage']['rawAttributes'],function(_0x24ac62){return{'name':_0x24ac62['fieldName'],'type':_0x24ac62[_0x9aca('0x3c')]['key']};});_0xb0bfb5[_0x9aca('0x3d')]=_[_0x9aca('0x3b')](_0x2f95fa,_0x9aca('0x39'));_0xb0bfb5['query']=_[_0x9aca('0x3e')](_0x272765[_0x9aca('0x3f')]);_0xb0bfb5['filters']=_[_0x9aca('0x40')](_0xb0bfb5[_0x9aca('0x3d')],_0xb0bfb5[_0x9aca('0x3f')]);_0x4665b4[_0x9aca('0x41')]=_[_0x9aca('0x40')](_0xb0bfb5[_0x9aca('0x3d')],qs['fields'](_0x272765['query'][_0x9aca('0x42')]));_0x4665b4[_0x9aca('0x41')]=_0x4665b4[_0x9aca('0x41')][_0x9aca('0x43')]?_0x4665b4['attributes']:_0xb0bfb5['model'];if(!_0x272765[_0x9aca('0x3f')][_0x9aca('0x44')](_0x9aca('0x45'))){_0x4665b4[_0x9aca('0x2f')]=qs['limit'](_0x272765[_0x9aca('0x3f')]['limit']);_0x4665b4['offset']=qs[_0x9aca('0x2c')](_0x272765[_0x9aca('0x3f')][_0x9aca('0x2c')]);}_0x4665b4[_0x9aca('0x46')]=qs[_0x9aca('0x47')](_0x272765[_0x9aca('0x3f')]['sort']);_0x4665b4['where']=qs[_0x9aca('0x48')](_[_0x9aca('0x49')](_0x272765[_0x9aca('0x3f')],_0xb0bfb5[_0x9aca('0x48')]),_0x2f95fa);if(_0x272765[_0x9aca('0x3f')][_0x9aca('0x4a')]){_0x4665b4[_0x9aca('0x4b')]=_['merge'](_0x4665b4[_0x9aca('0x4b')],{'$or':_[_0x9aca('0x3b')](_0x2f95fa,function(_0x4d043b){if(_0x4d043b[_0x9aca('0x3c')]!==_0x9aca('0x4c')){var _0x42f218={};_0x42f218[_0x4d043b['name']]={'$like':'%'+_0x272765['query'][_0x9aca('0x4a')]+'%'};return _0x42f218;}})});}_0x4665b4=_[_0x9aca('0x4d')]({},_0x4665b4,_0x272765[_0x9aca('0x4e')]);var _0x2f7cc4={'where':_0x4665b4[_0x9aca('0x4b')]};return db['ChatMessage'][_0x9aca('0x2e')](_0x2f7cc4)[_0x9aca('0x34')](function(_0x21fe96){_0x4f1923['count']=_0x21fe96;if(_0x272765['query'][_0x9aca('0x4f')]){_0x4665b4[_0x9aca('0x50')]=[{'all':!![]}];}return db[_0x9aca('0x51')]['findAll'](_0x4665b4);})[_0x9aca('0x34')](function(_0x5d3e80){_0x4f1923[_0x9aca('0x52')]=_0x5d3e80;return _0x4f1923;})[_0x9aca('0x34')](respondWithFilteredResult(_0x577173,_0x4665b4))[_0x9aca('0x53')](handleError(_0x577173,null));};exports['show']=function(_0x2d8d05,_0x107fdd){var _0x24a1f6={'raw':!![],'where':{'id':_0x2d8d05[_0x9aca('0x54')]['id']}},_0x2b4001={};_0x2b4001[_0x9aca('0x3d')]=_[_0x9aca('0x3e')](db['ChatMessage'][_0x9aca('0x55')]);_0x2b4001['query']=_[_0x9aca('0x3e')](_0x2d8d05[_0x9aca('0x3f')]);_0x2b4001[_0x9aca('0x48')]=_['intersection'](_0x2b4001[_0x9aca('0x3d')],_0x2b4001[_0x9aca('0x3f')]);_0x24a1f6['attributes']=_[_0x9aca('0x40')](_0x2b4001[_0x9aca('0x3d')],qs[_0x9aca('0x42')](_0x2d8d05[_0x9aca('0x3f')][_0x9aca('0x42')]));_0x24a1f6[_0x9aca('0x41')]=_0x24a1f6['attributes'][_0x9aca('0x43')]?_0x24a1f6[_0x9aca('0x41')]:_0x2b4001[_0x9aca('0x3d')];if(_0x2d8d05['query']['includeAll']){_0x24a1f6[_0x9aca('0x50')]=[{'all':!![]}];}_0x24a1f6=_[_0x9aca('0x4d')]({},_0x24a1f6,_0x2d8d05[_0x9aca('0x4e')]);return db[_0x9aca('0x51')][_0x9aca('0x56')](_0x24a1f6)[_0x9aca('0x34')](handleEntityNotFound(_0x107fdd,null))[_0x9aca('0x34')](respondWithResult(_0x107fdd,null))[_0x9aca('0x53')](handleError(_0x107fdd,null));};exports[_0x9aca('0x57')]=function(_0x15ebcb,_0x11d720){return db[_0x9aca('0x51')][_0x9aca('0x57')](_0x15ebcb[_0x9aca('0x58')],{})[_0x9aca('0x34')](respondWithResult(_0x11d720,0xc9))[_0x9aca('0x53')](handleError(_0x11d720,null));};exports[_0x9aca('0x59')]=function(_0x412802,_0x214bbd){if(_0x412802[_0x9aca('0x58')]['id']){delete _0x412802[_0x9aca('0x58')]['id'];}return db[_0x9aca('0x51')][_0x9aca('0x56')]({'where':{'id':_0x412802['params']['id']}})['then'](handleEntityNotFound(_0x214bbd,null))[_0x9aca('0x34')](saveUpdates(_0x412802['body'],null))[_0x9aca('0x34')](respondWithResult(_0x214bbd,null))['catch'](handleError(_0x214bbd,null));};exports[_0x9aca('0x35')]=function(_0xb31cc5,_0x5e858b){return db[_0x9aca('0x51')][_0x9aca('0x56')]({'where':{'id':_0xb31cc5[_0x9aca('0x54')]['id']}})[_0x9aca('0x34')](handleEntityNotFound(_0x5e858b,null))[_0x9aca('0x34')](removeEntity(_0x5e858b,null))[_0x9aca('0x53')](handleError(_0x5e858b,null));};exports[_0x9aca('0x5a')]=function(_0x3fc86c,_0x312a2b){return db[_0x9aca('0x51')][_0x9aca('0x5a')]()[_0x9aca('0x34')](respondWithResult(_0x312a2b,null))[_0x9aca('0x53')](handleError(_0x312a2b,null));};var interaction_log=require(_0x9aca('0x5b'))(_0x9aca('0x5c'));exports['accept']=function(_0x358ef9,_0x4d7364,_0x598340){var _0x36d8b4={'agent':{},'channel':_0x9aca('0x5d')};if(_0x358ef9['body']['id']){delete _0x358ef9[_0x9aca('0x58')]['id'];}_0x358ef9[_0x9aca('0x58')][_0x9aca('0x5e')]=!![];_0x358ef9['body'][_0x9aca('0x5f')]=moment()[_0x9aca('0x60')](_0x9aca('0x61'));_0x358ef9[_0x9aca('0x58')][_0x9aca('0x62')]=_0x358ef9[_0x9aca('0x58')][_0x9aca('0x62')]||_0x358ef9[_0x9aca('0x63')]['id'];_0x36d8b4[_0x9aca('0x64')]['id']=_0x358ef9['body'][_0x9aca('0x62')];return db[_0x9aca('0x51')][_0x9aca('0x56')]({'where':{'id':_0x358ef9[_0x9aca('0x54')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x4d7364,null))['then'](saveUpdates(_0x358ef9[_0x9aca('0x58')],null))[_0x9aca('0x34')](function(_0x58f7bc){if(_0x58f7bc){_0x36d8b4['message']=_0x58f7bc[_0x9aca('0x65')]({'plain':!![]});return db[_0x9aca('0x66')][_0x9aca('0x56')]({'where':{'id':_0x58f7bc['ChatInteractionId']}});}return null;})[_0x9aca('0x34')](handleEntityNotFound(_0x4d7364,null))[_0x9aca('0x34')](function(_0x3ad296){if(_0x3ad296){return _0x3ad296[_0x9aca('0x59')]({'UserId':_0x358ef9[_0x9aca('0x58')][_0x9aca('0x62')],'read1stAt':_[_0x9aca('0x67')](_0x3ad296[_0x9aca('0x68')])?moment()[_0x9aca('0x60')](_0x9aca('0x61')):undefined});}return null;})['then'](function(_0x58e50e){if(_0x58e50e){_0x36d8b4[_0x9aca('0x69')]=_0x58e50e[_0x9aca('0x65')]({'plain':!![]});interaction_log[_0x9aca('0x28')](_0x9aca('0x6a'),_0x358ef9['user']['id'],_0x358ef9[_0x9aca('0x63')][_0x9aca('0x39')],_0x358ef9[_0x9aca('0x63')]['role'],_0x36d8b4[_0x9aca('0x69')]['id'],_0x358ef9[_0x9aca('0x58')]?JSON[_0x9aca('0x24')](_0x358ef9[_0x9aca('0x58')]):_0x9aca('0x6b'));return respondWithRpcPromise('AcceptMessage',_0x9aca('0x6c'),_0x36d8b4);}return null;})[_0x9aca('0x34')](function(_0x5bf3e6){var _0x962496=_0x9aca('0x6d')+_0x5bf3e6[_0x9aca('0x27')][_0x9aca('0x6e')];return db[_0x9aca('0x6f')][_0x9aca('0x3f')](_0x962496,{'type':db['Sequelize'][_0x9aca('0x70')]['SELECT'],'raw':!![]})[_0x9aca('0x34')](function(_0x17443f){return _0x17443f;});})[_0x9aca('0x34')](function(_0xdae79b){if(_0xdae79b){_0x36d8b4[_0x9aca('0x27')][_0x9aca('0x71')]=_0xdae79b[0x0];if(!_0x358ef9['body']['UserId'])return;return db[_0x9aca('0x72')][_0x9aca('0x56')]({'where':{'id':_0x358ef9['body']['UserId'],'role':_0x9aca('0x64')},'attributes':['id',_0x9aca('0x39'),_0x9aca('0x73'),_0x9aca('0x74'),'internal'],'raw':!![]});}return null;})[_0x9aca('0x34')](function(_0x548777){if(!_0x548777)return null;_0x36d8b4[_0x9aca('0x27')][_0x9aca('0x64')]=_0x548777;return _0x36d8b4;})[_0x9aca('0x34')](function(_0x4a211f){if(_0x4a211f){if(_0x358ef9[_0x9aca('0x58')][_0x9aca('0x75')]){_0x36d8b4[_0x9aca('0x27')]['interface']=util['format'](_0x9aca('0x76'),_0x358ef9[_0x9aca('0x63')][_0x9aca('0x39')]);_0x36d8b4['message'][_0x9aca('0x77')]=_0x36d8b4['channel'];_0x36d8b4[_0x9aca('0x27')][_0x9aca('0x78')]=_0x36d8b4['channel'];_0x36d8b4[_0x9aca('0x27')]['event']=_0x9aca('0x79');return respondWithRpcPromise('EventManager',_0x9aca('0x7a'),{'event':'acceptmessage','message':_['merge'](_0x36d8b4[_0x9aca('0x27')],JSON[_0x9aca('0x7b')](_0x36d8b4[_0x9aca('0x69')]['formData']))},client9002)[_0x9aca('0x34')](function(){return _0x36d8b4;});}return _0x36d8b4;}return null;})[_0x9aca('0x34')](respondWithResult(_0x4d7364,null))[_0x9aca('0x53')](handleError(_0x4d7364,null));};var interaction_log=require(_0x9aca('0x5b'))(_0x9aca('0x5c'));exports[_0x9aca('0x33')]=function(_0x1ba296,_0x6c7355,_0x58efcd){var _0x3e5cdc={'agent':{},'channel':_0x9aca('0x5d')};if(_0x1ba296['body']['id']){delete _0x1ba296[_0x9aca('0x58')]['id'];}_0x1ba296[_0x9aca('0x58')][_0x9aca('0x62')]=_0x1ba296[_0x9aca('0x58')][_0x9aca('0x62')]||_0x1ba296[_0x9aca('0x63')]['id'];_0x3e5cdc[_0x9aca('0x64')]['id']=_0x1ba296[_0x9aca('0x58')][_0x9aca('0x62')];return db['ChatMessage'][_0x9aca('0x56')]({'where':{'id':_0x1ba296[_0x9aca('0x54')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x6c7355,null))['then'](function(_0x4d4b93){if(_0x4d4b93){_0x3e5cdc[_0x9aca('0x27')]=_0x4d4b93[_0x9aca('0x65')]({'plain':!![]});return db[_0x9aca('0x66')]['find']({'where':{'id':_0x4d4b93['ChatInteractionId']}});}return null;})[_0x9aca('0x34')](handleEntityNotFound(_0x6c7355,null))[_0x9aca('0x34')](function(_0x3bb7b6){if(_0x3bb7b6){_0x3e5cdc[_0x9aca('0x69')]=_0x3bb7b6['get']({'plain':!![]});interaction_log['info'](_0x9aca('0x7c'),_0x1ba296[_0x9aca('0x63')]['id'],_0x1ba296[_0x9aca('0x63')]['name'],_0x1ba296['user'][_0x9aca('0x7d')],_0x3e5cdc[_0x9aca('0x69')]['id'],_0x1ba296[_0x9aca('0x58')]?JSON[_0x9aca('0x24')](_0x1ba296['body']):_0x9aca('0x6b'));return respondWithRpcPromise(_0x9aca('0x7e'),_0x9aca('0x7f'),_0x3e5cdc);}return null;})[_0x9aca('0x34')](function(_0x348308){var _0x15d08a=_0x9aca('0x6d')+_0x348308[_0x9aca('0x27')][_0x9aca('0x6e')];return db[_0x9aca('0x6f')][_0x9aca('0x3f')](_0x15d08a,{'type':db[_0x9aca('0x80')]['QueryTypes'][_0x9aca('0x81')],'raw':!![]})[_0x9aca('0x34')](function(_0x1f04eb){return _0x1f04eb;});})[_0x9aca('0x34')](function(_0x3c0f9f){if(_0x3c0f9f){_0x3e5cdc[_0x9aca('0x27')]['contact']=_0x3c0f9f[0x0];if(!_0x1ba296[_0x9aca('0x58')]['UserId'])return;return db[_0x9aca('0x72')][_0x9aca('0x56')]({'where':{'id':_0x1ba296['body'][_0x9aca('0x62')],'role':_0x9aca('0x64')},'attributes':['id','name',_0x9aca('0x73'),_0x9aca('0x74'),'internal'],'raw':!![]});}return null;})[_0x9aca('0x34')](function(_0x2935e9){if(!_0x2935e9)return null;_0x3e5cdc[_0x9aca('0x27')]['agent']=_0x2935e9;return _0x3e5cdc;})[_0x9aca('0x34')](function(_0x26c6ee){if(_0x26c6ee){_0x26c6ee[_0x9aca('0x27')][_0x9aca('0x82')]=util['format'](_0x9aca('0x76'),_0x1ba296[_0x9aca('0x63')]['name']);_0x26c6ee[_0x9aca('0x27')][_0x9aca('0x77')]=_0x3e5cdc['channel'];_0x26c6ee['message'][_0x9aca('0x78')]=_0x3e5cdc['channel'];_0x26c6ee[_0x9aca('0x27')][_0x9aca('0x83')]=_0x9aca('0x33');respondWithRpcPromise(_0x9aca('0x7a'),_0x9aca('0x7a'),{'event':_0x9aca('0x84'),'message':_['merge'](_0x3e5cdc['message'],JSON[_0x9aca('0x7b')](_0x3e5cdc[_0x9aca('0x69')][_0x9aca('0x85')]))},client9002);return _0x3e5cdc;}return null;})[_0x9aca('0x34')](respondWithResult(_0x6c7355,null))[_0x9aca('0x53')](handleError(_0x6c7355,null));};
\ No newline at end of file