Built motion from commit 85328c08.|2.5.50
[motion2.git] / server / api / openchannelMessage / openchannelMessage.controller.js
index e6e0644..ee12a52 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xcd6a=['merge','type','VIRTUAL','filter','options','OpenchannelMessage','includeAll','findAll','rows','catch','show','params','include','find','body','destroy','describe','openchannel-interactions','accept','openchannel','read','readAt','format','UserId','user','get','OpenchannelInteraction','OpenchannelInteractionId','update','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','Sequelize','QueryTypes','contact','User','agent','email','internal','interface','SIP/%s','channel','motionChannel','EventManager','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','ContactId','SELECT','rejectmessage','eml-format','fast-json-patch','request-promise','mustache','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','redis','localhost','socket.io-emitter','register','client','http','request','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','then','stack','name','send','index','map','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x2b2a8a,_0x2fe2b8){var _0x37ae21=function(_0x4becd9){while(--_0x4becd9){_0x2b2a8a['push'](_0x2b2a8a['shift']());}};_0x37ae21(++_0x2fe2b8);}(_0xcd6a,0x138));var _0xacd6=function(_0x1bd625,_0x3b2e7d){_0x1bd625=_0x1bd625-0x0;var _0x1333f0=_0xcd6a[_0x1bd625];return _0x1333f0;};'use strict';var emlformat=require(_0xacd6('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xacd6('0x1'));var rp=require(_0xacd6('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xacd6('0x3'));var util=require('util');var path=require('path');var sox=require(_0xacd6('0x4'));var csv=require('to-csv');var ejs=require(_0xacd6('0x5'));var fs=require('fs');var fs_extra=require(_0xacd6('0x6'));var _=require(_0xacd6('0x7'));var squel=require(_0xacd6('0x8'));var crypto=require(_0xacd6('0x9'));var jsforce=require(_0xacd6('0xa'));var deskjs=require(_0xacd6('0xb'));var toCsv=require(_0xacd6('0xc'));var querystring=require(_0xacd6('0xd'));var Papa=require('papaparse');var Redis=require(_0xacd6('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xacd6('0xf'));var as=require(_0xacd6('0x10'));var hardwareService=require(_0xacd6('0x11'));var logger=require(_0xacd6('0x12'))(_0xacd6('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xacd6('0x14'))['db'];config[_0xacd6('0x15')]=_['defaults'](config[_0xacd6('0x15')],{'host':_0xacd6('0x16'),'port':0x18eb});var socket=require(_0xacd6('0x17'))(new Redis(config[_0xacd6('0x15')]));require('./openchannelMessage.socket')[_0xacd6('0x18')](socket);var jayson=require('jayson/promise');var client=jayson[_0xacd6('0x19')][_0xacd6('0x1a')]({'port':0x232c});var client9002=jayson[_0xacd6('0x19')][_0xacd6('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x4beb03,_0x119278,_0x31a538,_0x2bdc3c){return new BPromise(function(_0x3b433c,_0x24f34d){var _0x173d8e=_0x2bdc3c||client;return _0x173d8e[_0xacd6('0x1b')](_0x4beb03,_0x31a538)['then'](function(_0x2c6866){logger[_0xacd6('0x1c')](_0xacd6('0x1d'),_0x119278,_0xacd6('0x1e'));logger['debug'](_0xacd6('0x1f'),_0x119278,_0xacd6('0x1e'),JSON[_0xacd6('0x20')](_0x2c6866));if(_0x2c6866[_0xacd6('0x21')]){if(_0x2c6866[_0xacd6('0x21')][_0xacd6('0x22')]===0x1f4){logger['error'](_0xacd6('0x1d'),_0x119278,_0x2c6866[_0xacd6('0x21')][_0xacd6('0x23')]);return _0x24f34d(_0x2c6866[_0xacd6('0x21')]['message']);}logger[_0xacd6('0x21')](_0xacd6('0x1d'),_0x119278,_0x2c6866[_0xacd6('0x21')][_0xacd6('0x23')]);return _0x3b433c(_0x2c6866['error'][_0xacd6('0x23')]);}else{logger['info'](_0xacd6('0x1d'),_0x119278,_0xacd6('0x1e'));_0x3b433c(_0x2c6866[_0xacd6('0x24')][_0xacd6('0x23')]);}})['catch'](function(_0x5aa33c){logger[_0xacd6('0x21')](_0xacd6('0x1d'),_0x119278,_0x5aa33c);_0x24f34d(_0x5aa33c);});});}function respondWithStatusCode(_0x62abb6,_0x420b50){_0x420b50=_0x420b50||0xcc;return function(_0x279a8c){if(_0x279a8c){return _0x62abb6[_0xacd6('0x25')](_0x420b50);}return _0x62abb6[_0xacd6('0x26')](_0x420b50)[_0xacd6('0x27')]();};}function respondWithResult(_0x854f10,_0x32b9ae){_0x32b9ae=_0x32b9ae||0xc8;return function(_0x34b504){if(_0x34b504){return _0x854f10[_0xacd6('0x26')](_0x32b9ae)[_0xacd6('0x28')](_0x34b504);}};}function respondWithFilteredResult(_0x17af03,_0x146515){return function(_0x1287fa){if(_0x1287fa){var _0x29341d=typeof _0x146515['offset']===_0xacd6('0x29')&&typeof _0x146515[_0xacd6('0x2a')]===_0xacd6('0x29');var _0x1107df=_0x1287fa[_0xacd6('0x2b')];var _0x38ddfe=_0x29341d?0x0:_0x146515[_0xacd6('0x2c')];var _0x569f83=_0x29341d?_0x1287fa[_0xacd6('0x2b')]:_0x146515[_0xacd6('0x2c')]+_0x146515['limit'];var _0x2165e6;if(_0x569f83>=_0x1107df){_0x569f83=_0x1107df;_0x2165e6=0xc8;}else{_0x2165e6=0xce;}_0x17af03[_0xacd6('0x26')](_0x2165e6);return _0x17af03['set'](_0xacd6('0x2d'),_0x38ddfe+'-'+_0x569f83+'/'+_0x1107df)[_0xacd6('0x28')](_0x1287fa);}return null;};}function patchUpdates(_0x2d8059){return function(_0x9a5ffb){try{jsonpatch[_0xacd6('0x2e')](_0x9a5ffb,_0x2d8059,!![]);}catch(_0x1ca02d){return BPromise[_0xacd6('0x2f')](_0x1ca02d);}return _0x9a5ffb[_0xacd6('0x30')]();};}function saveUpdates(_0x2be0b6,_0x4b7ddc){return function(_0x293407){if(_0x293407){return _0x293407['update'](_0x2be0b6)['then'](function(_0x282d12){return _0x282d12;});}return null;};}function removeEntity(_0x59b099,_0x24e43d){return function(_0x33fcfe){if(_0x33fcfe){return _0x33fcfe['destroy']()[_0xacd6('0x31')](function(){_0x59b099[_0xacd6('0x26')](0xcc)[_0xacd6('0x27')]();});}};}function handleEntityNotFound(_0x164ceb,_0x2e6332){return function(_0x40c325){if(!_0x40c325){_0x164ceb[_0xacd6('0x25')](0x194);}return _0x40c325;};}function handleError(_0x40cfbd,_0x2507dd){_0x2507dd=_0x2507dd||0x1f4;return function(_0x122447){logger[_0xacd6('0x21')](_0x122447[_0xacd6('0x32')]);if(_0x122447['name']){delete _0x122447[_0xacd6('0x33')];}_0x40cfbd['status'](_0x2507dd)[_0xacd6('0x34')](_0x122447);};}exports[_0xacd6('0x35')]=function(_0x24f8f0,_0x1f3a55){var _0x54ac15={},_0x4be40b={},_0x41051f={'count':0x0,'rows':[]};var _0x127307=_[_0xacd6('0x36')](db['OpenchannelMessage'][_0xacd6('0x37')],function(_0x88ec03){return{'name':_0x88ec03[_0xacd6('0x38')],'type':_0x88ec03['type'][_0xacd6('0x39')]};});_0x4be40b['model']=_['map'](_0x127307,_0xacd6('0x33'));_0x4be40b[_0xacd6('0x3a')]=_[_0xacd6('0x3b')](_0x24f8f0[_0xacd6('0x3a')]);_0x4be40b[_0xacd6('0x3c')]=_[_0xacd6('0x3d')](_0x4be40b[_0xacd6('0x3e')],_0x4be40b[_0xacd6('0x3a')]);_0x54ac15[_0xacd6('0x3f')]=_[_0xacd6('0x3d')](_0x4be40b[_0xacd6('0x3e')],qs[_0xacd6('0x40')](_0x24f8f0[_0xacd6('0x3a')][_0xacd6('0x40')]));_0x54ac15[_0xacd6('0x3f')]=_0x54ac15[_0xacd6('0x3f')][_0xacd6('0x41')]?_0x54ac15[_0xacd6('0x3f')]:_0x4be40b[_0xacd6('0x3e')];if(!_0x24f8f0['query'][_0xacd6('0x42')](_0xacd6('0x43'))){_0x54ac15[_0xacd6('0x2a')]=qs[_0xacd6('0x2a')](_0x24f8f0[_0xacd6('0x3a')][_0xacd6('0x2a')]);_0x54ac15[_0xacd6('0x2c')]=qs['offset'](_0x24f8f0[_0xacd6('0x3a')]['offset']);}_0x54ac15[_0xacd6('0x44')]=qs[_0xacd6('0x45')](_0x24f8f0[_0xacd6('0x3a')]['sort']);_0x54ac15[_0xacd6('0x46')]=qs[_0xacd6('0x3c')](_[_0xacd6('0x47')](_0x24f8f0['query'],_0x4be40b['filters']),_0x127307);if(_0x24f8f0[_0xacd6('0x3a')]['filter']){_0x54ac15[_0xacd6('0x46')]=_[_0xacd6('0x48')](_0x54ac15[_0xacd6('0x46')],{'$or':_[_0xacd6('0x36')](_0x127307,function(_0x1fcac0){if(_0x1fcac0[_0xacd6('0x49')]!==_0xacd6('0x4a')){var _0x210b6f={};_0x210b6f[_0x1fcac0[_0xacd6('0x33')]]={'$like':'%'+_0x24f8f0['query'][_0xacd6('0x4b')]+'%'};return _0x210b6f;}})});}_0x54ac15=_['merge']({},_0x54ac15,_0x24f8f0[_0xacd6('0x4c')]);var _0x337975={'where':_0x54ac15['where']};return db[_0xacd6('0x4d')][_0xacd6('0x2b')](_0x337975)[_0xacd6('0x31')](function(_0x543311){_0x41051f[_0xacd6('0x2b')]=_0x543311;if(_0x24f8f0[_0xacd6('0x3a')][_0xacd6('0x4e')]){_0x54ac15['include']=[{'all':!![]}];}return db['OpenchannelMessage'][_0xacd6('0x4f')](_0x54ac15);})[_0xacd6('0x31')](function(_0x2d1430){_0x41051f[_0xacd6('0x50')]=_0x2d1430;return _0x41051f;})['then'](respondWithFilteredResult(_0x1f3a55,_0x54ac15))[_0xacd6('0x51')](handleError(_0x1f3a55,null));};exports[_0xacd6('0x52')]=function(_0xf947b9,_0x396f75){var _0x1a3414={'raw':!![],'where':{'id':_0xf947b9[_0xacd6('0x53')]['id']}},_0x203760={};_0x203760[_0xacd6('0x3e')]=_[_0xacd6('0x3b')](db[_0xacd6('0x4d')][_0xacd6('0x37')]);_0x203760[_0xacd6('0x3a')]=_[_0xacd6('0x3b')](_0xf947b9[_0xacd6('0x3a')]);_0x203760[_0xacd6('0x3c')]=_[_0xacd6('0x3d')](_0x203760['model'],_0x203760[_0xacd6('0x3a')]);_0x1a3414['attributes']=_[_0xacd6('0x3d')](_0x203760[_0xacd6('0x3e')],qs[_0xacd6('0x40')](_0xf947b9['query'][_0xacd6('0x40')]));_0x1a3414['attributes']=_0x1a3414[_0xacd6('0x3f')][_0xacd6('0x41')]?_0x1a3414['attributes']:_0x203760['model'];if(_0xf947b9[_0xacd6('0x3a')][_0xacd6('0x4e')]){_0x1a3414[_0xacd6('0x54')]=[{'all':!![]}];}_0x1a3414=_[_0xacd6('0x48')]({},_0x1a3414,_0xf947b9[_0xacd6('0x4c')]);return db[_0xacd6('0x4d')][_0xacd6('0x55')](_0x1a3414)[_0xacd6('0x31')](handleEntityNotFound(_0x396f75,null))['then'](respondWithResult(_0x396f75,null))[_0xacd6('0x51')](handleError(_0x396f75,null));};exports['create']=function(_0x58f636,_0x55b42d){return db['OpenchannelMessage']['create'](_0x58f636['body'],{})[_0xacd6('0x31')](respondWithResult(_0x55b42d,0xc9))[_0xacd6('0x51')](handleError(_0x55b42d,null));};exports['update']=function(_0x590cad,_0x4218e5){if(_0x590cad[_0xacd6('0x56')]['id']){delete _0x590cad[_0xacd6('0x56')]['id'];}return db[_0xacd6('0x4d')][_0xacd6('0x55')]({'where':{'id':_0x590cad[_0xacd6('0x53')]['id']}})[_0xacd6('0x31')](handleEntityNotFound(_0x4218e5,null))[_0xacd6('0x31')](saveUpdates(_0x590cad['body'],null))['then'](respondWithResult(_0x4218e5,null))['catch'](handleError(_0x4218e5,null));};exports[_0xacd6('0x57')]=function(_0x44e524,_0x5c5537){return db[_0xacd6('0x4d')][_0xacd6('0x55')]({'where':{'id':_0x44e524[_0xacd6('0x53')]['id']}})[_0xacd6('0x31')](handleEntityNotFound(_0x5c5537,null))[_0xacd6('0x31')](removeEntity(_0x5c5537,null))['catch'](handleError(_0x5c5537,null));};exports[_0xacd6('0x58')]=function(_0x301ac1,_0x1789b0){return db['OpenchannelMessage']['describe']()['then'](respondWithResult(_0x1789b0,null))[_0xacd6('0x51')](handleError(_0x1789b0,null));};var interaction_log=require(_0xacd6('0x12'))(_0xacd6('0x59'));exports[_0xacd6('0x5a')]=function(_0x33f06f,_0x7a80e6,_0x580ef2){var _0x1e99fb={'agent':{},'channel':_0xacd6('0x5b')};if(_0x33f06f[_0xacd6('0x56')]['id']){delete _0x33f06f[_0xacd6('0x56')]['id'];}_0x33f06f['body'][_0xacd6('0x5c')]=!![];_0x33f06f[_0xacd6('0x56')][_0xacd6('0x5d')]=moment()[_0xacd6('0x5e')]('YYYY-MM-DD\x20HH:mm:ss');_0x33f06f[_0xacd6('0x56')]['UserId']=_0x33f06f[_0xacd6('0x56')][_0xacd6('0x5f')]||_0x33f06f[_0xacd6('0x60')]['id'];_0x1e99fb['agent']['id']=_0x33f06f['body'][_0xacd6('0x5f')];return db['OpenchannelMessage'][_0xacd6('0x55')]({'where':{'id':_0x33f06f[_0xacd6('0x53')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x7a80e6,null))[_0xacd6('0x31')](saveUpdates(_0x33f06f[_0xacd6('0x56')],null))[_0xacd6('0x31')](function(_0x14c18f){if(_0x14c18f){_0x1e99fb[_0xacd6('0x23')]=_0x14c18f[_0xacd6('0x61')]({'plain':!![]});return db[_0xacd6('0x62')][_0xacd6('0x55')]({'where':{'id':_0x14c18f[_0xacd6('0x63')]}});}return null;})[_0xacd6('0x31')](handleEntityNotFound(_0x7a80e6,null))[_0xacd6('0x31')](function(_0x42e22c){if(_0x42e22c){return _0x42e22c[_0xacd6('0x64')]({'UserId':_0x33f06f[_0xacd6('0x56')][_0xacd6('0x5f')],'read1stAt':_[_0xacd6('0x65')](_0x42e22c[_0xacd6('0x66')])?moment()[_0xacd6('0x5e')](_0xacd6('0x67')):undefined});}return null;})[_0xacd6('0x31')](function(_0x3ae6ae){if(_0x3ae6ae){_0x1e99fb['interaction']=_0x3ae6ae['get']({'plain':!![]});interaction_log[_0xacd6('0x1c')](_0xacd6('0x68'),_0x33f06f[_0xacd6('0x60')]['id'],_0x33f06f[_0xacd6('0x60')][_0xacd6('0x33')],_0x33f06f[_0xacd6('0x60')][_0xacd6('0x69')],_0x1e99fb[_0xacd6('0x6a')]['id'],_0x33f06f['body']?JSON[_0xacd6('0x20')](_0x33f06f[_0xacd6('0x56')]):_0xacd6('0x6b'));return respondWithRpcPromise(_0xacd6('0x6c'),'acceptMessage',_0x1e99fb);}return null;})[_0xacd6('0x31')](function(_0x4e7033){var _0x2999ae=_0xacd6('0x6d')+_0x4e7033[_0xacd6('0x23')]['ContactId'];return db['sequelize'][_0xacd6('0x3a')](_0x2999ae,{'type':db[_0xacd6('0x6e')][_0xacd6('0x6f')]['SELECT'],'raw':!![]})[_0xacd6('0x31')](function(_0x27cea5){return _0x27cea5;});})[_0xacd6('0x31')](function(_0x12b92d){if(_0x12b92d){_0x1e99fb[_0xacd6('0x23')][_0xacd6('0x70')]=_0x12b92d[0x0];if(!_0x33f06f[_0xacd6('0x56')]['UserId'])return;return db[_0xacd6('0x71')][_0xacd6('0x55')]({'where':{'id':_0x33f06f[_0xacd6('0x56')][_0xacd6('0x5f')],'role':_0xacd6('0x72')},'attributes':['id',_0xacd6('0x33'),'fullname',_0xacd6('0x73'),_0xacd6('0x74')],'raw':!![]});}return null;})[_0xacd6('0x31')](function(_0x12e274){if(!_0x12e274)return null;_0x1e99fb[_0xacd6('0x23')][_0xacd6('0x72')]=_0x12e274;return _0x1e99fb;})[_0xacd6('0x31')](function(_0x5399ff){if(_0x5399ff){if(_0x33f06f[_0xacd6('0x56')]['manual']){_0x1e99fb[_0xacd6('0x23')][_0xacd6('0x75')]=util[_0xacd6('0x5e')](_0xacd6('0x76'),_0x33f06f[_0xacd6('0x60')][_0xacd6('0x33')]);_0x1e99fb[_0xacd6('0x23')][_0xacd6('0x77')]=_0x1e99fb[_0xacd6('0x77')];_0x1e99fb[_0xacd6('0x23')][_0xacd6('0x78')]=_0x1e99fb['channel'];_0x1e99fb['message']['event']=_0xacd6('0x5a');return respondWithRpcPromise(_0xacd6('0x79'),'EventManager',{'event':'acceptmessage','message':_0x1e99fb[_0xacd6('0x23')]},client9002)[_0xacd6('0x31')](function(){return _0x1e99fb;});}return _0x1e99fb;}return null;})[_0xacd6('0x31')](respondWithResult(_0x7a80e6,null))[_0xacd6('0x51')](handleError(_0x7a80e6,null));};var interaction_log=require(_0xacd6('0x12'))('openchannel-interactions');exports[_0xacd6('0x2f')]=function(_0x4dd8b4,_0x5d4817,_0x336495){var _0x5541ec={'agent':{},'channel':_0xacd6('0x5b')};if(_0x4dd8b4['body']['id']){delete _0x4dd8b4[_0xacd6('0x56')]['id'];}_0x4dd8b4[_0xacd6('0x56')][_0xacd6('0x5f')]=_0x4dd8b4[_0xacd6('0x56')][_0xacd6('0x5f')]||_0x4dd8b4[_0xacd6('0x60')]['id'];_0x5541ec['agent']['id']=_0x4dd8b4['body'][_0xacd6('0x5f')];return db[_0xacd6('0x4d')][_0xacd6('0x55')]({'where':{'id':_0x4dd8b4[_0xacd6('0x53')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x5d4817,null))[_0xacd6('0x31')](function(_0x516fd9){if(_0x516fd9){_0x5541ec[_0xacd6('0x23')]=_0x516fd9['get']({'plain':!![]});return db[_0xacd6('0x62')][_0xacd6('0x55')]({'where':{'id':_0x516fd9[_0xacd6('0x63')]}});}return null;})[_0xacd6('0x31')](handleEntityNotFound(_0x5d4817,null))['then'](function(_0x45a775){if(_0x45a775){_0x5541ec[_0xacd6('0x6a')]=_0x45a775['get']({'plain':!![]});interaction_log[_0xacd6('0x1c')](_0xacd6('0x7a'),_0x4dd8b4[_0xacd6('0x60')]['id'],_0x4dd8b4[_0xacd6('0x60')]['name'],_0x4dd8b4[_0xacd6('0x60')][_0xacd6('0x69')],_0x5541ec[_0xacd6('0x6a')]['id'],_0x4dd8b4[_0xacd6('0x56')]?JSON[_0xacd6('0x20')](_0x4dd8b4['body']):_0xacd6('0x6b'));return respondWithRpcPromise(_0xacd6('0x7b'),_0xacd6('0x7c'),_0x5541ec);}return null;})[_0xacd6('0x31')](function(_0x4b6f9f){var _0x34f4f8=_0xacd6('0x6d')+_0x4b6f9f[_0xacd6('0x23')][_0xacd6('0x7d')];return db['sequelize'][_0xacd6('0x3a')](_0x34f4f8,{'type':db[_0xacd6('0x6e')][_0xacd6('0x6f')][_0xacd6('0x7e')],'raw':!![]})[_0xacd6('0x31')](function(_0x1c074b){return _0x1c074b;});})[_0xacd6('0x31')](function(_0x3f569b){if(_0x3f569b){_0x5541ec[_0xacd6('0x23')][_0xacd6('0x70')]=_0x3f569b[0x0];if(!_0x4dd8b4[_0xacd6('0x56')]['UserId'])return;return db[_0xacd6('0x71')][_0xacd6('0x55')]({'where':{'id':_0x4dd8b4[_0xacd6('0x56')]['UserId'],'role':_0xacd6('0x72')},'attributes':['id',_0xacd6('0x33'),'fullname',_0xacd6('0x73'),_0xacd6('0x74')],'raw':!![]});}return null;})[_0xacd6('0x31')](function(_0x3d45e2){if(!_0x3d45e2)return null;_0x5541ec[_0xacd6('0x23')][_0xacd6('0x72')]=_0x3d45e2;return _0x5541ec;})[_0xacd6('0x31')](function(_0x188ce3){if(_0x188ce3){_0x188ce3[_0xacd6('0x23')][_0xacd6('0x75')]=util[_0xacd6('0x5e')]('SIP/%s',_0x4dd8b4['user'][_0xacd6('0x33')]);_0x188ce3[_0xacd6('0x23')]['channel']=_0x5541ec['channel'];_0x188ce3[_0xacd6('0x23')][_0xacd6('0x78')]=_0x5541ec[_0xacd6('0x77')];_0x188ce3[_0xacd6('0x23')]['event']=_0xacd6('0x2f');respondWithRpcPromise(_0xacd6('0x79'),'EventManager',{'event':_0xacd6('0x7f'),'message':_0x188ce3['message']},client9002);return _0x5541ec;}return null;})[_0xacd6('0x31')](respondWithResult(_0x5d4817,null))[_0xacd6('0x51')](handleError(_0x5d4817,null));};
\ No newline at end of file
+var _0xf1c7=['squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','jayson/promise','client','http','request','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','stack','name','map','OpenchannelMessage','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','pick','filter','where','merge','type','VIRTUAL','includeAll','findAll','rows','show','params','include','options','find','create','body','describe','accept','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','OpenchannelInteraction','OpenchannelInteractionId','isNil','read1stAt','format','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','openchannel-interactions','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','Sequelize','rejectmessage','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs'];(function(_0x912b06,_0x44db09){var _0x1d0f68=function(_0x56b7c3){while(--_0x56b7c3){_0x912b06['push'](_0x912b06['shift']());}};_0x1d0f68(++_0x44db09);}(_0xf1c7,0x193));var _0x7f1c=function(_0x4fdcc0,_0x560a01){_0x4fdcc0=_0x4fdcc0-0x0;var _0xc0ce94=_0xf1c7[_0x4fdcc0];return _0xc0ce94;};'use strict';var emlformat=require(_0x7f1c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7f1c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7f1c('0x2'));var moment=require(_0x7f1c('0x3'));var BPromise=require(_0x7f1c('0x4'));var Mustache=require(_0x7f1c('0x5'));var util=require(_0x7f1c('0x6'));var path=require(_0x7f1c('0x7'));var sox=require(_0x7f1c('0x8'));var csv=require(_0x7f1c('0x9'));var ejs=require(_0x7f1c('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x7f1c('0xb'));var crypto=require(_0x7f1c('0xc'));var jsforce=require(_0x7f1c('0xd'));var deskjs=require(_0x7f1c('0xe'));var toCsv=require(_0x7f1c('0x9'));var querystring=require(_0x7f1c('0xf'));var Papa=require(_0x7f1c('0x10'));var Redis=require(_0x7f1c('0x11'));var authService=require(_0x7f1c('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x7f1c('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7f1c('0x14'))(_0x7f1c('0x15'));var utils=require(_0x7f1c('0x16'));var config=require(_0x7f1c('0x17'));var licenseUtil=require(_0x7f1c('0x18'));var db=require(_0x7f1c('0x19'))['db'];config[_0x7f1c('0x1a')]=_[_0x7f1c('0x1b')](config[_0x7f1c('0x1a')],{'host':_0x7f1c('0x1c'),'port':0x18eb});var socket=require(_0x7f1c('0x1d'))(new Redis(config[_0x7f1c('0x1a')]));require(_0x7f1c('0x1e'))[_0x7f1c('0x1f')](socket);var jayson=require(_0x7f1c('0x20'));var client=jayson[_0x7f1c('0x21')][_0x7f1c('0x22')]({'port':0x232c});var client9002=jayson[_0x7f1c('0x21')][_0x7f1c('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x10a02b,_0x4b8aa7,_0x4d439b,_0xa67dbf){return new BPromise(function(_0x6c36f4,_0x1d18c3){var _0x13b849=_0xa67dbf||client;return _0x13b849[_0x7f1c('0x23')](_0x10a02b,_0x4d439b)[_0x7f1c('0x24')](function(_0x455827){logger[_0x7f1c('0x25')](_0x7f1c('0x26'),_0x4b8aa7,_0x7f1c('0x27'));logger[_0x7f1c('0x28')](_0x7f1c('0x29'),_0x4b8aa7,_0x7f1c('0x27'),JSON[_0x7f1c('0x2a')](_0x455827));if(_0x455827[_0x7f1c('0x2b')]){if(_0x455827['error'][_0x7f1c('0x2c')]===0x1f4){logger[_0x7f1c('0x2b')]('OpenchannelMessage,\x20%s,\x20%s',_0x4b8aa7,_0x455827[_0x7f1c('0x2b')][_0x7f1c('0x2d')]);return _0x1d18c3(_0x455827[_0x7f1c('0x2b')]['message']);}logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x4b8aa7,_0x455827[_0x7f1c('0x2b')][_0x7f1c('0x2d')]);return _0x6c36f4(_0x455827[_0x7f1c('0x2b')]['message']);}else{logger[_0x7f1c('0x25')](_0x7f1c('0x26'),_0x4b8aa7,'request\x20sent');_0x6c36f4(_0x455827[_0x7f1c('0x2e')][_0x7f1c('0x2d')]);}})[_0x7f1c('0x2f')](function(_0x57506e){logger[_0x7f1c('0x2b')](_0x7f1c('0x26'),_0x4b8aa7,_0x57506e);_0x1d18c3(_0x57506e);});});}function respondWithStatusCode(_0x252692,_0x57b2a8){_0x57b2a8=_0x57b2a8||0xcc;return function(_0x2e4001){if(_0x2e4001){return _0x252692[_0x7f1c('0x30')](_0x57b2a8);}return _0x252692[_0x7f1c('0x31')](_0x57b2a8)[_0x7f1c('0x32')]();};}function respondWithResult(_0x42208a,_0x34f9f9){_0x34f9f9=_0x34f9f9||0xc8;return function(_0x548f65){if(_0x548f65){return _0x42208a[_0x7f1c('0x31')](_0x34f9f9)[_0x7f1c('0x33')](_0x548f65);}};}function respondWithFilteredResult(_0x12ec44,_0x50d3ca){return function(_0x1b24e0){if(_0x1b24e0){var _0xa6316f=typeof _0x50d3ca[_0x7f1c('0x34')]===_0x7f1c('0x35')&&typeof _0x50d3ca['limit']==='undefined';var _0x34af6b=_0x1b24e0[_0x7f1c('0x36')];var _0x24a1a2=_0xa6316f?0x0:_0x50d3ca[_0x7f1c('0x34')];var _0x28729b=_0xa6316f?_0x1b24e0[_0x7f1c('0x36')]:_0x50d3ca[_0x7f1c('0x34')]+_0x50d3ca[_0x7f1c('0x37')];var _0x669d30;if(_0x28729b>=_0x34af6b){_0x28729b=_0x34af6b;_0x669d30=0xc8;}else{_0x669d30=0xce;}_0x12ec44[_0x7f1c('0x31')](_0x669d30);return _0x12ec44[_0x7f1c('0x38')](_0x7f1c('0x39'),_0x24a1a2+'-'+_0x28729b+'/'+_0x34af6b)[_0x7f1c('0x33')](_0x1b24e0);}return null;};}function patchUpdates(_0x4313ba){return function(_0xb14245){try{jsonpatch[_0x7f1c('0x3a')](_0xb14245,_0x4313ba,!![]);}catch(_0xc757f9){return BPromise[_0x7f1c('0x3b')](_0xc757f9);}return _0xb14245[_0x7f1c('0x3c')]();};}function saveUpdates(_0x2452d4,_0x596983){return function(_0x156055){if(_0x156055){return _0x156055[_0x7f1c('0x3d')](_0x2452d4)['then'](function(_0x78f131){return _0x78f131;});}return null;};}function removeEntity(_0x1b65b6,_0x301c23){return function(_0x3a4501){if(_0x3a4501){return _0x3a4501[_0x7f1c('0x3e')]()['then'](function(){_0x1b65b6[_0x7f1c('0x31')](0xcc)['end']();});}};}function handleEntityNotFound(_0x45ed8e,_0x85abc3){return function(_0x1313e8){if(!_0x1313e8){_0x45ed8e[_0x7f1c('0x30')](0x194);}return _0x1313e8;};}function handleError(_0x48646b,_0x5c2cc1){_0x5c2cc1=_0x5c2cc1||0x1f4;return function(_0x10780e){logger[_0x7f1c('0x2b')](_0x10780e[_0x7f1c('0x3f')]);if(_0x10780e[_0x7f1c('0x40')]){delete _0x10780e[_0x7f1c('0x40')];}_0x48646b[_0x7f1c('0x31')](_0x5c2cc1)['send'](_0x10780e);};}exports['index']=function(_0x40dcfa,_0x55af70){var _0x498f32={},_0xa532ac={},_0x2cc17c={'count':0x0,'rows':[]};var _0x480b1a=_[_0x7f1c('0x41')](db[_0x7f1c('0x42')][_0x7f1c('0x43')],function(_0x2ddc4f){return{'name':_0x2ddc4f[_0x7f1c('0x44')],'type':_0x2ddc4f['type'][_0x7f1c('0x45')]};});_0xa532ac[_0x7f1c('0x46')]=_[_0x7f1c('0x41')](_0x480b1a,_0x7f1c('0x40'));_0xa532ac[_0x7f1c('0x47')]=_[_0x7f1c('0x48')](_0x40dcfa['query']);_0xa532ac[_0x7f1c('0x49')]=_[_0x7f1c('0x4a')](_0xa532ac['model'],_0xa532ac[_0x7f1c('0x47')]);_0x498f32['attributes']=_[_0x7f1c('0x4a')](_0xa532ac[_0x7f1c('0x46')],qs[_0x7f1c('0x4b')](_0x40dcfa[_0x7f1c('0x47')]['fields']));_0x498f32[_0x7f1c('0x4c')]=_0x498f32[_0x7f1c('0x4c')][_0x7f1c('0x4d')]?_0x498f32[_0x7f1c('0x4c')]:_0xa532ac[_0x7f1c('0x46')];if(!_0x40dcfa[_0x7f1c('0x47')][_0x7f1c('0x4e')]('nolimit')){_0x498f32[_0x7f1c('0x37')]=qs[_0x7f1c('0x37')](_0x40dcfa['query'][_0x7f1c('0x37')]);_0x498f32['offset']=qs[_0x7f1c('0x34')](_0x40dcfa[_0x7f1c('0x47')][_0x7f1c('0x34')]);}_0x498f32[_0x7f1c('0x4f')]=qs['sort'](_0x40dcfa['query']['sort']);_0x498f32['where']=qs[_0x7f1c('0x49')](_[_0x7f1c('0x50')](_0x40dcfa[_0x7f1c('0x47')],_0xa532ac[_0x7f1c('0x49')]),_0x480b1a);if(_0x40dcfa[_0x7f1c('0x47')][_0x7f1c('0x51')]){_0x498f32[_0x7f1c('0x52')]=_[_0x7f1c('0x53')](_0x498f32[_0x7f1c('0x52')],{'$or':_[_0x7f1c('0x41')](_0x480b1a,function(_0x5f44b8){if(_0x5f44b8[_0x7f1c('0x54')]!==_0x7f1c('0x55')){var _0x3f549a={};_0x3f549a[_0x5f44b8[_0x7f1c('0x40')]]={'$like':'%'+_0x40dcfa[_0x7f1c('0x47')][_0x7f1c('0x51')]+'%'};return _0x3f549a;}})});}_0x498f32=_[_0x7f1c('0x53')]({},_0x498f32,_0x40dcfa['options']);var _0x2d8da4={'where':_0x498f32['where']};return db[_0x7f1c('0x42')]['count'](_0x2d8da4)[_0x7f1c('0x24')](function(_0x197435){_0x2cc17c[_0x7f1c('0x36')]=_0x197435;if(_0x40dcfa[_0x7f1c('0x47')][_0x7f1c('0x56')]){_0x498f32['include']=[{'all':!![]}];}return db['OpenchannelMessage'][_0x7f1c('0x57')](_0x498f32);})['then'](function(_0x430396){_0x2cc17c[_0x7f1c('0x58')]=_0x430396;return _0x2cc17c;})[_0x7f1c('0x24')](respondWithFilteredResult(_0x55af70,_0x498f32))['catch'](handleError(_0x55af70,null));};exports[_0x7f1c('0x59')]=function(_0x430bf6,_0x1ac7dc){var _0x13c2a5={'raw':!![],'where':{'id':_0x430bf6[_0x7f1c('0x5a')]['id']}},_0x40ad34={};_0x40ad34[_0x7f1c('0x46')]=_[_0x7f1c('0x48')](db['OpenchannelMessage'][_0x7f1c('0x43')]);_0x40ad34['query']=_[_0x7f1c('0x48')](_0x430bf6[_0x7f1c('0x47')]);_0x40ad34[_0x7f1c('0x49')]=_['intersection'](_0x40ad34[_0x7f1c('0x46')],_0x40ad34['query']);_0x13c2a5[_0x7f1c('0x4c')]=_[_0x7f1c('0x4a')](_0x40ad34[_0x7f1c('0x46')],qs[_0x7f1c('0x4b')](_0x430bf6[_0x7f1c('0x47')][_0x7f1c('0x4b')]));_0x13c2a5[_0x7f1c('0x4c')]=_0x13c2a5[_0x7f1c('0x4c')]['length']?_0x13c2a5[_0x7f1c('0x4c')]:_0x40ad34[_0x7f1c('0x46')];if(_0x430bf6[_0x7f1c('0x47')][_0x7f1c('0x56')]){_0x13c2a5[_0x7f1c('0x5b')]=[{'all':!![]}];}_0x13c2a5=_['merge']({},_0x13c2a5,_0x430bf6[_0x7f1c('0x5c')]);return db[_0x7f1c('0x42')][_0x7f1c('0x5d')](_0x13c2a5)['then'](handleEntityNotFound(_0x1ac7dc,null))[_0x7f1c('0x24')](respondWithResult(_0x1ac7dc,null))[_0x7f1c('0x2f')](handleError(_0x1ac7dc,null));};exports[_0x7f1c('0x5e')]=function(_0x589e93,_0x3de937){return db['OpenchannelMessage'][_0x7f1c('0x5e')](_0x589e93[_0x7f1c('0x5f')],{})[_0x7f1c('0x24')](respondWithResult(_0x3de937,0xc9))[_0x7f1c('0x2f')](handleError(_0x3de937,null));};exports[_0x7f1c('0x3d')]=function(_0x402315,_0x4a36bc){if(_0x402315[_0x7f1c('0x5f')]['id']){delete _0x402315['body']['id'];}return db['OpenchannelMessage'][_0x7f1c('0x5d')]({'where':{'id':_0x402315['params']['id']}})['then'](handleEntityNotFound(_0x4a36bc,null))[_0x7f1c('0x24')](saveUpdates(_0x402315[_0x7f1c('0x5f')],null))['then'](respondWithResult(_0x4a36bc,null))[_0x7f1c('0x2f')](handleError(_0x4a36bc,null));};exports[_0x7f1c('0x3e')]=function(_0x386ab8,_0x4f8420){return db[_0x7f1c('0x42')][_0x7f1c('0x5d')]({'where':{'id':_0x386ab8[_0x7f1c('0x5a')]['id']}})['then'](handleEntityNotFound(_0x4f8420,null))['then'](removeEntity(_0x4f8420,null))['catch'](handleError(_0x4f8420,null));};exports[_0x7f1c('0x60')]=function(_0x196748,_0x4b4cbb){return db[_0x7f1c('0x42')][_0x7f1c('0x60')]()[_0x7f1c('0x24')](respondWithResult(_0x4b4cbb,null))[_0x7f1c('0x2f')](handleError(_0x4b4cbb,null));};var interaction_log=require('../../config/logger')('openchannel-interactions');exports[_0x7f1c('0x61')]=function(_0xfc0f28,_0x21cd7a,_0x425a8c){var _0x3ae378={'agent':{},'channel':'openchannel'};if(_0xfc0f28[_0x7f1c('0x5f')]['id']){delete _0xfc0f28[_0x7f1c('0x5f')]['id'];}_0xfc0f28[_0x7f1c('0x5f')][_0x7f1c('0x62')]=!![];_0xfc0f28[_0x7f1c('0x5f')][_0x7f1c('0x63')]=moment()['format'](_0x7f1c('0x64'));_0xfc0f28['body'][_0x7f1c('0x65')]=_0xfc0f28[_0x7f1c('0x5f')]['UserId']||_0xfc0f28[_0x7f1c('0x66')]['id'];_0x3ae378[_0x7f1c('0x67')]['id']=_0xfc0f28[_0x7f1c('0x5f')][_0x7f1c('0x65')];return db[_0x7f1c('0x42')]['find']({'where':{'id':_0xfc0f28[_0x7f1c('0x5a')]['id'],'UserId':null}})[_0x7f1c('0x24')](handleEntityNotFound(_0x21cd7a,null))[_0x7f1c('0x24')](saveUpdates(_0xfc0f28['body'],null))[_0x7f1c('0x24')](function(_0xb6bf4a){if(_0xb6bf4a){_0x3ae378[_0x7f1c('0x2d')]=_0xb6bf4a[_0x7f1c('0x68')]({'plain':!![]});return db[_0x7f1c('0x69')][_0x7f1c('0x5d')]({'where':{'id':_0xb6bf4a[_0x7f1c('0x6a')]}});}return null;})['then'](handleEntityNotFound(_0x21cd7a,null))['then'](function(_0x2fc3c6){if(_0x2fc3c6){return _0x2fc3c6[_0x7f1c('0x3d')]({'UserId':_0xfc0f28[_0x7f1c('0x5f')][_0x7f1c('0x65')],'read1stAt':_[_0x7f1c('0x6b')](_0x2fc3c6[_0x7f1c('0x6c')])?moment()[_0x7f1c('0x6d')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x7f1c('0x24')](function(_0x5aba2c){if(_0x5aba2c){_0x3ae378[_0x7f1c('0x6e')]=_0x5aba2c[_0x7f1c('0x68')]({'plain':!![]});interaction_log['info'](_0x7f1c('0x6f'),_0xfc0f28[_0x7f1c('0x66')]['id'],_0xfc0f28[_0x7f1c('0x66')][_0x7f1c('0x40')],_0xfc0f28['user'][_0x7f1c('0x70')],_0x3ae378[_0x7f1c('0x6e')]['id'],_0xfc0f28[_0x7f1c('0x5f')]?JSON[_0x7f1c('0x2a')](_0xfc0f28[_0x7f1c('0x5f')]):_0x7f1c('0x71'));return respondWithRpcPromise('AcceptMessage',_0x7f1c('0x72'),_0x3ae378);}return null;})['then'](function(_0x5b492b){var _0x2b8a57=_0x7f1c('0x73')+_0x5b492b[_0x7f1c('0x2d')][_0x7f1c('0x74')];return db[_0x7f1c('0x75')][_0x7f1c('0x47')](_0x2b8a57,{'type':db['Sequelize'][_0x7f1c('0x76')][_0x7f1c('0x77')],'raw':!![]})[_0x7f1c('0x24')](function(_0x146f92){return _0x146f92;});})[_0x7f1c('0x24')](function(_0x2bab6d){if(_0x2bab6d){_0x3ae378['message'][_0x7f1c('0x78')]=_0x2bab6d[0x0];if(!_0xfc0f28[_0x7f1c('0x5f')][_0x7f1c('0x65')])return;return db[_0x7f1c('0x79')]['find']({'where':{'id':_0xfc0f28[_0x7f1c('0x5f')][_0x7f1c('0x65')],'role':_0x7f1c('0x67')},'attributes':['id',_0x7f1c('0x40'),_0x7f1c('0x7a'),_0x7f1c('0x7b'),_0x7f1c('0x7c')],'raw':!![]});}return null;})[_0x7f1c('0x24')](function(_0x4128c7){if(!_0x4128c7)return null;_0x3ae378[_0x7f1c('0x2d')][_0x7f1c('0x67')]=_0x4128c7;return _0x3ae378;})['then'](function(_0x52fa68){if(_0x52fa68){if(_0xfc0f28[_0x7f1c('0x5f')]['manual']){_0x3ae378['message'][_0x7f1c('0x7d')]=util[_0x7f1c('0x6d')](_0x7f1c('0x7e'),_0xfc0f28[_0x7f1c('0x66')][_0x7f1c('0x40')]);_0x3ae378[_0x7f1c('0x2d')][_0x7f1c('0x7f')]=_0x3ae378[_0x7f1c('0x7f')];_0x3ae378['message'][_0x7f1c('0x80')]=_0x3ae378[_0x7f1c('0x7f')];_0x3ae378[_0x7f1c('0x2d')][_0x7f1c('0x81')]=_0x7f1c('0x61');return respondWithRpcPromise(_0x7f1c('0x82'),_0x7f1c('0x82'),{'event':_0x7f1c('0x83'),'message':_0x3ae378['message']},client9002)[_0x7f1c('0x24')](function(){return _0x3ae378;});}return _0x3ae378;}return null;})[_0x7f1c('0x24')](respondWithResult(_0x21cd7a,null))[_0x7f1c('0x2f')](handleError(_0x21cd7a,null));};var interaction_log=require(_0x7f1c('0x14'))(_0x7f1c('0x84'));exports[_0x7f1c('0x3b')]=function(_0x5032e4,_0x3ebdc0,_0x140989){var _0x3003b6={'agent':{},'channel':'openchannel'};if(_0x5032e4['body']['id']){delete _0x5032e4[_0x7f1c('0x5f')]['id'];}_0x5032e4[_0x7f1c('0x5f')][_0x7f1c('0x65')]=_0x5032e4[_0x7f1c('0x5f')][_0x7f1c('0x65')]||_0x5032e4[_0x7f1c('0x66')]['id'];_0x3003b6[_0x7f1c('0x67')]['id']=_0x5032e4[_0x7f1c('0x5f')][_0x7f1c('0x65')];return db['OpenchannelMessage'][_0x7f1c('0x5d')]({'where':{'id':_0x5032e4[_0x7f1c('0x5a')]['id'],'UserId':null}})[_0x7f1c('0x24')](handleEntityNotFound(_0x3ebdc0,null))[_0x7f1c('0x24')](function(_0x1c0ac2){if(_0x1c0ac2){_0x3003b6[_0x7f1c('0x2d')]=_0x1c0ac2[_0x7f1c('0x68')]({'plain':!![]});return db[_0x7f1c('0x69')][_0x7f1c('0x5d')]({'where':{'id':_0x1c0ac2['OpenchannelInteractionId']}});}return null;})[_0x7f1c('0x24')](handleEntityNotFound(_0x3ebdc0,null))[_0x7f1c('0x24')](function(_0x19c43b){if(_0x19c43b){_0x3003b6[_0x7f1c('0x6e')]=_0x19c43b[_0x7f1c('0x68')]({'plain':!![]});interaction_log[_0x7f1c('0x25')](_0x7f1c('0x85'),_0x5032e4[_0x7f1c('0x66')]['id'],_0x5032e4[_0x7f1c('0x66')]['name'],_0x5032e4[_0x7f1c('0x66')][_0x7f1c('0x70')],_0x3003b6[_0x7f1c('0x6e')]['id'],_0x5032e4[_0x7f1c('0x5f')]?JSON[_0x7f1c('0x2a')](_0x5032e4[_0x7f1c('0x5f')]):_0x7f1c('0x71'));return respondWithRpcPromise(_0x7f1c('0x86'),_0x7f1c('0x87'),_0x3003b6);}return null;})[_0x7f1c('0x24')](function(_0x33f1aa){var _0x53fb5f='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x33f1aa['message'][_0x7f1c('0x74')];return db[_0x7f1c('0x75')]['query'](_0x53fb5f,{'type':db[_0x7f1c('0x88')][_0x7f1c('0x76')][_0x7f1c('0x77')],'raw':!![]})['then'](function(_0x4a869b){return _0x4a869b;});})[_0x7f1c('0x24')](function(_0x3a609c){if(_0x3a609c){_0x3003b6['message']['contact']=_0x3a609c[0x0];if(!_0x5032e4[_0x7f1c('0x5f')][_0x7f1c('0x65')])return;return db[_0x7f1c('0x79')]['find']({'where':{'id':_0x5032e4[_0x7f1c('0x5f')][_0x7f1c('0x65')],'role':_0x7f1c('0x67')},'attributes':['id','name','fullname',_0x7f1c('0x7b'),_0x7f1c('0x7c')],'raw':!![]});}return null;})[_0x7f1c('0x24')](function(_0x33374f){if(!_0x33374f)return null;_0x3003b6['message'][_0x7f1c('0x67')]=_0x33374f;return _0x3003b6;})[_0x7f1c('0x24')](function(_0x2b78c8){if(_0x2b78c8){_0x2b78c8[_0x7f1c('0x2d')][_0x7f1c('0x7d')]=util['format'](_0x7f1c('0x7e'),_0x5032e4[_0x7f1c('0x66')][_0x7f1c('0x40')]);_0x2b78c8[_0x7f1c('0x2d')][_0x7f1c('0x7f')]=_0x3003b6[_0x7f1c('0x7f')];_0x2b78c8['message']['motionChannel']=_0x3003b6[_0x7f1c('0x7f')];_0x2b78c8[_0x7f1c('0x2d')][_0x7f1c('0x81')]=_0x7f1c('0x3b');respondWithRpcPromise('EventManager',_0x7f1c('0x82'),{'event':_0x7f1c('0x89'),'message':_0x2b78c8[_0x7f1c('0x2d')]},client9002);return _0x3003b6;}return null;})['then'](respondWithResult(_0x3ebdc0,null))['catch'](handleError(_0x3ebdc0,null));};
\ No newline at end of file