Built motion from commit da24aabd.|2.6.20
[motion2.git] / server / api / openchannelMessage / openchannelMessage.controller.js
index 03251d0..71defd6 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xff00=['include','findAll','rows','catch','params','create','body','find','describe','openchannel-interactions','openchannel','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','OpenchannelInteraction','isNil','read1stAt','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','Sequelize','SELECT','User','fullname','email','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','OpenchannelInteractionId','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','contact','internal','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','lodash','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','redis','defaults','localhost','register','jayson/promise','http','request','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','json','offset','limit','undefined','Content-Range','apply','reject','destroy','name','send','index','OpenchannelMessage','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','options','count','includeAll'];(function(_0xd3243c,_0x19721e){var _0x1991fa=function(_0x33178b){while(--_0x33178b){_0xd3243c['push'](_0xd3243c['shift']());}};_0x1991fa(++_0x19721e);}(_0xff00,0x1a6));var _0x0ff0=function(_0x34a9e3,_0x383032){_0x34a9e3=_0x34a9e3-0x0;var _0x332fa3=_0xff00[_0x34a9e3];return _0x332fa3;};'use strict';var emlformat=require(_0x0ff0('0x0'));var rimraf=require(_0x0ff0('0x1'));var zipdir=require(_0x0ff0('0x2'));var jsonpatch=require(_0x0ff0('0x3'));var rp=require('request-promise');var moment=require(_0x0ff0('0x4'));var BPromise=require(_0x0ff0('0x5'));var Mustache=require('mustache');var util=require(_0x0ff0('0x6'));var path=require(_0x0ff0('0x7'));var sox=require(_0x0ff0('0x8'));var csv=require(_0x0ff0('0x9'));var ejs=require(_0x0ff0('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0ff0('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0ff0('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0ff0('0xd'));var Redis=require('ioredis');var authService=require(_0x0ff0('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x0ff0('0xf'));var hardwareService=require(_0x0ff0('0x10'));var logger=require(_0x0ff0('0x11'))(_0x0ff0('0x12'));var utils=require('../../config/utils');var config=require(_0x0ff0('0x13'));var licenseUtil=require(_0x0ff0('0x14'));var db=require('../../mysqldb')['db'];config[_0x0ff0('0x15')]=_[_0x0ff0('0x16')](config[_0x0ff0('0x15')],{'host':_0x0ff0('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./openchannelMessage.socket')[_0x0ff0('0x18')](socket);var jayson=require(_0x0ff0('0x19'));var client=jayson['client'][_0x0ff0('0x1a')]({'port':0x232c});var client9002=jayson['client'][_0x0ff0('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x10d422,_0x43bd62,_0x5eef2f,_0xc15830){return new BPromise(function(_0x307127,_0xba175d){var _0x55ad62=_0xc15830||client;return _0x55ad62[_0x0ff0('0x1b')](_0x10d422,_0x5eef2f)[_0x0ff0('0x1c')](function(_0x1cdb63){logger[_0x0ff0('0x1d')](_0x0ff0('0x1e'),_0x43bd62,_0x0ff0('0x1f'));logger['debug'](_0x0ff0('0x20'),_0x43bd62,_0x0ff0('0x1f'),JSON[_0x0ff0('0x21')](_0x1cdb63));if(_0x1cdb63['error']){if(_0x1cdb63[_0x0ff0('0x22')][_0x0ff0('0x23')]===0x1f4){logger[_0x0ff0('0x22')]('OpenchannelMessage,\x20%s,\x20%s',_0x43bd62,_0x1cdb63[_0x0ff0('0x22')][_0x0ff0('0x24')]);return _0xba175d(_0x1cdb63[_0x0ff0('0x22')][_0x0ff0('0x24')]);}logger[_0x0ff0('0x22')]('OpenchannelMessage,\x20%s,\x20%s',_0x43bd62,_0x1cdb63[_0x0ff0('0x22')][_0x0ff0('0x24')]);return _0x307127(_0x1cdb63[_0x0ff0('0x22')][_0x0ff0('0x24')]);}else{logger[_0x0ff0('0x1d')](_0x0ff0('0x1e'),_0x43bd62,_0x0ff0('0x1f'));_0x307127(_0x1cdb63[_0x0ff0('0x25')][_0x0ff0('0x24')]);}})['catch'](function(_0x1a9d06){logger[_0x0ff0('0x22')](_0x0ff0('0x1e'),_0x43bd62,_0x1a9d06);_0xba175d(_0x1a9d06);});});}function respondWithStatusCode(_0x5479f7,_0x1b43ec){_0x1b43ec=_0x1b43ec||0xcc;return function(_0x56666d){if(_0x56666d){return _0x5479f7[_0x0ff0('0x26')](_0x1b43ec);}return _0x5479f7[_0x0ff0('0x27')](_0x1b43ec)[_0x0ff0('0x28')]();};}function respondWithResult(_0x514655,_0x104977){_0x104977=_0x104977||0xc8;return function(_0x4c1915){if(_0x4c1915){return _0x514655['status'](_0x104977)[_0x0ff0('0x29')](_0x4c1915);}};}function respondWithFilteredResult(_0x28c66b,_0x22e92b){return function(_0x4acec8){if(_0x4acec8){var _0x56abec=typeof _0x22e92b[_0x0ff0('0x2a')]==='undefined'&&typeof _0x22e92b[_0x0ff0('0x2b')]===_0x0ff0('0x2c');var _0x5736a4=_0x4acec8['count'];var _0x5116ba=_0x56abec?0x0:_0x22e92b[_0x0ff0('0x2a')];var _0xec1ce2=_0x56abec?_0x4acec8['count']:_0x22e92b[_0x0ff0('0x2a')]+_0x22e92b[_0x0ff0('0x2b')];var _0x484b5d;if(_0xec1ce2>=_0x5736a4){_0xec1ce2=_0x5736a4;_0x484b5d=0xc8;}else{_0x484b5d=0xce;}_0x28c66b[_0x0ff0('0x27')](_0x484b5d);return _0x28c66b['set'](_0x0ff0('0x2d'),_0x5116ba+'-'+_0xec1ce2+'/'+_0x5736a4)[_0x0ff0('0x29')](_0x4acec8);}return null;};}function patchUpdates(_0x47cc4e){return function(_0x2556f9){try{jsonpatch[_0x0ff0('0x2e')](_0x2556f9,_0x47cc4e,!![]);}catch(_0xaaf14){return BPromise[_0x0ff0('0x2f')](_0xaaf14);}return _0x2556f9['save']();};}function saveUpdates(_0x44ef9e,_0x3d7271){return function(_0x20b6ca){if(_0x20b6ca){return _0x20b6ca['update'](_0x44ef9e)['then'](function(_0x5e54d9){return _0x5e54d9;});}return null;};}function removeEntity(_0xce3cbb,_0x4de7d2){return function(_0x3c5fe7){if(_0x3c5fe7){return _0x3c5fe7[_0x0ff0('0x30')]()[_0x0ff0('0x1c')](function(){_0xce3cbb[_0x0ff0('0x27')](0xcc)[_0x0ff0('0x28')]();});}};}function handleEntityNotFound(_0x58503b,_0x2c74c8){return function(_0x15a499){if(!_0x15a499){_0x58503b['sendStatus'](0x194);}return _0x15a499;};}function handleError(_0x2bf6bc,_0x59c799){_0x59c799=_0x59c799||0x1f4;return function(_0x1638ad){logger[_0x0ff0('0x22')](_0x1638ad['stack']);if(_0x1638ad[_0x0ff0('0x31')]){delete _0x1638ad[_0x0ff0('0x31')];}_0x2bf6bc['status'](_0x59c799)[_0x0ff0('0x32')](_0x1638ad);};}exports[_0x0ff0('0x33')]=function(_0x409a35,_0x59d1f8){var _0x47255e={},_0x2f4b93={},_0x38b12a={'count':0x0,'rows':[]};var _0x4433ed=_['map'](db[_0x0ff0('0x34')][_0x0ff0('0x35')],function(_0x16a53d){return{'name':_0x16a53d[_0x0ff0('0x36')],'type':_0x16a53d[_0x0ff0('0x37')]['key']};});_0x2f4b93[_0x0ff0('0x38')]=_[_0x0ff0('0x39')](_0x4433ed,_0x0ff0('0x31'));_0x2f4b93[_0x0ff0('0x3a')]=_[_0x0ff0('0x3b')](_0x409a35[_0x0ff0('0x3a')]);_0x2f4b93[_0x0ff0('0x3c')]=_[_0x0ff0('0x3d')](_0x2f4b93['model'],_0x2f4b93[_0x0ff0('0x3a')]);_0x47255e[_0x0ff0('0x3e')]=_['intersection'](_0x2f4b93['model'],qs[_0x0ff0('0x3f')](_0x409a35[_0x0ff0('0x3a')][_0x0ff0('0x3f')]));_0x47255e['attributes']=_0x47255e[_0x0ff0('0x3e')][_0x0ff0('0x40')]?_0x47255e['attributes']:_0x2f4b93[_0x0ff0('0x38')];if(!_0x409a35[_0x0ff0('0x3a')][_0x0ff0('0x41')](_0x0ff0('0x42'))){_0x47255e[_0x0ff0('0x2b')]=qs[_0x0ff0('0x2b')](_0x409a35['query'][_0x0ff0('0x2b')]);_0x47255e['offset']=qs[_0x0ff0('0x2a')](_0x409a35[_0x0ff0('0x3a')][_0x0ff0('0x2a')]);}_0x47255e['order']=qs[_0x0ff0('0x43')](_0x409a35[_0x0ff0('0x3a')][_0x0ff0('0x43')]);_0x47255e[_0x0ff0('0x44')]=qs['filters'](_['pick'](_0x409a35[_0x0ff0('0x3a')],_0x2f4b93[_0x0ff0('0x3c')]),_0x4433ed);if(_0x409a35[_0x0ff0('0x3a')][_0x0ff0('0x45')]){_0x47255e[_0x0ff0('0x44')]=_['merge'](_0x47255e[_0x0ff0('0x44')],{'$or':_['map'](_0x4433ed,function(_0x208645){if(_0x208645[_0x0ff0('0x37')]!=='VIRTUAL'){var _0x8b14b1={};_0x8b14b1[_0x208645['name']]={'$like':'%'+_0x409a35[_0x0ff0('0x3a')][_0x0ff0('0x45')]+'%'};return _0x8b14b1;}})});}_0x47255e=_[_0x0ff0('0x46')]({},_0x47255e,_0x409a35[_0x0ff0('0x47')]);var _0x3982a3={'where':_0x47255e['where']};return db[_0x0ff0('0x34')][_0x0ff0('0x48')](_0x3982a3)['then'](function(_0x178848){_0x38b12a[_0x0ff0('0x48')]=_0x178848;if(_0x409a35[_0x0ff0('0x3a')][_0x0ff0('0x49')]){_0x47255e[_0x0ff0('0x4a')]=[{'all':!![]}];}return db[_0x0ff0('0x34')][_0x0ff0('0x4b')](_0x47255e);})[_0x0ff0('0x1c')](function(_0x44629a){_0x38b12a[_0x0ff0('0x4c')]=_0x44629a;return _0x38b12a;})[_0x0ff0('0x1c')](respondWithFilteredResult(_0x59d1f8,_0x47255e))[_0x0ff0('0x4d')](handleError(_0x59d1f8,null));};exports['show']=function(_0x98bc45,_0x5812da){var _0x55ebde={'raw':!![],'where':{'id':_0x98bc45[_0x0ff0('0x4e')]['id']}},_0x431073={};_0x431073[_0x0ff0('0x38')]=_[_0x0ff0('0x3b')](db[_0x0ff0('0x34')]['rawAttributes']);_0x431073[_0x0ff0('0x3a')]=_[_0x0ff0('0x3b')](_0x98bc45[_0x0ff0('0x3a')]);_0x431073[_0x0ff0('0x3c')]=_[_0x0ff0('0x3d')](_0x431073[_0x0ff0('0x38')],_0x431073['query']);_0x55ebde['attributes']=_[_0x0ff0('0x3d')](_0x431073[_0x0ff0('0x38')],qs['fields'](_0x98bc45[_0x0ff0('0x3a')][_0x0ff0('0x3f')]));_0x55ebde[_0x0ff0('0x3e')]=_0x55ebde['attributes']['length']?_0x55ebde[_0x0ff0('0x3e')]:_0x431073['model'];if(_0x98bc45[_0x0ff0('0x3a')][_0x0ff0('0x49')]){_0x55ebde[_0x0ff0('0x4a')]=[{'all':!![]}];}_0x55ebde=_[_0x0ff0('0x46')]({},_0x55ebde,_0x98bc45[_0x0ff0('0x47')]);return db[_0x0ff0('0x34')]['find'](_0x55ebde)['then'](handleEntityNotFound(_0x5812da,null))[_0x0ff0('0x1c')](respondWithResult(_0x5812da,null))[_0x0ff0('0x4d')](handleError(_0x5812da,null));};exports[_0x0ff0('0x4f')]=function(_0x2f4870,_0x363eb7){return db[_0x0ff0('0x34')][_0x0ff0('0x4f')](_0x2f4870[_0x0ff0('0x50')],{})['then'](respondWithResult(_0x363eb7,0xc9))[_0x0ff0('0x4d')](handleError(_0x363eb7,null));};exports['update']=function(_0x148963,_0x28e294){if(_0x148963[_0x0ff0('0x50')]['id']){delete _0x148963[_0x0ff0('0x50')]['id'];}return db[_0x0ff0('0x34')]['find']({'where':{'id':_0x148963[_0x0ff0('0x4e')]['id']}})[_0x0ff0('0x1c')](handleEntityNotFound(_0x28e294,null))[_0x0ff0('0x1c')](saveUpdates(_0x148963[_0x0ff0('0x50')],null))['then'](respondWithResult(_0x28e294,null))[_0x0ff0('0x4d')](handleError(_0x28e294,null));};exports[_0x0ff0('0x30')]=function(_0xcce81f,_0x4c87e6){return db['OpenchannelMessage'][_0x0ff0('0x51')]({'where':{'id':_0xcce81f[_0x0ff0('0x4e')]['id']}})[_0x0ff0('0x1c')](handleEntityNotFound(_0x4c87e6,null))[_0x0ff0('0x1c')](removeEntity(_0x4c87e6,null))[_0x0ff0('0x4d')](handleError(_0x4c87e6,null));};exports[_0x0ff0('0x52')]=function(_0x5dc5fa,_0x4ffc49){return db['OpenchannelMessage']['describe']()[_0x0ff0('0x1c')](respondWithResult(_0x4ffc49,null))[_0x0ff0('0x4d')](handleError(_0x4ffc49,null));};var interaction_log=require(_0x0ff0('0x11'))(_0x0ff0('0x53'));exports['accept']=function(_0x257111,_0x55352a,_0x23459e){var _0x5dd2f5={'agent':{},'channel':_0x0ff0('0x54')};if(_0x257111[_0x0ff0('0x50')]['id']){delete _0x257111['body']['id'];}_0x257111[_0x0ff0('0x50')][_0x0ff0('0x55')]=!![];_0x257111['body'][_0x0ff0('0x56')]=moment()[_0x0ff0('0x57')](_0x0ff0('0x58'));_0x257111['body'][_0x0ff0('0x59')]=_0x257111[_0x0ff0('0x50')]['UserId']||_0x257111[_0x0ff0('0x5a')]['id'];_0x5dd2f5[_0x0ff0('0x5b')]['id']=_0x257111['body'][_0x0ff0('0x59')];return db['OpenchannelMessage']['find']({'where':{'id':_0x257111[_0x0ff0('0x4e')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x55352a,null))[_0x0ff0('0x1c')](saveUpdates(_0x257111[_0x0ff0('0x50')],null))['then'](function(_0x4274ba){if(_0x4274ba){_0x5dd2f5[_0x0ff0('0x24')]=_0x4274ba[_0x0ff0('0x5c')]({'plain':!![]});return db[_0x0ff0('0x5d')][_0x0ff0('0x51')]({'where':{'id':_0x4274ba['OpenchannelInteractionId']}});}return null;})[_0x0ff0('0x1c')](handleEntityNotFound(_0x55352a,null))[_0x0ff0('0x1c')](function(_0x19ce49){if(_0x19ce49){return _0x19ce49['update']({'UserId':_0x257111['body']['UserId'],'read1stAt':_[_0x0ff0('0x5e')](_0x19ce49[_0x0ff0('0x5f')])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x0ff0('0x1c')](function(_0x3c3f37){if(_0x3c3f37){_0x5dd2f5[_0x0ff0('0x60')]=_0x3c3f37[_0x0ff0('0x5c')]({'plain':!![]});interaction_log[_0x0ff0('0x1d')](_0x0ff0('0x61'),_0x257111[_0x0ff0('0x5a')]['id'],_0x257111['user'][_0x0ff0('0x31')],_0x257111['user'][_0x0ff0('0x62')],_0x5dd2f5[_0x0ff0('0x60')]['id'],_0x257111['body']?JSON[_0x0ff0('0x21')](_0x257111['body']):_0x0ff0('0x63'));return respondWithRpcPromise(_0x0ff0('0x64'),_0x0ff0('0x65'),_0x5dd2f5);}return null;})['then'](function(_0x16ba12){var _0x2bbb19='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x16ba12[_0x0ff0('0x24')]['ContactId'];return db['sequelize'][_0x0ff0('0x3a')](_0x2bbb19,{'type':db[_0x0ff0('0x66')]['QueryTypes'][_0x0ff0('0x67')],'raw':!![]})[_0x0ff0('0x1c')](function(_0x5638e4){return _0x5638e4;});})['then'](function(_0x4b8420){if(_0x4b8420){_0x5dd2f5[_0x0ff0('0x24')]['contact']=_0x4b8420[0x0];if(!_0x257111[_0x0ff0('0x50')]['UserId'])return;return db[_0x0ff0('0x68')][_0x0ff0('0x51')]({'where':{'id':_0x257111[_0x0ff0('0x50')]['UserId'],'role':_0x0ff0('0x5b')},'attributes':['id',_0x0ff0('0x31'),_0x0ff0('0x69'),_0x0ff0('0x6a'),'internal'],'raw':!![]});}return null;})[_0x0ff0('0x1c')](function(_0x2cb439){if(!_0x2cb439)return null;_0x5dd2f5[_0x0ff0('0x24')][_0x0ff0('0x5b')]=_0x2cb439;return _0x5dd2f5;})['then'](function(_0x2c7e24){if(_0x2c7e24){if(_0x257111['body'][_0x0ff0('0x6b')]){_0x5dd2f5['message'][_0x0ff0('0x6c')]=util[_0x0ff0('0x57')](_0x0ff0('0x6d'),_0x257111[_0x0ff0('0x5a')][_0x0ff0('0x31')]);_0x5dd2f5['message']['channel']=_0x5dd2f5[_0x0ff0('0x6e')];_0x5dd2f5['message'][_0x0ff0('0x6f')]=_0x5dd2f5[_0x0ff0('0x6e')];_0x5dd2f5['message'][_0x0ff0('0x70')]='accept';return respondWithRpcPromise(_0x0ff0('0x71'),'EventManager',{'event':'acceptmessage','message':_0x5dd2f5['message']},client9002)[_0x0ff0('0x1c')](function(){return _0x5dd2f5;});}return _0x5dd2f5;}return null;})['then'](respondWithResult(_0x55352a,null))['catch'](handleError(_0x55352a,null));};var interaction_log=require(_0x0ff0('0x11'))(_0x0ff0('0x53'));exports[_0x0ff0('0x2f')]=function(_0x246749,_0xfabe4d,_0x332b14){var _0x163d32={'agent':{},'channel':'openchannel'};if(_0x246749[_0x0ff0('0x50')]['id']){delete _0x246749[_0x0ff0('0x50')]['id'];}_0x246749[_0x0ff0('0x50')][_0x0ff0('0x59')]=_0x246749[_0x0ff0('0x50')][_0x0ff0('0x59')]||_0x246749[_0x0ff0('0x5a')]['id'];_0x163d32[_0x0ff0('0x5b')]['id']=_0x246749['body']['UserId'];return db[_0x0ff0('0x34')][_0x0ff0('0x51')]({'where':{'id':_0x246749[_0x0ff0('0x4e')]['id'],'UserId':null}})[_0x0ff0('0x1c')](handleEntityNotFound(_0xfabe4d,null))[_0x0ff0('0x1c')](function(_0x1df378){if(_0x1df378){_0x163d32[_0x0ff0('0x24')]=_0x1df378['get']({'plain':!![]});return db[_0x0ff0('0x5d')][_0x0ff0('0x51')]({'where':{'id':_0x1df378[_0x0ff0('0x72')]}});}return null;})[_0x0ff0('0x1c')](handleEntityNotFound(_0xfabe4d,null))[_0x0ff0('0x1c')](function(_0x1f5e8c){if(_0x1f5e8c){_0x163d32[_0x0ff0('0x60')]=_0x1f5e8c[_0x0ff0('0x5c')]({'plain':!![]});interaction_log[_0x0ff0('0x1d')](_0x0ff0('0x73'),_0x246749['user']['id'],_0x246749[_0x0ff0('0x5a')][_0x0ff0('0x31')],_0x246749['user'][_0x0ff0('0x62')],_0x163d32[_0x0ff0('0x60')]['id'],_0x246749['body']?JSON[_0x0ff0('0x21')](_0x246749['body']):_0x0ff0('0x63'));return respondWithRpcPromise(_0x0ff0('0x74'),_0x0ff0('0x75'),_0x163d32);}return null;})[_0x0ff0('0x1c')](function(_0x4e508a){var _0x1db09a=_0x0ff0('0x76')+_0x4e508a[_0x0ff0('0x24')][_0x0ff0('0x77')];return db[_0x0ff0('0x78')][_0x0ff0('0x3a')](_0x1db09a,{'type':db[_0x0ff0('0x66')]['QueryTypes'][_0x0ff0('0x67')],'raw':!![]})[_0x0ff0('0x1c')](function(_0x5ad347){return _0x5ad347;});})[_0x0ff0('0x1c')](function(_0x3d8740){if(_0x3d8740){_0x163d32[_0x0ff0('0x24')][_0x0ff0('0x79')]=_0x3d8740[0x0];if(!_0x246749[_0x0ff0('0x50')][_0x0ff0('0x59')])return;return db[_0x0ff0('0x68')][_0x0ff0('0x51')]({'where':{'id':_0x246749[_0x0ff0('0x50')][_0x0ff0('0x59')],'role':'agent'},'attributes':['id',_0x0ff0('0x31'),_0x0ff0('0x69'),_0x0ff0('0x6a'),_0x0ff0('0x7a')],'raw':!![]});}return null;})[_0x0ff0('0x1c')](function(_0x52e34f){if(!_0x52e34f)return null;_0x163d32[_0x0ff0('0x24')][_0x0ff0('0x5b')]=_0x52e34f;return _0x163d32;})[_0x0ff0('0x1c')](function(_0x3a09c3){if(_0x3a09c3){_0x3a09c3['message']['interface']=util[_0x0ff0('0x57')](_0x0ff0('0x6d'),_0x246749[_0x0ff0('0x5a')][_0x0ff0('0x31')]);_0x3a09c3[_0x0ff0('0x24')]['channel']=_0x163d32[_0x0ff0('0x6e')];_0x3a09c3[_0x0ff0('0x24')][_0x0ff0('0x6f')]=_0x163d32[_0x0ff0('0x6e')];_0x3a09c3[_0x0ff0('0x24')][_0x0ff0('0x70')]=_0x0ff0('0x2f');respondWithRpcPromise(_0x0ff0('0x71'),_0x0ff0('0x71'),{'event':_0x0ff0('0x7b'),'message':_0x3a09c3['message']},client9002);return _0x163d32;}return null;})['then'](respondWithResult(_0xfabe4d,null))['catch'](handleError(_0xfabe4d,null));};
\ No newline at end of file
+var _0x5f6b=['zip-dir','fast-json-patch','request-promise','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','http','client','then','info','OpenchannelMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','OpenchannelMessage,\x20%s,\x20%s','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','destroy','index','map','OpenchannelMessage','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','params','options','find','create','body','update','describe','openchannel-interactions','accept','openchannel','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','OpenchannelInteraction','isNil','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','stringify','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','OpenchannelInteractionId','interaction','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','ContactId'];(function(_0x2ac622,_0x1fa2ab){var _0x58f106=function(_0x445cde){while(--_0x445cde){_0x2ac622['push'](_0x2ac622['shift']());}};_0x58f106(++_0x1fa2ab);}(_0x5f6b,0x81));var _0xb5f6=function(_0x404807,_0x510841){_0x404807=_0x404807-0x0;var _0x20cdfe=_0x5f6b[_0x404807];return _0x20cdfe;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xb5f6('0x0'));var jsonpatch=require(_0xb5f6('0x1'));var rp=require(_0xb5f6('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xb5f6('0x3'));var util=require(_0xb5f6('0x4'));var path=require('path');var sox=require(_0xb5f6('0x5'));var csv=require(_0xb5f6('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb5f6('0x7'));var squel=require(_0xb5f6('0x8'));var crypto=require(_0xb5f6('0x9'));var jsforce=require(_0xb5f6('0xa'));var deskjs=require(_0xb5f6('0xb'));var toCsv=require('to-csv');var querystring=require(_0xb5f6('0xc'));var Papa=require(_0xb5f6('0xd'));var Redis=require(_0xb5f6('0xe'));var authService=require(_0xb5f6('0xf'));var qs=require(_0xb5f6('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb5f6('0x11'));var logger=require(_0xb5f6('0x12'))(_0xb5f6('0x13'));var utils=require('../../config/utils');var config=require(_0xb5f6('0x14'));var licenseUtil=require(_0xb5f6('0x15'));var db=require(_0xb5f6('0x16'))['db'];config[_0xb5f6('0x17')]=_[_0xb5f6('0x18')](config[_0xb5f6('0x17')],{'host':_0xb5f6('0x19'),'port':0x18eb});var socket=require(_0xb5f6('0x1a'))(new Redis(config[_0xb5f6('0x17')]));require('./openchannelMessage.socket')[_0xb5f6('0x1b')](socket);var jayson=require(_0xb5f6('0x1c'));var client=jayson['client'][_0xb5f6('0x1d')]({'port':0x232c});var client9002=jayson[_0xb5f6('0x1e')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5d5823,_0xfc9507,_0x1eb805,_0x113aaf){return new BPromise(function(_0x2776c2,_0x8c3557){var _0x2ec4ce=_0x113aaf||client;return _0x2ec4ce['request'](_0x5d5823,_0x1eb805)[_0xb5f6('0x1f')](function(_0x16bb32){logger[_0xb5f6('0x20')]('OpenchannelMessage,\x20%s,\x20%s',_0xfc9507,'request\x20sent');logger['debug'](_0xb5f6('0x21'),_0xfc9507,_0xb5f6('0x22'),JSON['stringify'](_0x16bb32));if(_0x16bb32[_0xb5f6('0x23')]){if(_0x16bb32['error'][_0xb5f6('0x24')]===0x1f4){logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0xfc9507,_0x16bb32[_0xb5f6('0x23')]['message']);return _0x8c3557(_0x16bb32[_0xb5f6('0x23')][_0xb5f6('0x25')]);}logger[_0xb5f6('0x23')](_0xb5f6('0x26'),_0xfc9507,_0x16bb32[_0xb5f6('0x23')]['message']);return _0x2776c2(_0x16bb32['error'][_0xb5f6('0x25')]);}else{logger[_0xb5f6('0x20')]('OpenchannelMessage,\x20%s,\x20%s',_0xfc9507,'request\x20sent');_0x2776c2(_0x16bb32['result'][_0xb5f6('0x25')]);}})[_0xb5f6('0x27')](function(_0x5d4316){logger[_0xb5f6('0x23')](_0xb5f6('0x26'),_0xfc9507,_0x5d4316);_0x8c3557(_0x5d4316);});});}function respondWithStatusCode(_0x26454b,_0x37cedd){_0x37cedd=_0x37cedd||0xcc;return function(_0x3cdf89){if(_0x3cdf89){return _0x26454b[_0xb5f6('0x28')](_0x37cedd);}return _0x26454b[_0xb5f6('0x29')](_0x37cedd)[_0xb5f6('0x2a')]();};}function respondWithResult(_0x1388d8,_0x56f42c){_0x56f42c=_0x56f42c||0xc8;return function(_0x566825){if(_0x566825){return _0x1388d8[_0xb5f6('0x29')](_0x56f42c)[_0xb5f6('0x2b')](_0x566825);}};}function respondWithFilteredResult(_0x6a5707,_0xc499f1){return function(_0x29cb1a){if(_0x29cb1a){var _0x33718d=typeof _0xc499f1[_0xb5f6('0x2c')]===_0xb5f6('0x2d')&&typeof _0xc499f1[_0xb5f6('0x2e')]===_0xb5f6('0x2d');var _0x1e1941=_0x29cb1a['count'];var _0x1fe54b=_0x33718d?0x0:_0xc499f1[_0xb5f6('0x2c')];var _0xb9a9a5=_0x33718d?_0x29cb1a[_0xb5f6('0x2f')]:_0xc499f1['offset']+_0xc499f1['limit'];var _0x8d1994;if(_0xb9a9a5>=_0x1e1941){_0xb9a9a5=_0x1e1941;_0x8d1994=0xc8;}else{_0x8d1994=0xce;}_0x6a5707['status'](_0x8d1994);return _0x6a5707[_0xb5f6('0x30')]('Content-Range',_0x1fe54b+'-'+_0xb9a9a5+'/'+_0x1e1941)[_0xb5f6('0x2b')](_0x29cb1a);}return null;};}function patchUpdates(_0x5982c){return function(_0x55fb5b){try{jsonpatch[_0xb5f6('0x31')](_0x55fb5b,_0x5982c,!![]);}catch(_0x2577bc){return BPromise[_0xb5f6('0x32')](_0x2577bc);}return _0x55fb5b[_0xb5f6('0x33')]();};}function saveUpdates(_0x1c4c4a,_0x5edac4){return function(_0x1da8ee){if(_0x1da8ee){return _0x1da8ee['update'](_0x1c4c4a)[_0xb5f6('0x1f')](function(_0xf9f5f3){return _0xf9f5f3;});}return null;};}function removeEntity(_0xaa6088,_0x427ef7){return function(_0xa65512){if(_0xa65512){return _0xa65512[_0xb5f6('0x34')]()[_0xb5f6('0x1f')](function(){_0xaa6088[_0xb5f6('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1971e5,_0xf0641b){return function(_0x38cd96){if(!_0x38cd96){_0x1971e5[_0xb5f6('0x28')](0x194);}return _0x38cd96;};}function handleError(_0x6b65b1,_0x129752){_0x129752=_0x129752||0x1f4;return function(_0xd62110){logger[_0xb5f6('0x23')](_0xd62110['stack']);if(_0xd62110['name']){delete _0xd62110['name'];}_0x6b65b1[_0xb5f6('0x29')](_0x129752)['send'](_0xd62110);};}exports[_0xb5f6('0x35')]=function(_0x37a3d1,_0x23d6b0){var _0x3ecfbd={},_0x46276d={},_0x34f143={'count':0x0,'rows':[]};var _0x54112f=_[_0xb5f6('0x36')](db[_0xb5f6('0x37')][_0xb5f6('0x38')],function(_0x1e2c00){return{'name':_0x1e2c00[_0xb5f6('0x39')],'type':_0x1e2c00[_0xb5f6('0x3a')][_0xb5f6('0x3b')]};});_0x46276d[_0xb5f6('0x3c')]=_[_0xb5f6('0x36')](_0x54112f,_0xb5f6('0x3d'));_0x46276d[_0xb5f6('0x3e')]=_[_0xb5f6('0x3f')](_0x37a3d1['query']);_0x46276d[_0xb5f6('0x40')]=_[_0xb5f6('0x41')](_0x46276d[_0xb5f6('0x3c')],_0x46276d['query']);_0x3ecfbd[_0xb5f6('0x42')]=_['intersection'](_0x46276d['model'],qs['fields'](_0x37a3d1[_0xb5f6('0x3e')][_0xb5f6('0x43')]));_0x3ecfbd[_0xb5f6('0x42')]=_0x3ecfbd[_0xb5f6('0x42')][_0xb5f6('0x44')]?_0x3ecfbd[_0xb5f6('0x42')]:_0x46276d[_0xb5f6('0x3c')];if(!_0x37a3d1[_0xb5f6('0x3e')][_0xb5f6('0x45')](_0xb5f6('0x46'))){_0x3ecfbd[_0xb5f6('0x2e')]=qs[_0xb5f6('0x2e')](_0x37a3d1[_0xb5f6('0x3e')][_0xb5f6('0x2e')]);_0x3ecfbd[_0xb5f6('0x2c')]=qs[_0xb5f6('0x2c')](_0x37a3d1[_0xb5f6('0x3e')][_0xb5f6('0x2c')]);}_0x3ecfbd['order']=qs[_0xb5f6('0x47')](_0x37a3d1[_0xb5f6('0x3e')][_0xb5f6('0x47')]);_0x3ecfbd[_0xb5f6('0x48')]=qs[_0xb5f6('0x40')](_[_0xb5f6('0x49')](_0x37a3d1[_0xb5f6('0x3e')],_0x46276d[_0xb5f6('0x40')]),_0x54112f);if(_0x37a3d1[_0xb5f6('0x3e')][_0xb5f6('0x4a')]){_0x3ecfbd[_0xb5f6('0x48')]=_['merge'](_0x3ecfbd[_0xb5f6('0x48')],{'$or':_[_0xb5f6('0x36')](_0x54112f,function(_0x3724f5){if(_0x3724f5[_0xb5f6('0x3a')]!==_0xb5f6('0x4b')){var _0x43fc94={};_0x43fc94[_0x3724f5[_0xb5f6('0x3d')]]={'$like':'%'+_0x37a3d1[_0xb5f6('0x3e')][_0xb5f6('0x4a')]+'%'};return _0x43fc94;}})});}_0x3ecfbd=_[_0xb5f6('0x4c')]({},_0x3ecfbd,_0x37a3d1['options']);var _0x2ff21d={'where':_0x3ecfbd[_0xb5f6('0x48')]};return db[_0xb5f6('0x37')]['count'](_0x2ff21d)[_0xb5f6('0x1f')](function(_0x351ed5){_0x34f143[_0xb5f6('0x2f')]=_0x351ed5;if(_0x37a3d1[_0xb5f6('0x3e')][_0xb5f6('0x4d')]){_0x3ecfbd[_0xb5f6('0x4e')]=[{'all':!![]}];}return db[_0xb5f6('0x37')][_0xb5f6('0x4f')](_0x3ecfbd);})['then'](function(_0x394a6d){_0x34f143[_0xb5f6('0x50')]=_0x394a6d;return _0x34f143;})[_0xb5f6('0x1f')](respondWithFilteredResult(_0x23d6b0,_0x3ecfbd))[_0xb5f6('0x27')](handleError(_0x23d6b0,null));};exports['show']=function(_0x3651bd,_0x2ae196){var _0x48c185={'raw':!![],'where':{'id':_0x3651bd[_0xb5f6('0x51')]['id']}},_0xaca302={};_0xaca302[_0xb5f6('0x3c')]=_['keys'](db['OpenchannelMessage'][_0xb5f6('0x38')]);_0xaca302['query']=_[_0xb5f6('0x3f')](_0x3651bd[_0xb5f6('0x3e')]);_0xaca302['filters']=_['intersection'](_0xaca302[_0xb5f6('0x3c')],_0xaca302['query']);_0x48c185['attributes']=_['intersection'](_0xaca302[_0xb5f6('0x3c')],qs[_0xb5f6('0x43')](_0x3651bd['query'][_0xb5f6('0x43')]));_0x48c185[_0xb5f6('0x42')]=_0x48c185[_0xb5f6('0x42')][_0xb5f6('0x44')]?_0x48c185[_0xb5f6('0x42')]:_0xaca302[_0xb5f6('0x3c')];if(_0x3651bd['query'][_0xb5f6('0x4d')]){_0x48c185[_0xb5f6('0x4e')]=[{'all':!![]}];}_0x48c185=_[_0xb5f6('0x4c')]({},_0x48c185,_0x3651bd[_0xb5f6('0x52')]);return db['OpenchannelMessage'][_0xb5f6('0x53')](_0x48c185)['then'](handleEntityNotFound(_0x2ae196,null))[_0xb5f6('0x1f')](respondWithResult(_0x2ae196,null))[_0xb5f6('0x27')](handleError(_0x2ae196,null));};exports[_0xb5f6('0x54')]=function(_0x24f585,_0x2179e9){return db[_0xb5f6('0x37')][_0xb5f6('0x54')](_0x24f585[_0xb5f6('0x55')],{})[_0xb5f6('0x1f')](respondWithResult(_0x2179e9,0xc9))[_0xb5f6('0x27')](handleError(_0x2179e9,null));};exports[_0xb5f6('0x56')]=function(_0x4663b2,_0x22464a){if(_0x4663b2[_0xb5f6('0x55')]['id']){delete _0x4663b2[_0xb5f6('0x55')]['id'];}return db[_0xb5f6('0x37')][_0xb5f6('0x53')]({'where':{'id':_0x4663b2[_0xb5f6('0x51')]['id']}})['then'](handleEntityNotFound(_0x22464a,null))[_0xb5f6('0x1f')](saveUpdates(_0x4663b2[_0xb5f6('0x55')],null))['then'](respondWithResult(_0x22464a,null))['catch'](handleError(_0x22464a,null));};exports[_0xb5f6('0x34')]=function(_0x186bb1,_0x5d90cb){return db[_0xb5f6('0x37')][_0xb5f6('0x53')]({'where':{'id':_0x186bb1[_0xb5f6('0x51')]['id']}})[_0xb5f6('0x1f')](handleEntityNotFound(_0x5d90cb,null))[_0xb5f6('0x1f')](removeEntity(_0x5d90cb,null))[_0xb5f6('0x27')](handleError(_0x5d90cb,null));};exports[_0xb5f6('0x57')]=function(_0x171881,_0x21321e){return db['OpenchannelMessage']['describe']()[_0xb5f6('0x1f')](respondWithResult(_0x21321e,null))[_0xb5f6('0x27')](handleError(_0x21321e,null));};var interaction_log=require('../../config/logger')(_0xb5f6('0x58'));exports[_0xb5f6('0x59')]=function(_0x5575e7,_0x434742,_0x3967f2){var _0x3d8a85={'agent':{},'channel':_0xb5f6('0x5a')};if(_0x5575e7['body']['id']){delete _0x5575e7[_0xb5f6('0x55')]['id'];}_0x5575e7['body'][_0xb5f6('0x5b')]=!![];_0x5575e7[_0xb5f6('0x55')][_0xb5f6('0x5c')]=moment()[_0xb5f6('0x5d')](_0xb5f6('0x5e'));_0x5575e7['body'][_0xb5f6('0x5f')]=_0x5575e7['body']['UserId']||_0x5575e7['user']['id'];_0x3d8a85[_0xb5f6('0x60')]['id']=_0x5575e7[_0xb5f6('0x55')][_0xb5f6('0x5f')];return db[_0xb5f6('0x37')][_0xb5f6('0x53')]({'where':{'id':_0x5575e7[_0xb5f6('0x51')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x434742,null))[_0xb5f6('0x1f')](saveUpdates(_0x5575e7[_0xb5f6('0x55')],null))[_0xb5f6('0x1f')](function(_0x248944){if(_0x248944){_0x3d8a85['message']=_0x248944[_0xb5f6('0x61')]({'plain':!![]});return db[_0xb5f6('0x62')][_0xb5f6('0x53')]({'where':{'id':_0x248944['OpenchannelInteractionId']}});}return null;})[_0xb5f6('0x1f')](handleEntityNotFound(_0x434742,null))[_0xb5f6('0x1f')](function(_0x2f55cf){if(_0x2f55cf){return _0x2f55cf['update']({'UserId':_0x5575e7[_0xb5f6('0x55')][_0xb5f6('0x5f')],'read1stAt':_[_0xb5f6('0x63')](_0x2f55cf['read1stAt'])?moment()[_0xb5f6('0x5d')](_0xb5f6('0x5e')):undefined});}return null;})['then'](function(_0x3e22de){if(_0x3e22de){_0x3d8a85['interaction']=_0x3e22de['get']({'plain':!![]});interaction_log[_0xb5f6('0x20')](_0xb5f6('0x64'),_0x5575e7[_0xb5f6('0x65')]['id'],_0x5575e7[_0xb5f6('0x65')]['name'],_0x5575e7[_0xb5f6('0x65')][_0xb5f6('0x66')],_0x3d8a85['interaction']['id'],_0x5575e7[_0xb5f6('0x55')]?JSON[_0xb5f6('0x67')](_0x5575e7[_0xb5f6('0x55')]):_0xb5f6('0x68'));return respondWithRpcPromise(_0xb5f6('0x69'),_0xb5f6('0x6a'),_0x3d8a85);}return null;})[_0xb5f6('0x1f')](function(_0xe828d1){var _0x6ac522=_0xb5f6('0x6b')+_0xe828d1[_0xb5f6('0x25')]['ContactId'];return db[_0xb5f6('0x6c')][_0xb5f6('0x3e')](_0x6ac522,{'type':db[_0xb5f6('0x6d')][_0xb5f6('0x6e')][_0xb5f6('0x6f')],'raw':!![]})['then'](function(_0x4d0487){return _0x4d0487;});})['then'](function(_0x288b58){if(_0x288b58){_0x3d8a85[_0xb5f6('0x25')][_0xb5f6('0x70')]=_0x288b58[0x0];if(!_0x5575e7[_0xb5f6('0x55')][_0xb5f6('0x5f')])return;return db[_0xb5f6('0x71')][_0xb5f6('0x53')]({'where':{'id':_0x5575e7['body'][_0xb5f6('0x5f')],'role':_0xb5f6('0x60')},'attributes':['id',_0xb5f6('0x3d'),_0xb5f6('0x72'),_0xb5f6('0x73'),_0xb5f6('0x74')],'raw':!![]});}return null;})[_0xb5f6('0x1f')](function(_0xaa5825){if(!_0xaa5825)return null;_0x3d8a85[_0xb5f6('0x25')][_0xb5f6('0x60')]=_0xaa5825;return _0x3d8a85;})['then'](function(_0x293e2f){if(_0x293e2f){if(_0x5575e7[_0xb5f6('0x55')]['manual']){_0x3d8a85[_0xb5f6('0x25')][_0xb5f6('0x75')]=util[_0xb5f6('0x5d')](_0xb5f6('0x76'),_0x5575e7['user'][_0xb5f6('0x3d')]);_0x3d8a85[_0xb5f6('0x25')][_0xb5f6('0x77')]=_0x3d8a85['channel'];_0x3d8a85[_0xb5f6('0x25')][_0xb5f6('0x78')]=_0x3d8a85['channel'];_0x3d8a85[_0xb5f6('0x25')][_0xb5f6('0x79')]='accept';return respondWithRpcPromise(_0xb5f6('0x7a'),_0xb5f6('0x7a'),{'event':_0xb5f6('0x7b'),'message':_0x3d8a85[_0xb5f6('0x25')]},client9002)[_0xb5f6('0x1f')](function(){return _0x3d8a85;});}return _0x3d8a85;}return null;})['then'](respondWithResult(_0x434742,null))[_0xb5f6('0x27')](handleError(_0x434742,null));};var interaction_log=require(_0xb5f6('0x12'))(_0xb5f6('0x58'));exports[_0xb5f6('0x32')]=function(_0x31f756,_0x460d71,_0x1076a){var _0x4c724e={'agent':{},'channel':'openchannel'};if(_0x31f756[_0xb5f6('0x55')]['id']){delete _0x31f756['body']['id'];}_0x31f756['body']['UserId']=_0x31f756[_0xb5f6('0x55')][_0xb5f6('0x5f')]||_0x31f756[_0xb5f6('0x65')]['id'];_0x4c724e[_0xb5f6('0x60')]['id']=_0x31f756['body']['UserId'];return db[_0xb5f6('0x37')][_0xb5f6('0x53')]({'where':{'id':_0x31f756[_0xb5f6('0x51')]['id'],'UserId':null}})[_0xb5f6('0x1f')](handleEntityNotFound(_0x460d71,null))['then'](function(_0xa67526){if(_0xa67526){_0x4c724e[_0xb5f6('0x25')]=_0xa67526[_0xb5f6('0x61')]({'plain':!![]});return db[_0xb5f6('0x62')][_0xb5f6('0x53')]({'where':{'id':_0xa67526[_0xb5f6('0x7c')]}});}return null;})['then'](handleEntityNotFound(_0x460d71,null))[_0xb5f6('0x1f')](function(_0x1e9e8a){if(_0x1e9e8a){_0x4c724e[_0xb5f6('0x7d')]=_0x1e9e8a['get']({'plain':!![]});interaction_log['info'](_0xb5f6('0x7e'),_0x31f756[_0xb5f6('0x65')]['id'],_0x31f756['user'][_0xb5f6('0x3d')],_0x31f756[_0xb5f6('0x65')][_0xb5f6('0x66')],_0x4c724e['interaction']['id'],_0x31f756[_0xb5f6('0x55')]?JSON['stringify'](_0x31f756['body']):_0xb5f6('0x68'));return respondWithRpcPromise('RejectMessage',_0xb5f6('0x7f'),_0x4c724e);}return null;})[_0xb5f6('0x1f')](function(_0xdf3857){var _0x2bb951=_0xb5f6('0x6b')+_0xdf3857['message'][_0xb5f6('0x80')];return db[_0xb5f6('0x6c')]['query'](_0x2bb951,{'type':db[_0xb5f6('0x6d')]['QueryTypes'][_0xb5f6('0x6f')],'raw':!![]})[_0xb5f6('0x1f')](function(_0x607097){return _0x607097;});})[_0xb5f6('0x1f')](function(_0x3e35c4){if(_0x3e35c4){_0x4c724e[_0xb5f6('0x25')][_0xb5f6('0x70')]=_0x3e35c4[0x0];if(!_0x31f756[_0xb5f6('0x55')][_0xb5f6('0x5f')])return;return db['User']['find']({'where':{'id':_0x31f756[_0xb5f6('0x55')][_0xb5f6('0x5f')],'role':_0xb5f6('0x60')},'attributes':['id',_0xb5f6('0x3d'),'fullname',_0xb5f6('0x73'),_0xb5f6('0x74')],'raw':!![]});}return null;})[_0xb5f6('0x1f')](function(_0x3e4c29){if(!_0x3e4c29)return null;_0x4c724e[_0xb5f6('0x25')][_0xb5f6('0x60')]=_0x3e4c29;return _0x4c724e;})[_0xb5f6('0x1f')](function(_0x44ee0b){if(_0x44ee0b){_0x44ee0b[_0xb5f6('0x25')][_0xb5f6('0x75')]=util[_0xb5f6('0x5d')](_0xb5f6('0x76'),_0x31f756['user'][_0xb5f6('0x3d')]);_0x44ee0b['message'][_0xb5f6('0x77')]=_0x4c724e[_0xb5f6('0x77')];_0x44ee0b[_0xb5f6('0x25')][_0xb5f6('0x78')]=_0x4c724e['channel'];_0x44ee0b['message']['event']='reject';respondWithRpcPromise('EventManager',_0xb5f6('0x7a'),{'event':'rejectmessage','message':_0x44ee0b[_0xb5f6('0x25')]},client9002);return _0x4c724e;}return null;})['then'](respondWithResult(_0x460d71,null))[_0xb5f6('0x27')](handleError(_0x460d71,null));};
\ No newline at end of file