Built motion from commit 9e1399f3.|2.5.37
[motion2.git] / server / api / whatsappMessage / whatsappMessage.controller.js
index d779aa0..0b12c4b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5f9b=['rejectMessage','SIP/%s','event','rejectmessage','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','WhatsappMessage,\x20%s,\x20%s','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','end','status','json','count','offset','apply','reject','save','update','name','index','map','WhatsappMessage','type','model','query','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','filters','pick','filter','where','merge','includeAll','include','findAll','rows','params','keys','intersection','options','create','body','find','destroy','whatsapp-interactions','accept','whatsapp','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact','get','WhatsappInteractionId','isNil','read1stAt','interaction','AcceptMessage','acceptMessage','interface','channel','EventManager','acceptmessage','agent','WhatsappInteraction','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role'];(function(_0xff6ae1,_0x5c13e2){var _0x389fa2=function(_0x46f4cc){while(--_0x46f4cc){_0xff6ae1['push'](_0xff6ae1['shift']());}};_0x389fa2(++_0x5c13e2);}(_0x5f9b,0x90));var _0xb5f9=function(_0x1bcbf7,_0x31bf2a){_0x1bcbf7=_0x1bcbf7-0x0;var _0x4aeb5b=_0x5f9b[_0x1bcbf7];return _0x4aeb5b;};'use strict';var pdf=require(_0xb5f9('0x0'));var emlformat=require(_0xb5f9('0x1'));var rimraf=require(_0xb5f9('0x2'));var zipdir=require(_0xb5f9('0x3'));var jsonpatch=require(_0xb5f9('0x4'));var rp=require('request-promise');var moment=require(_0xb5f9('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xb5f9('0x6'));var util=require('util');var path=require(_0xb5f9('0x7'));var sox=require(_0xb5f9('0x8'));var csv=require(_0xb5f9('0x9'));var ejs=require(_0xb5f9('0xa'));var fs=require('fs');var _=require(_0xb5f9('0xb'));var squel=require(_0xb5f9('0xc'));var crypto=require(_0xb5f9('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xb5f9('0xe'));var Papa=require(_0xb5f9('0xf'));var Redis=require(_0xb5f9('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xb5f9('0x11'));var as=require(_0xb5f9('0x12'));var hardwareService=require(_0xb5f9('0x13'));var logger=require(_0xb5f9('0x14'))(_0xb5f9('0x15'));var utils=require('../../config/utils');var config=require(_0xb5f9('0x16'));var db=require(_0xb5f9('0x17'))['db'];config[_0xb5f9('0x18')]=_[_0xb5f9('0x19')](config[_0xb5f9('0x18')],{'host':_0xb5f9('0x1a'),'port':0x18eb});var socket=require(_0xb5f9('0x1b'))(new Redis(config[_0xb5f9('0x18')]));require(_0xb5f9('0x1c'))[_0xb5f9('0x1d')](socket);var jayson=require(_0xb5f9('0x1e'));var client=jayson[_0xb5f9('0x1f')]['http']({'port':0x232c});var client9002=jayson[_0xb5f9('0x1f')][_0xb5f9('0x20')]({'port':0x232a});function checkPasswordPattern(_0x2837de,_0x21f95d,_0x527777){if(_0x527777){var _0x4eda61=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4eda61[_0xb5f9('0x21')](_0x21f95d)){return _0x2837de;}else{throw new db[(_0xb5f9('0x22'))][(_0xb5f9('0x23'))](_0xb5f9('0x24'));}}else{return _0x2837de;}}function respondWithRpcPromise(_0x725d94,_0x1df27a,_0x5d6680,_0x31fb28){return new BPromise(function(_0x31e876,_0x371adc){var _0x3ea256=_0x31fb28||client;return _0x3ea256[_0xb5f9('0x25')](_0x725d94,_0x5d6680)[_0xb5f9('0x26')](function(_0x40a0db){logger[_0xb5f9('0x27')](_0xb5f9('0x28'),_0x1df27a,'request\x20sent');logger[_0xb5f9('0x29')](_0xb5f9('0x2a'),_0x1df27a,_0xb5f9('0x2b'),JSON[_0xb5f9('0x2c')](_0x40a0db));if(_0x40a0db['error']){if(_0x40a0db[_0xb5f9('0x2d')][_0xb5f9('0x2e')]===0x1f4){logger[_0xb5f9('0x2d')](_0xb5f9('0x28'),_0x1df27a,_0x40a0db[_0xb5f9('0x2d')][_0xb5f9('0x2f')]);return _0x371adc(_0x40a0db['error']['message']);}logger[_0xb5f9('0x2d')]('WhatsappMessage,\x20%s,\x20%s',_0x1df27a,_0x40a0db[_0xb5f9('0x2d')][_0xb5f9('0x2f')]);return _0x31e876(_0x40a0db[_0xb5f9('0x2d')][_0xb5f9('0x2f')]);}else{logger['info'](_0xb5f9('0x28'),_0x1df27a,_0xb5f9('0x2b'));_0x31e876(_0x40a0db[_0xb5f9('0x30')][_0xb5f9('0x2f')]);}})[_0xb5f9('0x31')](function(_0x207032){logger['error'](_0xb5f9('0x28'),_0x1df27a,_0x207032);_0x371adc(_0x207032);});});}function respondWithStatusCode(_0x2b6b03,_0x22a8a0){_0x22a8a0=_0x22a8a0||0xcc;return function(_0x3e8a0b){if(_0x3e8a0b){return _0x2b6b03[_0xb5f9('0x32')](_0x22a8a0);}return _0x2b6b03['status'](_0x22a8a0)[_0xb5f9('0x33')]();};}function respondWithResult(_0x2256a8,_0x480c03){_0x480c03=_0x480c03||0xc8;return function(_0x21904f){if(_0x21904f){return _0x2256a8[_0xb5f9('0x34')](_0x480c03)[_0xb5f9('0x35')](_0x21904f);}};}function respondWithFilteredResult(_0x39f353,_0x49b717){return function(_0x1efceb){if(_0x1efceb){var _0x462a48=_0x1efceb[_0xb5f9('0x36')],_0x5a38b0=_0x49b717[_0xb5f9('0x37')],_0x3b8c2f=_0x49b717['offset']+_0x49b717['limit'],_0x343cf5;if(_0x3b8c2f>=_0x462a48){_0x3b8c2f=_0x462a48;_0x343cf5=0xc8;}else{_0x343cf5=0xce;}_0x39f353['status'](_0x343cf5);return _0x39f353['set']('Content-Range',_0x5a38b0+'-'+_0x3b8c2f+'/'+_0x462a48)[_0xb5f9('0x35')](_0x1efceb);}return null;};}function patchUpdates(_0x79f2a3){return function(_0x448700){try{jsonpatch[_0xb5f9('0x38')](_0x448700,_0x79f2a3,!![]);}catch(_0x4416f5){return BPromise[_0xb5f9('0x39')](_0x4416f5);}return _0x448700[_0xb5f9('0x3a')]();};}function saveUpdates(_0x1a17d8,_0x47fbe9){return function(_0x20238b){if(_0x20238b){return _0x20238b[_0xb5f9('0x3b')](_0x1a17d8)['then'](function(_0x5d305b){return _0x5d305b;});}return null;};}function removeEntity(_0xf60053,_0x74751d){return function(_0x4a8c2a){if(_0x4a8c2a){return _0x4a8c2a['destroy']()[_0xb5f9('0x26')](function(){_0xf60053['status'](0xcc)[_0xb5f9('0x33')]();});}};}function handleEntityNotFound(_0x8e5b12,_0x1bfa4d){return function(_0x4fb621){if(!_0x4fb621){_0x8e5b12[_0xb5f9('0x32')](0x194);}return _0x4fb621;};}function handleError(_0x4148ad,_0x2adc09){_0x2adc09=_0x2adc09||0x1f4;return function(_0x4057ae){logger['error'](_0x4057ae['stack']);if(_0x4057ae[_0xb5f9('0x3c')]){delete _0x4057ae['name'];}_0x4148ad[_0xb5f9('0x34')](_0x2adc09)['send'](_0x4057ae);};}exports[_0xb5f9('0x3d')]=function(_0x1b9ae5,_0x5050d5){var _0x365207={},_0xeb737f={},_0x34929b={'count':0x0,'rows':[]};var _0x41516f=_[_0xb5f9('0x3e')](db[_0xb5f9('0x3f')]['rawAttributes'],function(_0x801cd){return{'name':_0x801cd['fieldName'],'type':_0x801cd[_0xb5f9('0x40')]['key']};});_0xeb737f[_0xb5f9('0x41')]=_['map'](_0x41516f,_0xb5f9('0x3c'));_0xeb737f[_0xb5f9('0x42')]=_['keys'](_0x1b9ae5['query']);_0xeb737f['filters']=_['intersection'](_0xeb737f[_0xb5f9('0x41')],_0xeb737f['query']);_0x365207[_0xb5f9('0x43')]=_['intersection'](_0xeb737f['model'],qs[_0xb5f9('0x44')](_0x1b9ae5['query']['fields']));_0x365207['attributes']=_0x365207[_0xb5f9('0x43')][_0xb5f9('0x45')]?_0x365207[_0xb5f9('0x43')]:_0xeb737f[_0xb5f9('0x41')];if(!_0x1b9ae5[_0xb5f9('0x42')][_0xb5f9('0x46')](_0xb5f9('0x47'))){_0x365207[_0xb5f9('0x48')]=qs[_0xb5f9('0x48')](_0x1b9ae5[_0xb5f9('0x42')][_0xb5f9('0x48')]);_0x365207[_0xb5f9('0x37')]=qs[_0xb5f9('0x37')](_0x1b9ae5[_0xb5f9('0x42')][_0xb5f9('0x37')]);}_0x365207['order']=qs[_0xb5f9('0x49')](_0x1b9ae5[_0xb5f9('0x42')][_0xb5f9('0x49')]);_0x365207['where']=qs[_0xb5f9('0x4a')](_[_0xb5f9('0x4b')](_0x1b9ae5['query'],_0xeb737f['filters']),_0x41516f);if(_0x1b9ae5[_0xb5f9('0x42')][_0xb5f9('0x4c')]){_0x365207[_0xb5f9('0x4d')]=_[_0xb5f9('0x4e')](_0x365207[_0xb5f9('0x4d')],{'$or':_['map'](_0x41516f,function(_0x4e233d){if(_0x4e233d[_0xb5f9('0x40')]!=='VIRTUAL'){var _0x10e7e3={};_0x10e7e3[_0x4e233d[_0xb5f9('0x3c')]]={'$like':'%'+_0x1b9ae5['query'][_0xb5f9('0x4c')]+'%'};return _0x10e7e3;}})});}_0x365207=_['merge']({},_0x365207,_0x1b9ae5['options']);var _0x19ceed={'where':_0x365207[_0xb5f9('0x4d')]};return db[_0xb5f9('0x3f')][_0xb5f9('0x36')](_0x19ceed)['then'](function(_0x5b6a6c){_0x34929b['count']=_0x5b6a6c;if(_0x1b9ae5[_0xb5f9('0x42')][_0xb5f9('0x4f')]){_0x365207[_0xb5f9('0x50')]=[{'all':!![]}];}return db[_0xb5f9('0x3f')][_0xb5f9('0x51')](_0x365207);})[_0xb5f9('0x26')](function(_0x676859){_0x34929b[_0xb5f9('0x52')]=_0x676859;return _0x34929b;})[_0xb5f9('0x26')](respondWithFilteredResult(_0x5050d5,_0x365207))[_0xb5f9('0x31')](handleError(_0x5050d5,null));};exports['show']=function(_0x2aecc9,_0x19265c){var _0x48bd3d={'raw':!![],'where':{'id':_0x2aecc9[_0xb5f9('0x53')]['id']}},_0x4d089d={};_0x4d089d[_0xb5f9('0x41')]=_[_0xb5f9('0x54')](db['WhatsappMessage']['rawAttributes']);_0x4d089d[_0xb5f9('0x42')]=_['keys'](_0x2aecc9[_0xb5f9('0x42')]);_0x4d089d[_0xb5f9('0x4a')]=_[_0xb5f9('0x55')](_0x4d089d[_0xb5f9('0x41')],_0x4d089d[_0xb5f9('0x42')]);_0x48bd3d['attributes']=_[_0xb5f9('0x55')](_0x4d089d[_0xb5f9('0x41')],qs[_0xb5f9('0x44')](_0x2aecc9[_0xb5f9('0x42')][_0xb5f9('0x44')]));_0x48bd3d[_0xb5f9('0x43')]=_0x48bd3d['attributes'][_0xb5f9('0x45')]?_0x48bd3d['attributes']:_0x4d089d['model'];if(_0x2aecc9[_0xb5f9('0x42')][_0xb5f9('0x4f')]){_0x48bd3d[_0xb5f9('0x50')]=[{'all':!![]}];}_0x48bd3d=_['merge']({},_0x48bd3d,_0x2aecc9[_0xb5f9('0x56')]);return db[_0xb5f9('0x3f')]['find'](_0x48bd3d)[_0xb5f9('0x26')](handleEntityNotFound(_0x19265c,null))[_0xb5f9('0x26')](respondWithResult(_0x19265c,null))[_0xb5f9('0x31')](handleError(_0x19265c,null));};exports[_0xb5f9('0x57')]=function(_0x2addbf,_0x363fde){return db[_0xb5f9('0x3f')][_0xb5f9('0x57')](_0x2addbf[_0xb5f9('0x58')],{})['then'](respondWithResult(_0x363fde,0xc9))[_0xb5f9('0x31')](handleError(_0x363fde,null));};exports[_0xb5f9('0x3b')]=function(_0x18b29e,_0x8dc985){if(_0x18b29e['body']['id']){delete _0x18b29e[_0xb5f9('0x58')]['id'];}return db[_0xb5f9('0x3f')][_0xb5f9('0x59')]({'where':{'id':_0x18b29e[_0xb5f9('0x53')]['id']}})[_0xb5f9('0x26')](handleEntityNotFound(_0x8dc985,null))[_0xb5f9('0x26')](saveUpdates(_0x18b29e['body'],null))['then'](respondWithResult(_0x8dc985,null))[_0xb5f9('0x31')](handleError(_0x8dc985,null));};exports[_0xb5f9('0x5a')]=function(_0x2867c4,_0x346aee){return db[_0xb5f9('0x3f')][_0xb5f9('0x59')]({'where':{'id':_0x2867c4[_0xb5f9('0x53')]['id']}})[_0xb5f9('0x26')](handleEntityNotFound(_0x346aee,null))[_0xb5f9('0x26')](removeEntity(_0x346aee,null))['catch'](handleError(_0x346aee,null));};exports['describe']=function(_0x4eb6a0,_0x48c207){return db[_0xb5f9('0x3f')]['describe']()[_0xb5f9('0x26')](respondWithResult(_0x48c207,null))[_0xb5f9('0x31')](handleError(_0x48c207,null));};var interaction_log=require('../../config/logger')(_0xb5f9('0x5b'));exports[_0xb5f9('0x5c')]=function(_0x47cdba,_0x222f36,_0x1c592){var _0xdb0f7c={'channel':_0xb5f9('0x5d')};if(_0x47cdba[_0xb5f9('0x58')]['id']){delete _0x47cdba[_0xb5f9('0x58')]['id'];}_0x47cdba['body'][_0xb5f9('0x5e')]=!![];_0x47cdba['body']['readAt']=moment()[_0xb5f9('0x5f')](_0xb5f9('0x60'));_0x47cdba[_0xb5f9('0x58')][_0xb5f9('0x61')]=_0x47cdba[_0xb5f9('0x58')][_0xb5f9('0x61')]||_0x47cdba[_0xb5f9('0x62')]['id'];return db[_0xb5f9('0x3f')][_0xb5f9('0x59')]({'where':{'id':_0x47cdba[_0xb5f9('0x53')]['id'],'UserId':null},'include':[{'model':db[_0xb5f9('0x63')],'as':_0xb5f9('0x64')}]})[_0xb5f9('0x26')](handleEntityNotFound(_0x222f36,null))['then'](saveUpdates(_0x47cdba[_0xb5f9('0x58')],null))[_0xb5f9('0x26')](function(_0x16d934){if(_0x16d934){_0xdb0f7c[_0xb5f9('0x2f')]=_0x16d934[_0xb5f9('0x65')]({'plain':!![]});return db['WhatsappInteraction'][_0xb5f9('0x59')]({'where':{'id':_0x16d934[_0xb5f9('0x66')]}});}return null;})[_0xb5f9('0x26')](handleEntityNotFound(_0x222f36,null))[_0xb5f9('0x26')](function(_0x374c2a){if(_0x374c2a){return _0x374c2a[_0xb5f9('0x3b')]({'UserId':_0x47cdba['body'][_0xb5f9('0x61')],'read1stAt':_[_0xb5f9('0x67')](_0x374c2a[_0xb5f9('0x68')])?moment()['format'](_0xb5f9('0x60')):undefined});}return null;})[_0xb5f9('0x26')](function(_0x1f631c){if(_0x1f631c){_0xdb0f7c[_0xb5f9('0x69')]=_0x1f631c['get']({'plain':!![]});interaction_log['info']('[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x47cdba[_0xb5f9('0x62')]['id'],_0x47cdba[_0xb5f9('0x62')][_0xb5f9('0x3c')],_0x47cdba[_0xb5f9('0x62')]['role'],_0xdb0f7c['interaction']['id'],_0x47cdba[_0xb5f9('0x58')]?JSON['stringify'](_0x47cdba[_0xb5f9('0x58')]):'null');return respondWithRpcPromise(_0xb5f9('0x6a'),_0xb5f9('0x6b'),_0xdb0f7c);}return null;})[_0xb5f9('0x26')](function(_0x2b2d54){if(_0x2b2d54){if(_0x47cdba['body']['manual']){_0xdb0f7c[_0xb5f9('0x2f')][_0xb5f9('0x6c')]=util['format']('SIP/%s',_0x47cdba['user']['name']);_0xdb0f7c[_0xb5f9('0x2f')][_0xb5f9('0x6d')]=_0xdb0f7c['channel'];_0xdb0f7c[_0xb5f9('0x2f')]['event']=_0xb5f9('0x5c');return respondWithRpcPromise(_0xb5f9('0x6e'),_0xb5f9('0x6e'),{'event':_0xb5f9('0x6f'),'message':_0xdb0f7c[_0xb5f9('0x2f')]},client9002)[_0xb5f9('0x26')](function(){return _0xdb0f7c;});}return _0xdb0f7c;}return null;})[_0xb5f9('0x26')](respondWithResult(_0x222f36,null))[_0xb5f9('0x31')](handleError(_0x222f36,null));};var interaction_log=require(_0xb5f9('0x14'))('whatsapp-interactions');exports[_0xb5f9('0x39')]=function(_0x351363,_0x4090cc,_0x10a8c4){var _0x965836={'agent':{},'channel':_0xb5f9('0x5d')};if(_0x351363[_0xb5f9('0x58')]['id']){delete _0x351363[_0xb5f9('0x58')]['id'];}_0x351363[_0xb5f9('0x58')][_0xb5f9('0x61')]=_0x351363[_0xb5f9('0x58')][_0xb5f9('0x61')]||_0x351363[_0xb5f9('0x62')]['id'];_0x965836[_0xb5f9('0x70')]['id']=_0x351363[_0xb5f9('0x58')]['UserId'];return db[_0xb5f9('0x3f')][_0xb5f9('0x59')]({'where':{'id':_0x351363['params']['id'],'UserId':null}})[_0xb5f9('0x26')](handleEntityNotFound(_0x4090cc,null))['then'](function(_0x2fe538){if(_0x2fe538){_0x965836[_0xb5f9('0x2f')]=_0x2fe538[_0xb5f9('0x65')]({'plain':!![]});return db[_0xb5f9('0x71')][_0xb5f9('0x59')]({'where':{'id':_0x2fe538['WhatsappInteractionId']}});}return null;})[_0xb5f9('0x26')](handleEntityNotFound(_0x4090cc,null))['then'](function(_0x54487a){if(_0x54487a){_0x965836['interaction']=_0x54487a['get']({'plain':!![]});interaction_log[_0xb5f9('0x27')](_0xb5f9('0x72'),_0x351363['user']['id'],_0x351363[_0xb5f9('0x62')][_0xb5f9('0x3c')],_0x351363['user'][_0xb5f9('0x73')],_0x965836[_0xb5f9('0x69')]['id'],_0x351363['body']?JSON[_0xb5f9('0x2c')](_0x351363[_0xb5f9('0x58')]):'null');return respondWithRpcPromise('RejectMessage',_0xb5f9('0x74'),_0x965836);}return null;})[_0xb5f9('0x26')](function(_0x5e614d){if(_0x5e614d){_0x5e614d[_0xb5f9('0x2f')][_0xb5f9('0x6c')]=util['format'](_0xb5f9('0x75'),_0x351363[_0xb5f9('0x62')][_0xb5f9('0x3c')]);_0x5e614d['message'][_0xb5f9('0x6d')]=_0x965836[_0xb5f9('0x6d')];_0x5e614d[_0xb5f9('0x2f')][_0xb5f9('0x76')]='reject';respondWithRpcPromise(_0xb5f9('0x6e'),_0xb5f9('0x6e'),{'event':_0xb5f9('0x77'),'message':_0x5e614d[_0xb5f9('0x2f')]},client9002);return _0x965836;}return null;})['then'](respondWithResult(_0x4090cc,null))[_0xb5f9('0x31')](handleError(_0x4090cc,null));};exports[_0xb5f9('0x34')]=function(_0x33e24f,_0x29e2ef,_0x6f8151){if(_0x33e24f[_0xb5f9('0x58')]['id']){delete _0x33e24f[_0xb5f9('0x58')]['id'];}var _0x1ef1e0;return db[_0xb5f9('0x3f')][_0xb5f9('0x59')]({'where':{'id':_0x33e24f[_0xb5f9('0x53')]['id']}})[_0xb5f9('0x26')](handleEntityNotFound(_0x29e2ef,null))[_0xb5f9('0x26')](function(_0x276b67){if(_0x276b67){_0x1ef1e0=_0x276b67;return db[_0xb5f9('0x78')]['find']({'where':{'id':_0x276b67[_0xb5f9('0x79')]}});}})['then'](handleEntityNotFound(_0x29e2ef,null))['then'](function(_0x2411dd){if(_0x2411dd){logger[_0xb5f9('0x29')](_0xb5f9('0x7a'),_0xb5f9('0x34'),_0xb5f9('0x7b'),_0x2411dd[_0xb5f9('0x40')],util[_0xb5f9('0x7c')](_0x33e24f['body'],{'showHidden':![],'depth':null}));switch(_0x2411dd[_0xb5f9('0x40')]){case _0xb5f9('0x7d'):if(_0x33e24f['body'][_0xb5f9('0x7e')]&&_0x33e24f[_0xb5f9('0x58')]['MessageSid']===_0x1ef1e0[_0xb5f9('0x7f')]&&_0x33e24f[_0xb5f9('0x58')][_0xb5f9('0x80')]&&_0x33e24f[_0xb5f9('0x58')][_0xb5f9('0x80')]==='read'){return _0x1ef1e0[_0xb5f9('0x3b')]({'read':!![]});}else{logger[_0xb5f9('0x2d')](_0xb5f9('0x81'),_0xb5f9('0x34'),_0xb5f9('0x7d'),util[_0xb5f9('0x7c')](_0x33e24f['body'],{'showHidden':![],'depth':null}));}break;}return _0x1ef1e0;}})[_0xb5f9('0x26')](respondWithResult(_0x29e2ef,null))['catch'](handleError(_0x29e2ef,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