Built motion from commit 9e1399f3.|2.5.37
[motion2.git] / server / api / whatsappMessage / whatsappMessage.controller.js
index 31409e3..0b12c4b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe2cf=['filter','merge','options','includeAll','WhatsappMessage','rows','params','fields','include','find','create','body','describe','whatsapp-interactions','accept','whatsapp','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','get','WhatsappInteraction','WhatsappInteractionId','isNil','format','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','null','acceptMessage','interface','SIP/%s','channel','event','acceptmessage','agent','RejectMessage','EventManager','rejectmessage','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','eml-format','zip-dir','request-promise','moment','bluebird','mustache','path','sox','lodash','squel','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','socket.io-emitter','register','jayson/promise','client','http','request','then','info','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','error','WhatsappMessage,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','sort','where','pick'];(function(_0x2838e8,_0x67d470){var _0x647292=function(_0xd030ef){while(--_0xd030ef){_0x2838e8['push'](_0x2838e8['shift']());}};_0x647292(++_0x67d470);}(_0xe2cf,0x1a1));var _0xfe2c=function(_0x448422,_0x362248){_0x448422=_0x448422-0x0;var _0xcc0afd=_0xe2cf[_0x448422];return _0xcc0afd;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xfe2c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfe2c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfe2c('0x2'));var moment=require(_0xfe2c('0x3'));var BPromise=require(_0xfe2c('0x4'));var Mustache=require(_0xfe2c('0x5'));var util=require('util');var path=require(_0xfe2c('0x6'));var sox=require(_0xfe2c('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xfe2c('0x8'));var squel=require(_0xfe2c('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xfe2c('0xa'));var toCsv=require(_0xfe2c('0xb'));var querystring=require(_0xfe2c('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xfe2c('0xd'));var qs=require(_0xfe2c('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfe2c('0xf'));var logger=require(_0xfe2c('0x10'))(_0xfe2c('0x11'));var utils=require(_0xfe2c('0x12'));var config=require(_0xfe2c('0x13'));var licenseUtil=require(_0xfe2c('0x14'));var db=require(_0xfe2c('0x15'))['db'];config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xfe2c('0x16'))(new Redis(config['redis']));require('./whatsappMessage.socket')[_0xfe2c('0x17')](socket);var jayson=require(_0xfe2c('0x18'));var client=jayson[_0xfe2c('0x19')][_0xfe2c('0x1a')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1a4684,_0x3b3ebd,_0x1dbed4,_0x56cebc){return new BPromise(function(_0x565f40,_0x199075){var _0x96a3a3=_0x56cebc||client;return _0x96a3a3[_0xfe2c('0x1b')](_0x1a4684,_0x1dbed4)[_0xfe2c('0x1c')](function(_0x36aeec){logger[_0xfe2c('0x1d')]('WhatsappMessage,\x20%s,\x20%s',_0x3b3ebd,_0xfe2c('0x1e'));logger[_0xfe2c('0x1f')](_0xfe2c('0x20'),_0x3b3ebd,_0xfe2c('0x1e'),JSON['stringify'](_0x36aeec));if(_0x36aeec[_0xfe2c('0x21')]){if(_0x36aeec['error']['code']===0x1f4){logger[_0xfe2c('0x21')](_0xfe2c('0x22'),_0x3b3ebd,_0x36aeec['error'][_0xfe2c('0x23')]);return _0x199075(_0x36aeec[_0xfe2c('0x21')]['message']);}logger[_0xfe2c('0x21')]('WhatsappMessage,\x20%s,\x20%s',_0x3b3ebd,_0x36aeec[_0xfe2c('0x21')][_0xfe2c('0x23')]);return _0x565f40(_0x36aeec[_0xfe2c('0x21')][_0xfe2c('0x23')]);}else{logger[_0xfe2c('0x1d')](_0xfe2c('0x22'),_0x3b3ebd,'request\x20sent');_0x565f40(_0x36aeec[_0xfe2c('0x24')][_0xfe2c('0x23')]);}})[_0xfe2c('0x25')](function(_0x26448c){logger[_0xfe2c('0x21')](_0xfe2c('0x22'),_0x3b3ebd,_0x26448c);_0x199075(_0x26448c);});});}function respondWithStatusCode(_0x53bab0,_0x205da8){_0x205da8=_0x205da8||0xcc;return function(_0x5e8abf){if(_0x5e8abf){return _0x53bab0[_0xfe2c('0x26')](_0x205da8);}return _0x53bab0[_0xfe2c('0x27')](_0x205da8)[_0xfe2c('0x28')]();};}function respondWithResult(_0x54e356,_0x377cc5){_0x377cc5=_0x377cc5||0xc8;return function(_0x344ca0){if(_0x344ca0){return _0x54e356['status'](_0x377cc5)[_0xfe2c('0x29')](_0x344ca0);}};}function respondWithFilteredResult(_0x1b6eb7,_0x3352e8){return function(_0x53a8c1){if(_0x53a8c1){var _0x170026=_0x53a8c1[_0xfe2c('0x2a')],_0x1b7c91=_0x3352e8[_0xfe2c('0x2b')],_0x55aed7=_0x3352e8[_0xfe2c('0x2b')]+_0x3352e8[_0xfe2c('0x2c')],_0x481219;if(_0x55aed7>=_0x170026){_0x55aed7=_0x170026;_0x481219=0xc8;}else{_0x481219=0xce;}_0x1b6eb7[_0xfe2c('0x27')](_0x481219);return _0x1b6eb7['set'](_0xfe2c('0x2d'),_0x1b7c91+'-'+_0x55aed7+'/'+_0x170026)[_0xfe2c('0x29')](_0x53a8c1);}return null;};}function patchUpdates(_0x3abba1){return function(_0x210c2e){try{jsonpatch[_0xfe2c('0x2e')](_0x210c2e,_0x3abba1,!![]);}catch(_0xabc499){return BPromise[_0xfe2c('0x2f')](_0xabc499);}return _0x210c2e[_0xfe2c('0x30')]();};}function saveUpdates(_0x2e09fe,_0x3facf9){return function(_0x306f10){if(_0x306f10){return _0x306f10[_0xfe2c('0x31')](_0x2e09fe)['then'](function(_0x10a0fa){return _0x10a0fa;});}return null;};}function removeEntity(_0x44de34,_0x278f0a){return function(_0x5a5f34){if(_0x5a5f34){return _0x5a5f34[_0xfe2c('0x32')]()[_0xfe2c('0x1c')](function(){_0x44de34['status'](0xcc)[_0xfe2c('0x28')]();});}};}function handleEntityNotFound(_0x448a84,_0xe7d224){return function(_0x54369b){if(!_0x54369b){_0x448a84[_0xfe2c('0x26')](0x194);}return _0x54369b;};}function handleError(_0x3a76ef,_0x2df7fa){_0x2df7fa=_0x2df7fa||0x1f4;return function(_0x39da8f){logger[_0xfe2c('0x21')](_0x39da8f[_0xfe2c('0x33')]);if(_0x39da8f[_0xfe2c('0x34')]){delete _0x39da8f['name'];}_0x3a76ef['status'](_0x2df7fa)[_0xfe2c('0x35')](_0x39da8f);};}exports[_0xfe2c('0x36')]=function(_0x2cf07c,_0x24baa1){var _0x4f9455={},_0x275c4f={},_0x492938={'count':0x0,'rows':[]};var _0x35aaee=_[_0xfe2c('0x37')](db['WhatsappMessage'][_0xfe2c('0x38')],function(_0x4a0ced){return{'name':_0x4a0ced['fieldName'],'type':_0x4a0ced[_0xfe2c('0x39')][_0xfe2c('0x3a')]};});_0x275c4f[_0xfe2c('0x3b')]=_[_0xfe2c('0x37')](_0x35aaee,_0xfe2c('0x34'));_0x275c4f[_0xfe2c('0x3c')]=_[_0xfe2c('0x3d')](_0x2cf07c[_0xfe2c('0x3c')]);_0x275c4f[_0xfe2c('0x3e')]=_[_0xfe2c('0x3f')](_0x275c4f[_0xfe2c('0x3b')],_0x275c4f['query']);_0x4f9455[_0xfe2c('0x40')]=_[_0xfe2c('0x3f')](_0x275c4f[_0xfe2c('0x3b')],qs['fields'](_0x2cf07c['query']['fields']));_0x4f9455[_0xfe2c('0x40')]=_0x4f9455[_0xfe2c('0x40')][_0xfe2c('0x41')]?_0x4f9455[_0xfe2c('0x40')]:_0x275c4f['model'];if(!_0x2cf07c[_0xfe2c('0x3c')][_0xfe2c('0x42')](_0xfe2c('0x43'))){_0x4f9455[_0xfe2c('0x2c')]=qs[_0xfe2c('0x2c')](_0x2cf07c['query'][_0xfe2c('0x2c')]);_0x4f9455[_0xfe2c('0x2b')]=qs[_0xfe2c('0x2b')](_0x2cf07c[_0xfe2c('0x3c')]['offset']);}_0x4f9455['order']=qs[_0xfe2c('0x44')](_0x2cf07c[_0xfe2c('0x3c')]['sort']);_0x4f9455[_0xfe2c('0x45')]=qs[_0xfe2c('0x3e')](_[_0xfe2c('0x46')](_0x2cf07c[_0xfe2c('0x3c')],_0x275c4f['filters']),_0x35aaee);if(_0x2cf07c[_0xfe2c('0x3c')][_0xfe2c('0x47')]){_0x4f9455[_0xfe2c('0x45')]=_[_0xfe2c('0x48')](_0x4f9455[_0xfe2c('0x45')],{'$or':_[_0xfe2c('0x37')](_0x35aaee,function(_0xef878d){if(_0xef878d[_0xfe2c('0x39')]!=='VIRTUAL'){var _0x435cac={};_0x435cac[_0xef878d['name']]={'$like':'%'+_0x2cf07c[_0xfe2c('0x3c')][_0xfe2c('0x47')]+'%'};return _0x435cac;}})});}_0x4f9455=_[_0xfe2c('0x48')]({},_0x4f9455,_0x2cf07c[_0xfe2c('0x49')]);var _0x55fa60={'where':_0x4f9455['where']};return db['WhatsappMessage']['count'](_0x55fa60)['then'](function(_0x31dcbc){_0x492938['count']=_0x31dcbc;if(_0x2cf07c['query'][_0xfe2c('0x4a')]){_0x4f9455['include']=[{'all':!![]}];}return db[_0xfe2c('0x4b')]['findAll'](_0x4f9455);})[_0xfe2c('0x1c')](function(_0x1f8b13){_0x492938[_0xfe2c('0x4c')]=_0x1f8b13;return _0x492938;})[_0xfe2c('0x1c')](respondWithFilteredResult(_0x24baa1,_0x4f9455))[_0xfe2c('0x25')](handleError(_0x24baa1,null));};exports['show']=function(_0x3dbd10,_0x384bd3){var _0xdd37e1={'raw':!![],'where':{'id':_0x3dbd10[_0xfe2c('0x4d')]['id']}},_0x5d47b1={};_0x5d47b1[_0xfe2c('0x3b')]=_['keys'](db['WhatsappMessage']['rawAttributes']);_0x5d47b1[_0xfe2c('0x3c')]=_[_0xfe2c('0x3d')](_0x3dbd10[_0xfe2c('0x3c')]);_0x5d47b1[_0xfe2c('0x3e')]=_[_0xfe2c('0x3f')](_0x5d47b1['model'],_0x5d47b1[_0xfe2c('0x3c')]);_0xdd37e1[_0xfe2c('0x40')]=_[_0xfe2c('0x3f')](_0x5d47b1['model'],qs['fields'](_0x3dbd10[_0xfe2c('0x3c')][_0xfe2c('0x4e')]));_0xdd37e1[_0xfe2c('0x40')]=_0xdd37e1[_0xfe2c('0x40')][_0xfe2c('0x41')]?_0xdd37e1[_0xfe2c('0x40')]:_0x5d47b1[_0xfe2c('0x3b')];if(_0x3dbd10[_0xfe2c('0x3c')][_0xfe2c('0x4a')]){_0xdd37e1[_0xfe2c('0x4f')]=[{'all':!![]}];}_0xdd37e1=_['merge']({},_0xdd37e1,_0x3dbd10[_0xfe2c('0x49')]);return db[_0xfe2c('0x4b')][_0xfe2c('0x50')](_0xdd37e1)[_0xfe2c('0x1c')](handleEntityNotFound(_0x384bd3,null))[_0xfe2c('0x1c')](respondWithResult(_0x384bd3,null))[_0xfe2c('0x25')](handleError(_0x384bd3,null));};exports[_0xfe2c('0x51')]=function(_0x158e70,_0x3a4d70){return db[_0xfe2c('0x4b')][_0xfe2c('0x51')](_0x158e70['body'],{})[_0xfe2c('0x1c')](respondWithResult(_0x3a4d70,0xc9))['catch'](handleError(_0x3a4d70,null));};exports[_0xfe2c('0x31')]=function(_0x4f4bc6,_0x4ba4a3){if(_0x4f4bc6['body']['id']){delete _0x4f4bc6[_0xfe2c('0x52')]['id'];}return db['WhatsappMessage'][_0xfe2c('0x50')]({'where':{'id':_0x4f4bc6['params']['id']}})[_0xfe2c('0x1c')](handleEntityNotFound(_0x4ba4a3,null))[_0xfe2c('0x1c')](saveUpdates(_0x4f4bc6[_0xfe2c('0x52')],null))[_0xfe2c('0x1c')](respondWithResult(_0x4ba4a3,null))[_0xfe2c('0x25')](handleError(_0x4ba4a3,null));};exports[_0xfe2c('0x32')]=function(_0x8f807c,_0x11d99e){return db[_0xfe2c('0x4b')]['find']({'where':{'id':_0x8f807c[_0xfe2c('0x4d')]['id']}})[_0xfe2c('0x1c')](handleEntityNotFound(_0x11d99e,null))[_0xfe2c('0x1c')](removeEntity(_0x11d99e,null))[_0xfe2c('0x25')](handleError(_0x11d99e,null));};exports[_0xfe2c('0x53')]=function(_0x5e6d96,_0x836aff){return db[_0xfe2c('0x4b')]['describe']()['then'](respondWithResult(_0x836aff,null))[_0xfe2c('0x25')](handleError(_0x836aff,null));};var interaction_log=require(_0xfe2c('0x10'))(_0xfe2c('0x54'));exports[_0xfe2c('0x55')]=function(_0x16be1b,_0x1951bb,_0x306f81){var _0x510c61={'agent':{},'channel':_0xfe2c('0x56')};if(_0x16be1b[_0xfe2c('0x52')]['id']){delete _0x16be1b[_0xfe2c('0x52')]['id'];}_0x16be1b[_0xfe2c('0x52')][_0xfe2c('0x57')]=!![];_0x16be1b[_0xfe2c('0x52')][_0xfe2c('0x58')]=moment()['format'](_0xfe2c('0x59'));_0x16be1b['body'][_0xfe2c('0x5a')]=_0x16be1b[_0xfe2c('0x52')]['UserId']||_0x16be1b[_0xfe2c('0x5b')]['id'];_0x510c61['agent']['id']=_0x16be1b[_0xfe2c('0x52')][_0xfe2c('0x5a')];return db['WhatsappMessage'][_0xfe2c('0x50')]({'where':{'id':_0x16be1b['params']['id'],'UserId':null},'include':[{'model':db[_0xfe2c('0x5c')],'as':'Contact'}]})[_0xfe2c('0x1c')](handleEntityNotFound(_0x1951bb,null))[_0xfe2c('0x1c')](saveUpdates(_0x16be1b['body'],null))[_0xfe2c('0x1c')](function(_0x7a0a77){if(_0x7a0a77){_0x510c61[_0xfe2c('0x23')]=_0x7a0a77[_0xfe2c('0x5d')]({'plain':!![]});return db[_0xfe2c('0x5e')]['find']({'where':{'id':_0x7a0a77[_0xfe2c('0x5f')]}});}return null;})[_0xfe2c('0x1c')](handleEntityNotFound(_0x1951bb,null))[_0xfe2c('0x1c')](function(_0x264af9){if(_0x264af9){return _0x264af9['update']({'UserId':_0x16be1b[_0xfe2c('0x52')]['UserId'],'read1stAt':_[_0xfe2c('0x60')](_0x264af9['read1stAt'])?moment()[_0xfe2c('0x61')](_0xfe2c('0x59')):undefined});}return null;})[_0xfe2c('0x1c')](function(_0x281213){if(_0x281213){_0x510c61[_0xfe2c('0x62')]=_0x281213[_0xfe2c('0x5d')]({'plain':!![]});interaction_log[_0xfe2c('0x1d')](_0xfe2c('0x63'),_0x16be1b[_0xfe2c('0x5b')]['id'],_0x16be1b[_0xfe2c('0x5b')][_0xfe2c('0x34')],_0x16be1b[_0xfe2c('0x5b')][_0xfe2c('0x64')],_0x510c61[_0xfe2c('0x62')]['id'],_0x16be1b[_0xfe2c('0x52')]?JSON[_0xfe2c('0x65')](_0x16be1b['body']):_0xfe2c('0x66'));return respondWithRpcPromise('AcceptMessage',_0xfe2c('0x67'),_0x510c61);}return null;})['then'](function(_0x21f6ce){if(_0x21f6ce){if(_0x16be1b['body']['manual']){_0x510c61[_0xfe2c('0x23')][_0xfe2c('0x68')]=util[_0xfe2c('0x61')](_0xfe2c('0x69'),_0x16be1b[_0xfe2c('0x5b')]['name']);_0x510c61[_0xfe2c('0x23')][_0xfe2c('0x6a')]=_0x510c61['channel'];_0x510c61[_0xfe2c('0x23')][_0xfe2c('0x6b')]='accept';return respondWithRpcPromise('EventManager','EventManager',{'event':_0xfe2c('0x6c'),'message':_0x510c61[_0xfe2c('0x23')]},client9002)[_0xfe2c('0x1c')](function(){return _0x510c61;});}return _0x510c61;}return null;})['then'](respondWithResult(_0x1951bb,null))['catch'](handleError(_0x1951bb,null));};var interaction_log=require(_0xfe2c('0x10'))(_0xfe2c('0x54'));exports['reject']=function(_0x3508c2,_0x9c07d5,_0x5ac774){var _0x29412c={'agent':{},'channel':'whatsapp'};if(_0x3508c2['body']['id']){delete _0x3508c2[_0xfe2c('0x52')]['id'];}_0x3508c2[_0xfe2c('0x52')]['UserId']=_0x3508c2[_0xfe2c('0x52')][_0xfe2c('0x5a')]||_0x3508c2['user']['id'];_0x29412c[_0xfe2c('0x6d')]['id']=_0x3508c2['body']['UserId'];return db[_0xfe2c('0x4b')][_0xfe2c('0x50')]({'where':{'id':_0x3508c2['params']['id'],'UserId':null}})[_0xfe2c('0x1c')](handleEntityNotFound(_0x9c07d5,null))[_0xfe2c('0x1c')](function(_0x4feb8f){if(_0x4feb8f){_0x29412c[_0xfe2c('0x23')]=_0x4feb8f['get']({'plain':!![]});return db[_0xfe2c('0x5e')][_0xfe2c('0x50')]({'where':{'id':_0x4feb8f[_0xfe2c('0x5f')]}});}return null;})[_0xfe2c('0x1c')](handleEntityNotFound(_0x9c07d5,null))['then'](function(_0x10e0a0){if(_0x10e0a0){_0x29412c[_0xfe2c('0x62')]=_0x10e0a0['get']({'plain':!![]});interaction_log[_0xfe2c('0x1d')]('[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x3508c2[_0xfe2c('0x5b')]['id'],_0x3508c2['user'][_0xfe2c('0x34')],_0x3508c2[_0xfe2c('0x5b')]['role'],_0x29412c[_0xfe2c('0x62')]['id'],_0x3508c2[_0xfe2c('0x52')]?JSON[_0xfe2c('0x65')](_0x3508c2[_0xfe2c('0x52')]):_0xfe2c('0x66'));return respondWithRpcPromise(_0xfe2c('0x6e'),'rejectMessage',_0x29412c);}return null;})[_0xfe2c('0x1c')](function(_0x524fac){if(_0x524fac){_0x524fac['message'][_0xfe2c('0x68')]=util[_0xfe2c('0x61')](_0xfe2c('0x69'),_0x3508c2[_0xfe2c('0x5b')][_0xfe2c('0x34')]);_0x524fac[_0xfe2c('0x23')]['channel']=_0x29412c[_0xfe2c('0x6a')];_0x524fac[_0xfe2c('0x23')][_0xfe2c('0x6b')]=_0xfe2c('0x2f');respondWithRpcPromise('EventManager',_0xfe2c('0x6f'),{'event':_0xfe2c('0x70'),'message':_0x524fac[_0xfe2c('0x23')]},client9002);return _0x29412c;}return null;})[_0xfe2c('0x1c')](respondWithResult(_0x9c07d5,null))['catch'](handleError(_0x9c07d5,null));};exports[_0xfe2c('0x27')]=function(_0x540a67,_0x49f9e1,_0x565504){if(_0x540a67[_0xfe2c('0x52')]['id']){delete _0x540a67[_0xfe2c('0x52')]['id'];}var _0x3d4c3e;return db[_0xfe2c('0x4b')][_0xfe2c('0x50')]({'where':{'id':_0x540a67[_0xfe2c('0x4d')]['id']}})[_0xfe2c('0x1c')](handleEntityNotFound(_0x49f9e1,null))[_0xfe2c('0x1c')](function(_0x3a4409){if(_0x3a4409){_0x3d4c3e=_0x3a4409;return db['WhatsappAccount']['find']({'where':{'id':_0x3a4409[_0xfe2c('0x71')]}});}})[_0xfe2c('0x1c')](handleEntityNotFound(_0x49f9e1,null))[_0xfe2c('0x1c')](function(_0x18170d){if(_0x18170d){logger[_0xfe2c('0x1f')](_0xfe2c('0x72'),'status',_0xfe2c('0x73'),_0x18170d[_0xfe2c('0x39')],util[_0xfe2c('0x74')](_0x540a67[_0xfe2c('0x52')],{'showHidden':![],'depth':null}));switch(_0x18170d[_0xfe2c('0x39')]){case _0xfe2c('0x75'):if(_0x540a67[_0xfe2c('0x52')][_0xfe2c('0x76')]&&_0x540a67[_0xfe2c('0x52')]['MessageSid']===_0x3d4c3e[_0xfe2c('0x77')]&&_0x540a67[_0xfe2c('0x52')][_0xfe2c('0x78')]&&_0x540a67[_0xfe2c('0x52')][_0xfe2c('0x78')]===_0xfe2c('0x57')){return _0x3d4c3e['update']({'read':!![]});}else{logger[_0xfe2c('0x21')](_0xfe2c('0x79'),_0xfe2c('0x27'),_0xfe2c('0x75'),util['inspect'](_0x540a67['body'],{'showHidden':![],'depth':null}));}break;}return _0x3d4c3e;}})[_0xfe2c('0x1c')](respondWithResult(_0x49f9e1,null))[_0xfe2c('0x25')](handleError(_0x49f9e1,null));};
\ No newline at end of file
+var _0x1197=['describe','../../config/logger','whatsapp-interactions','accept','whatsapp','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','WhatsappInteraction','WhatsappInteractionId','isNil','read1stAt','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','stringify','AcceptMessage','Sequelize','QueryTypes','SELECT','User','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','EventManager','acceptmessage','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','contact','event','reject','rejectmessage','WhatsppMessage,\x20%s,\x20%s,\x20%s','inspect','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappMessage.socket','register','jayson/promise','client','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','save','update','destroy','end','stack','name','send','index','map','WhatsappMessage','rawAttributes','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','show','keys','find','create','body','params'];(function(_0x421eeb,_0x3d3e3e){var _0x2c7371=function(_0x174b74){while(--_0x174b74){_0x421eeb['push'](_0x421eeb['shift']());}};_0x2c7371(++_0x3d3e3e);}(_0x1197,0x14a));var _0x7119=function(_0x32a093,_0x4d4fbe){_0x32a093=_0x32a093-0x0;var _0xb8005f=_0x1197[_0x32a093];return _0xb8005f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7119('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7119('0x1'));var rp=require(_0x7119('0x2'));var moment=require(_0x7119('0x3'));var BPromise=require(_0x7119('0x4'));var Mustache=require(_0x7119('0x5'));var util=require(_0x7119('0x6'));var path=require(_0x7119('0x7'));var sox=require(_0x7119('0x8'));var csv=require(_0x7119('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7119('0xa'));var squel=require('squel');var crypto=require(_0x7119('0xb'));var jsforce=require(_0x7119('0xc'));var deskjs=require(_0x7119('0xd'));var toCsv=require(_0x7119('0x9'));var querystring=require('querystring');var Papa=require(_0x7119('0xe'));var Redis=require(_0x7119('0xf'));var authService=require(_0x7119('0x10'));var qs=require(_0x7119('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7119('0x12'));var logger=require('../../config/logger')(_0x7119('0x13'));var utils=require(_0x7119('0x14'));var config=require(_0x7119('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x7119('0x16'))['db'];config['redis']=_['defaults'](config[_0x7119('0x17')],{'host':_0x7119('0x18'),'port':0x18eb});var socket=require(_0x7119('0x19'))(new Redis(config[_0x7119('0x17')]));require(_0x7119('0x1a'))[_0x7119('0x1b')](socket);var jayson=require(_0x7119('0x1c'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0x7119('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x22e9c6,_0x1f0080,_0x40cb55,_0x5099b6){return new BPromise(function(_0x5d1e4d,_0xa1b628){var _0x1173ef=_0x5099b6||client;return _0x1173ef[_0x7119('0x1e')](_0x22e9c6,_0x40cb55)[_0x7119('0x1f')](function(_0x5b0a01){logger[_0x7119('0x20')](_0x7119('0x21'),_0x1f0080,_0x7119('0x22'));logger[_0x7119('0x23')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x1f0080,_0x7119('0x22'),JSON['stringify'](_0x5b0a01));if(_0x5b0a01[_0x7119('0x24')]){if(_0x5b0a01[_0x7119('0x24')][_0x7119('0x25')]===0x1f4){logger['error'](_0x7119('0x21'),_0x1f0080,_0x5b0a01[_0x7119('0x24')][_0x7119('0x26')]);return _0xa1b628(_0x5b0a01[_0x7119('0x24')][_0x7119('0x26')]);}logger[_0x7119('0x24')](_0x7119('0x21'),_0x1f0080,_0x5b0a01[_0x7119('0x24')][_0x7119('0x26')]);return _0x5d1e4d(_0x5b0a01[_0x7119('0x24')][_0x7119('0x26')]);}else{logger['info']('WhatsappMessage,\x20%s,\x20%s',_0x1f0080,_0x7119('0x22'));_0x5d1e4d(_0x5b0a01['result']['message']);}})[_0x7119('0x27')](function(_0x2c987c){logger[_0x7119('0x24')](_0x7119('0x21'),_0x1f0080,_0x2c987c);_0xa1b628(_0x2c987c);});});}function respondWithStatusCode(_0x223556,_0xd0edf0){_0xd0edf0=_0xd0edf0||0xcc;return function(_0x15614e){if(_0x15614e){return _0x223556[_0x7119('0x28')](_0xd0edf0);}return _0x223556['status'](_0xd0edf0)['end']();};}function respondWithResult(_0x59ff76,_0x496892){_0x496892=_0x496892||0xc8;return function(_0x5ad3c5){if(_0x5ad3c5){return _0x59ff76[_0x7119('0x29')](_0x496892)[_0x7119('0x2a')](_0x5ad3c5);}};}function respondWithFilteredResult(_0x40eefd,_0x53c7a5){return function(_0x4334ad){if(_0x4334ad){var _0x1d5517=typeof _0x53c7a5[_0x7119('0x2b')]===_0x7119('0x2c')&&typeof _0x53c7a5[_0x7119('0x2d')]===_0x7119('0x2c');var _0x55ec4c=_0x4334ad[_0x7119('0x2e')];var _0x513562=_0x1d5517?0x0:_0x53c7a5['offset'];var _0x545463=_0x1d5517?_0x4334ad[_0x7119('0x2e')]:_0x53c7a5['offset']+_0x53c7a5[_0x7119('0x2d')];var _0xb43893;if(_0x545463>=_0x55ec4c){_0x545463=_0x55ec4c;_0xb43893=0xc8;}else{_0xb43893=0xce;}_0x40eefd['status'](_0xb43893);return _0x40eefd[_0x7119('0x2f')](_0x7119('0x30'),_0x513562+'-'+_0x545463+'/'+_0x55ec4c)[_0x7119('0x2a')](_0x4334ad);}return null;};}function patchUpdates(_0x270332){return function(_0x35cb55){try{jsonpatch['apply'](_0x35cb55,_0x270332,!![]);}catch(_0x2a2536){return BPromise['reject'](_0x2a2536);}return _0x35cb55[_0x7119('0x31')]();};}function saveUpdates(_0x181b86,_0x1e8eec){return function(_0x2d32ac){if(_0x2d32ac){return _0x2d32ac[_0x7119('0x32')](_0x181b86)['then'](function(_0x12e618){return _0x12e618;});}return null;};}function removeEntity(_0x506119,_0xc0f82b){return function(_0x1b208f){if(_0x1b208f){return _0x1b208f[_0x7119('0x33')]()['then'](function(){_0x506119[_0x7119('0x29')](0xcc)[_0x7119('0x34')]();});}};}function handleEntityNotFound(_0x5b2ae6,_0x347c15){return function(_0x3d426e){if(!_0x3d426e){_0x5b2ae6[_0x7119('0x28')](0x194);}return _0x3d426e;};}function handleError(_0x1fad52,_0x11fa61){_0x11fa61=_0x11fa61||0x1f4;return function(_0x602121){logger['error'](_0x602121[_0x7119('0x35')]);if(_0x602121[_0x7119('0x36')]){delete _0x602121[_0x7119('0x36')];}_0x1fad52[_0x7119('0x29')](_0x11fa61)[_0x7119('0x37')](_0x602121);};}exports[_0x7119('0x38')]=function(_0x51e526,_0x9fd1c){var _0x1c8138={},_0x3c8bb1={},_0xd0d51a={'count':0x0,'rows':[]};var _0x14e9a5=_[_0x7119('0x39')](db[_0x7119('0x3a')][_0x7119('0x3b')],function(_0x441923){return{'name':_0x441923['fieldName'],'type':_0x441923[_0x7119('0x3c')][_0x7119('0x3d')]};});_0x3c8bb1[_0x7119('0x3e')]=_[_0x7119('0x39')](_0x14e9a5,_0x7119('0x36'));_0x3c8bb1[_0x7119('0x3f')]=_['keys'](_0x51e526['query']);_0x3c8bb1['filters']=_[_0x7119('0x40')](_0x3c8bb1['model'],_0x3c8bb1[_0x7119('0x3f')]);_0x1c8138[_0x7119('0x41')]=_[_0x7119('0x40')](_0x3c8bb1['model'],qs['fields'](_0x51e526[_0x7119('0x3f')][_0x7119('0x42')]));_0x1c8138['attributes']=_0x1c8138['attributes'][_0x7119('0x43')]?_0x1c8138[_0x7119('0x41')]:_0x3c8bb1['model'];if(!_0x51e526['query'][_0x7119('0x44')](_0x7119('0x45'))){_0x1c8138[_0x7119('0x2d')]=qs[_0x7119('0x2d')](_0x51e526[_0x7119('0x3f')][_0x7119('0x2d')]);_0x1c8138[_0x7119('0x2b')]=qs[_0x7119('0x2b')](_0x51e526[_0x7119('0x3f')][_0x7119('0x2b')]);}_0x1c8138[_0x7119('0x46')]=qs[_0x7119('0x47')](_0x51e526[_0x7119('0x3f')][_0x7119('0x47')]);_0x1c8138['where']=qs[_0x7119('0x48')](_[_0x7119('0x49')](_0x51e526[_0x7119('0x3f')],_0x3c8bb1['filters']),_0x14e9a5);if(_0x51e526[_0x7119('0x3f')][_0x7119('0x4a')]){_0x1c8138[_0x7119('0x4b')]=_[_0x7119('0x4c')](_0x1c8138['where'],{'$or':_[_0x7119('0x39')](_0x14e9a5,function(_0x2cfe3a){if(_0x2cfe3a[_0x7119('0x3c')]!==_0x7119('0x4d')){var _0x29e402={};_0x29e402[_0x2cfe3a['name']]={'$like':'%'+_0x51e526[_0x7119('0x3f')][_0x7119('0x4a')]+'%'};return _0x29e402;}})});}_0x1c8138=_[_0x7119('0x4c')]({},_0x1c8138,_0x51e526[_0x7119('0x4e')]);var _0xb85bd1={'where':_0x1c8138[_0x7119('0x4b')]};return db['WhatsappMessage']['count'](_0xb85bd1)[_0x7119('0x1f')](function(_0x348c73){_0xd0d51a[_0x7119('0x2e')]=_0x348c73;if(_0x51e526[_0x7119('0x3f')][_0x7119('0x4f')]){_0x1c8138['include']=[{'all':!![]}];}return db[_0x7119('0x3a')][_0x7119('0x50')](_0x1c8138);})[_0x7119('0x1f')](function(_0x41fa9e){_0xd0d51a['rows']=_0x41fa9e;return _0xd0d51a;})[_0x7119('0x1f')](respondWithFilteredResult(_0x9fd1c,_0x1c8138))[_0x7119('0x27')](handleError(_0x9fd1c,null));};exports[_0x7119('0x51')]=function(_0x92ff75,_0xb011f3){var _0x45f9ea={'raw':!![],'where':{'id':_0x92ff75['params']['id']}},_0x25cb74={};_0x25cb74['model']=_[_0x7119('0x52')](db[_0x7119('0x3a')][_0x7119('0x3b')]);_0x25cb74['query']=_[_0x7119('0x52')](_0x92ff75[_0x7119('0x3f')]);_0x25cb74[_0x7119('0x48')]=_[_0x7119('0x40')](_0x25cb74[_0x7119('0x3e')],_0x25cb74[_0x7119('0x3f')]);_0x45f9ea['attributes']=_[_0x7119('0x40')](_0x25cb74[_0x7119('0x3e')],qs[_0x7119('0x42')](_0x92ff75[_0x7119('0x3f')][_0x7119('0x42')]));_0x45f9ea['attributes']=_0x45f9ea[_0x7119('0x41')][_0x7119('0x43')]?_0x45f9ea[_0x7119('0x41')]:_0x25cb74[_0x7119('0x3e')];if(_0x92ff75[_0x7119('0x3f')]['includeAll']){_0x45f9ea['include']=[{'all':!![]}];}_0x45f9ea=_['merge']({},_0x45f9ea,_0x92ff75['options']);return db[_0x7119('0x3a')][_0x7119('0x53')](_0x45f9ea)[_0x7119('0x1f')](handleEntityNotFound(_0xb011f3,null))['then'](respondWithResult(_0xb011f3,null))[_0x7119('0x27')](handleError(_0xb011f3,null));};exports[_0x7119('0x54')]=function(_0x50a1d7,_0x50fbca){return db[_0x7119('0x3a')]['create'](_0x50a1d7['body'],{})[_0x7119('0x1f')](respondWithResult(_0x50fbca,0xc9))[_0x7119('0x27')](handleError(_0x50fbca,null));};exports[_0x7119('0x32')]=function(_0x501f90,_0x3d0d19){if(_0x501f90[_0x7119('0x55')]['id']){delete _0x501f90[_0x7119('0x55')]['id'];}return db[_0x7119('0x3a')][_0x7119('0x53')]({'where':{'id':_0x501f90['params']['id']}})[_0x7119('0x1f')](handleEntityNotFound(_0x3d0d19,null))[_0x7119('0x1f')](saveUpdates(_0x501f90['body'],null))[_0x7119('0x1f')](respondWithResult(_0x3d0d19,null))[_0x7119('0x27')](handleError(_0x3d0d19,null));};exports[_0x7119('0x33')]=function(_0x4c536e,_0x3c6890){return db['WhatsappMessage'][_0x7119('0x53')]({'where':{'id':_0x4c536e[_0x7119('0x56')]['id']}})[_0x7119('0x1f')](handleEntityNotFound(_0x3c6890,null))[_0x7119('0x1f')](removeEntity(_0x3c6890,null))[_0x7119('0x27')](handleError(_0x3c6890,null));};exports['describe']=function(_0x56e6c1,_0x5cb107){return db['WhatsappMessage'][_0x7119('0x57')]()['then'](respondWithResult(_0x5cb107,null))['catch'](handleError(_0x5cb107,null));};var interaction_log=require(_0x7119('0x58'))(_0x7119('0x59'));exports[_0x7119('0x5a')]=function(_0x3f392d,_0x24eabc,_0x263296){var _0x3e19b7={'agent':{},'channel':_0x7119('0x5b')};if(_0x3f392d[_0x7119('0x55')]['id']){delete _0x3f392d['body']['id'];}_0x3f392d[_0x7119('0x55')][_0x7119('0x5c')]=!![];_0x3f392d['body']['readAt']=moment()[_0x7119('0x5d')](_0x7119('0x5e'));_0x3f392d['body'][_0x7119('0x5f')]=_0x3f392d[_0x7119('0x55')][_0x7119('0x5f')]||_0x3f392d[_0x7119('0x60')]['id'];_0x3e19b7[_0x7119('0x61')]['id']=_0x3f392d[_0x7119('0x55')][_0x7119('0x5f')];return db[_0x7119('0x3a')][_0x7119('0x53')]({'where':{'id':_0x3f392d[_0x7119('0x56')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x24eabc,null))['then'](saveUpdates(_0x3f392d['body'],null))[_0x7119('0x1f')](function(_0x45b5c3){if(_0x45b5c3){_0x3e19b7[_0x7119('0x26')]=_0x45b5c3[_0x7119('0x62')]({'plain':!![]});return db[_0x7119('0x63')]['find']({'where':{'id':_0x45b5c3[_0x7119('0x64')]}});}return null;})[_0x7119('0x1f')](handleEntityNotFound(_0x24eabc,null))[_0x7119('0x1f')](function(_0x4ecb8b){if(_0x4ecb8b){return _0x4ecb8b[_0x7119('0x32')]({'UserId':_0x3f392d[_0x7119('0x55')][_0x7119('0x5f')],'read1stAt':_[_0x7119('0x65')](_0x4ecb8b[_0x7119('0x66')])?moment()['format'](_0x7119('0x5e')):undefined});}return null;})[_0x7119('0x1f')](function(_0x44c866){if(_0x44c866){_0x3e19b7[_0x7119('0x67')]=_0x44c866[_0x7119('0x62')]({'plain':!![]});interaction_log[_0x7119('0x20')](_0x7119('0x68'),_0x3f392d[_0x7119('0x60')]['id'],_0x3f392d[_0x7119('0x60')][_0x7119('0x36')],_0x3f392d[_0x7119('0x60')]['role'],_0x3e19b7[_0x7119('0x67')]['id'],_0x3f392d[_0x7119('0x55')]?JSON[_0x7119('0x69')](_0x3f392d[_0x7119('0x55')]):'null');return respondWithRpcPromise(_0x7119('0x6a'),'acceptMessage',_0x3e19b7);}return null;})[_0x7119('0x1f')](function(_0x607e86){var _0x19bead='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x607e86[_0x7119('0x26')]['ContactId'];return db['sequelize'][_0x7119('0x3f')](_0x19bead,{'type':db[_0x7119('0x6b')][_0x7119('0x6c')][_0x7119('0x6d')],'raw':!![]})[_0x7119('0x1f')](function(_0x58432d){return _0x58432d;});})['then'](function(_0xf6555d){if(_0xf6555d){_0x3e19b7[_0x7119('0x26')]['contact']=_0xf6555d[0x0];if(!_0x3f392d[_0x7119('0x55')][_0x7119('0x5f')])return;return db[_0x7119('0x6e')]['find']({'where':{'id':_0x3f392d[_0x7119('0x55')][_0x7119('0x5f')],'role':_0x7119('0x61')},'attributes':['id',_0x7119('0x36'),_0x7119('0x6f'),_0x7119('0x70'),_0x7119('0x71')],'raw':!![]});}return null;})[_0x7119('0x1f')](function(_0x546064){if(!_0x546064)return null;_0x3e19b7[_0x7119('0x26')][_0x7119('0x61')]=_0x546064;return _0x3e19b7;})['then'](function(_0x2ce8c7){if(_0x2ce8c7){if(_0x3f392d[_0x7119('0x55')][_0x7119('0x72')]){_0x3e19b7[_0x7119('0x26')][_0x7119('0x73')]=util[_0x7119('0x5d')](_0x7119('0x74'),_0x3f392d[_0x7119('0x60')][_0x7119('0x36')]);_0x3e19b7[_0x7119('0x26')][_0x7119('0x75')]=_0x3e19b7['channel'];_0x3e19b7[_0x7119('0x26')][_0x7119('0x76')]=_0x3e19b7['channel'];_0x3e19b7[_0x7119('0x26')]['event']=_0x7119('0x5a');return respondWithRpcPromise(_0x7119('0x77'),_0x7119('0x77'),{'event':_0x7119('0x78'),'message':_0x3e19b7[_0x7119('0x26')]},client9002)[_0x7119('0x1f')](function(){return _0x3e19b7;});}return _0x3e19b7;}return null;})[_0x7119('0x1f')](respondWithResult(_0x24eabc,null))[_0x7119('0x27')](handleError(_0x24eabc,null));};var interaction_log=require(_0x7119('0x58'))(_0x7119('0x59'));exports['reject']=function(_0xc4087b,_0x25ee43,_0xfefe61){var _0x1ad2db={'agent':{},'channel':_0x7119('0x5b')};if(_0xc4087b[_0x7119('0x55')]['id']){delete _0xc4087b[_0x7119('0x55')]['id'];}_0xc4087b[_0x7119('0x55')][_0x7119('0x5f')]=_0xc4087b[_0x7119('0x55')][_0x7119('0x5f')]||_0xc4087b[_0x7119('0x60')]['id'];_0x1ad2db[_0x7119('0x61')]['id']=_0xc4087b['body']['UserId'];return db[_0x7119('0x3a')]['find']({'where':{'id':_0xc4087b[_0x7119('0x56')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x25ee43,null))[_0x7119('0x1f')](function(_0x504b3c){if(_0x504b3c){_0x1ad2db['message']=_0x504b3c[_0x7119('0x62')]({'plain':!![]});return db['WhatsappInteraction'][_0x7119('0x53')]({'where':{'id':_0x504b3c[_0x7119('0x64')]}});}return null;})[_0x7119('0x1f')](handleEntityNotFound(_0x25ee43,null))['then'](function(_0x3b93c4){if(_0x3b93c4){_0x1ad2db['interaction']=_0x3b93c4[_0x7119('0x62')]({'plain':!![]});interaction_log[_0x7119('0x20')](_0x7119('0x79'),_0xc4087b[_0x7119('0x60')]['id'],_0xc4087b[_0x7119('0x60')][_0x7119('0x36')],_0xc4087b[_0x7119('0x60')][_0x7119('0x7a')],_0x1ad2db['interaction']['id'],_0xc4087b[_0x7119('0x55')]?JSON[_0x7119('0x69')](_0xc4087b['body']):_0x7119('0x7b'));return respondWithRpcPromise(_0x7119('0x7c'),_0x7119('0x7d'),_0x1ad2db);}return null;})['then'](function(_0xefc3c){var _0x2d15e1=_0x7119('0x7e')+_0xefc3c[_0x7119('0x26')][_0x7119('0x7f')];return db[_0x7119('0x80')][_0x7119('0x3f')](_0x2d15e1,{'type':db[_0x7119('0x6b')][_0x7119('0x6c')][_0x7119('0x6d')],'raw':!![]})[_0x7119('0x1f')](function(_0x7802fd){return _0x7802fd;});})['then'](function(_0x457ba3){if(_0x457ba3){_0x1ad2db['message'][_0x7119('0x81')]=_0x457ba3[0x0];if(!_0xc4087b[_0x7119('0x55')]['UserId'])return;return db[_0x7119('0x6e')][_0x7119('0x53')]({'where':{'id':_0xc4087b[_0x7119('0x55')]['UserId'],'role':_0x7119('0x61')},'attributes':['id',_0x7119('0x36'),_0x7119('0x6f'),'email','internal'],'raw':!![]});}return null;})[_0x7119('0x1f')](function(_0x2e0aa3){if(!_0x2e0aa3)return null;_0x1ad2db[_0x7119('0x26')][_0x7119('0x61')]=_0x2e0aa3;return _0x1ad2db;})[_0x7119('0x1f')](function(_0x1df1cf){if(_0x1df1cf){_0x1df1cf[_0x7119('0x26')]['interface']=util[_0x7119('0x5d')](_0x7119('0x74'),_0xc4087b[_0x7119('0x60')][_0x7119('0x36')]);_0x1df1cf['message'][_0x7119('0x75')]=_0x1ad2db[_0x7119('0x75')];_0x1df1cf[_0x7119('0x26')]['motionChannel']=_0x1ad2db[_0x7119('0x75')];_0x1df1cf[_0x7119('0x26')][_0x7119('0x82')]=_0x7119('0x83');respondWithRpcPromise(_0x7119('0x77'),_0x7119('0x77'),{'event':_0x7119('0x84'),'message':_0x1df1cf[_0x7119('0x26')]},client9002);return _0x1ad2db;}return null;})[_0x7119('0x1f')](respondWithResult(_0x25ee43,null))[_0x7119('0x27')](handleError(_0x25ee43,null));};exports[_0x7119('0x29')]=function(_0x44ebeb,_0x16aeb9,_0x4a73a9){if(_0x44ebeb[_0x7119('0x55')]['id']){delete _0x44ebeb[_0x7119('0x55')]['id'];}var _0x34865f;return db[_0x7119('0x3a')][_0x7119('0x53')]({'where':{'id':_0x44ebeb[_0x7119('0x56')]['id']}})['then'](handleEntityNotFound(_0x16aeb9,null))[_0x7119('0x1f')](function(_0x1784d9){if(_0x1784d9){_0x34865f=_0x1784d9;return db['WhatsappAccount'][_0x7119('0x53')]({'where':{'id':_0x1784d9['WhatsappAccountId']}});}})[_0x7119('0x1f')](handleEntityNotFound(_0x16aeb9,null))[_0x7119('0x1f')](function(_0x32689b){if(_0x32689b){logger['debug'](_0x7119('0x85'),'status','received\x20delivery\x20report\x20from',_0x32689b['type'],util[_0x7119('0x86')](_0x44ebeb[_0x7119('0x55')],{'showHidden':![],'depth':null}));switch(_0x32689b[_0x7119('0x3c')]){case'twilio':if(_0x44ebeb[_0x7119('0x55')][_0x7119('0x87')]&&_0x44ebeb['body'][_0x7119('0x87')]===_0x34865f[_0x7119('0x88')]&&_0x44ebeb[_0x7119('0x55')][_0x7119('0x89')]&&_0x44ebeb[_0x7119('0x55')][_0x7119('0x89')]===_0x7119('0x5c')){return _0x34865f[_0x7119('0x32')]({'read':!![]});}else{logger['error'](_0x7119('0x8a'),'status','twilio',util[_0x7119('0x86')](_0x44ebeb[_0x7119('0x55')],{'showHidden':![],'depth':null}));}break;}return _0x34865f;}})[_0x7119('0x1f')](respondWithResult(_0x16aeb9,null))[_0x7119('0x27')](handleError(_0x16aeb9,null));};
\ No newline at end of file