be1867a4378e81213ca5522c90cd49ee9126d46b
[motion2.git] / server / api / cmHopper / cmHopper.rpc.js
1 // *************************************************************************
2 // *                                                                       *
3 // * xCALLY Motion -  The Omnichannel Contact Center                       *
4 // * Copyright (c) Xenialab s.r.l. All Rights Reserved                     *
5 // *                                                                       *
6 // *************************************************************************
7 // *                                                                       *
8 // * Email: info@xcally.com                                                *
9 // * Website: https://www.xcally.com                                       *
10 // *                                                                       *
11 // *************************************************************************
12 // *                                                                       *
13 // * The SOFTWARE PRODUCT is protected by copyright laws and international *
14 // * copyright treaties, as well as other intellectual property laws and   *
15 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                         *
16 // *                                                                       *
17 // *************************************************************************
18 var _0x4efc=['findOne','phone','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueIds','interval','availableAgentsIds','\x20MINUTE','NOW()','List','lodash','util','moment','../../mysqldb','../../config/logger','rpc','CmHopper','findAll','options','raw','where','attributes','include','map','model','then','info','GetCmHopper','debug','stringify','message','error','find','ShowCmHopper','catch','create','body','CreateCmHopper','update','limit','DestroyCmHopper','destroy','transaction','order','LOCK','UPDATE','CmContact','Contact','User','Agent','name','voicePause','length','UserId','push','includes','all','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','active','GetContactDialer','MoveContactManagedDialer','sequelize','CmHopperFinal','COUNT','literal','`scheduledat`\x20>=\x20','format','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','CountReScheduled','GetContactRecallMe','describe','keys'];(function(_0x41dba0,_0x270670){var _0x667e80=function(_0x289510){while(--_0x289510){_0x41dba0['push'](_0x41dba0['shift']());}};_0x667e80(++_0x270670);}(_0x4efc,0x1e1));var _0xc4ef=function(_0x300893,_0x33cb05){_0x300893=_0x300893-0x0;var _0x1ffdd3=_0x4efc[_0x300893];return _0x1ffdd3;};'use strict';var _=require(_0xc4ef('0x0'));var util=require(_0xc4ef('0x1'));var moment=require(_0xc4ef('0x2'));var BPromise=require('bluebird');var db=require(_0xc4ef('0x3'))['db'];var logger=require(_0xc4ef('0x4'))(_0xc4ef('0x5'));exports['GetCmHopper']=function(_0x31ccc6){var _0x2a39b3=this;return new Promise(function(_0x12d4e6,_0x1c288b){return db[_0xc4ef('0x6')][_0xc4ef('0x7')]({'raw':_0x31ccc6[_0xc4ef('0x8')]?_0x31ccc6[_0xc4ef('0x8')][_0xc4ef('0x9')]===undefined?!![]:![]:!![],'where':_0x31ccc6[_0xc4ef('0x8')]?_0x31ccc6[_0xc4ef('0x8')][_0xc4ef('0xa')]||null:null,'attributes':_0x31ccc6['options']?_0x31ccc6[_0xc4ef('0x8')][_0xc4ef('0xb')]||null:null,'limit':_0x31ccc6[_0xc4ef('0x8')]?_0x31ccc6[_0xc4ef('0x8')]['limit']||null:null,'include':_0x31ccc6['options']?_0x31ccc6[_0xc4ef('0x8')][_0xc4ef('0xc')]?_[_0xc4ef('0xd')](_0x31ccc6[_0xc4ef('0x8')][_0xc4ef('0xc')],function(_0x243c2b){return{'model':db[_0x243c2b[_0xc4ef('0xe')]],'as':_0x243c2b['as'],'attributes':_0x243c2b[_0xc4ef('0xb')],'include':_0x243c2b[_0xc4ef('0xc')]?_[_0xc4ef('0xd')](_0x243c2b[_0xc4ef('0xc')],function(_0x234b85){return{'model':db[_0x234b85[_0xc4ef('0xe')]],'as':_0x234b85['as'],'attributes':_0x234b85[_0xc4ef('0xb')],'include':_0x234b85[_0xc4ef('0xc')]?_[_0xc4ef('0xd')](_0x234b85[_0xc4ef('0xc')],function(_0x1897b6){return{'model':db[_0x1897b6[_0xc4ef('0xe')]],'as':_0x1897b6['as'],'attributes':_0x1897b6['attributes']};}):[]};}):[]};}):[]:[]})[_0xc4ef('0xf')](function(_0x1513f7){logger[_0xc4ef('0x10')](_0xc4ef('0x11'),_0x31ccc6);logger[_0xc4ef('0x12')](_0xc4ef('0x11'),_0x31ccc6,JSON[_0xc4ef('0x13')](_0x1513f7));_0x12d4e6(_0x1513f7);})['catch'](function(_0x35d65e){logger['error'](_0xc4ef('0x11'),_0x35d65e[_0xc4ef('0x14')],_0x31ccc6);_0x1c288b(_0x2a39b3[_0xc4ef('0x15')](0x1f4,_0x35d65e[_0xc4ef('0x14')]));});});};exports['ShowCmHopper']=function(_0x422753){var _0x266037=this;return new Promise(function(_0x5ec28e,_0xe4880c){return db['CmHopper'][_0xc4ef('0x16')]({'raw':_0x422753[_0xc4ef('0x8')]?_0x422753[_0xc4ef('0x8')][_0xc4ef('0x9')]===undefined?!![]:![]:!![],'where':_0x422753[_0xc4ef('0x8')]?_0x422753[_0xc4ef('0x8')][_0xc4ef('0xa')]||null:null,'attributes':_0x422753[_0xc4ef('0x8')]?_0x422753[_0xc4ef('0x8')]['attributes']||null:null,'include':_0x422753[_0xc4ef('0x8')]?_0x422753[_0xc4ef('0x8')][_0xc4ef('0xc')]?_[_0xc4ef('0xd')](_0x422753[_0xc4ef('0x8')][_0xc4ef('0xc')],function(_0x2d502c){return{'model':db[_0x2d502c[_0xc4ef('0xe')]],'as':_0x2d502c['as'],'attributes':_0x2d502c['attributes'],'include':_0x2d502c[_0xc4ef('0xc')]?_[_0xc4ef('0xd')](_0x2d502c[_0xc4ef('0xc')],function(_0x1fcd65){return{'model':db[_0x1fcd65[_0xc4ef('0xe')]],'as':_0x1fcd65['as'],'attributes':_0x1fcd65[_0xc4ef('0xb')],'include':_0x1fcd65[_0xc4ef('0xc')]?_[_0xc4ef('0xd')](_0x1fcd65[_0xc4ef('0xc')],function(_0x2de5d9){return{'model':db[_0x2de5d9[_0xc4ef('0xe')]],'as':_0x2de5d9['as'],'attributes':_0x2de5d9[_0xc4ef('0xb')]};}):[]};}):[]};}):[]:[]})[_0xc4ef('0xf')](function(_0xd103f8){logger[_0xc4ef('0x10')](_0xc4ef('0x17'),_0x422753);logger[_0xc4ef('0x12')]('ShowCmHopper',_0x422753,JSON[_0xc4ef('0x13')](_0xd103f8));_0x5ec28e(_0xd103f8);})[_0xc4ef('0x18')](function(_0x2307b5){logger['error']('ShowCmHopper',_0x2307b5[_0xc4ef('0x14')],_0x422753);_0xe4880c(_0x266037[_0xc4ef('0x15')](0x1f4,_0x2307b5[_0xc4ef('0x14')]));});});};exports['CreateCmHopper']=function(_0x20bf90){var _0x2f3e4c=this;return new Promise(function(_0x5c30da,_0x34747d){return db[_0xc4ef('0x6')][_0xc4ef('0x19')](_0x20bf90[_0xc4ef('0x1a')],{'raw':_0x20bf90['options']?_0x20bf90[_0xc4ef('0x8')][_0xc4ef('0x9')]===undefined?!![]:![]:!![]})[_0xc4ef('0xf')](function(_0x8a22f4){logger[_0xc4ef('0x10')](_0xc4ef('0x1b'),_0x20bf90);logger[_0xc4ef('0x12')](_0xc4ef('0x1b'),_0x20bf90,JSON[_0xc4ef('0x13')](_0x8a22f4));_0x5c30da(_0x8a22f4);})[_0xc4ef('0x18')](function(_0x5504c9){logger[_0xc4ef('0x15')](_0xc4ef('0x1b'),_0x5504c9[_0xc4ef('0x14')],_0x20bf90);_0x34747d(_0x2f3e4c[_0xc4ef('0x15')](0x1f4,_0x5504c9[_0xc4ef('0x14')]));});});};exports['UpdateCmHopper']=function(_0x146337){var _0x1b3fc9=this;return new Promise(function(_0x31a810,_0x3e34e0){return db[_0xc4ef('0x6')][_0xc4ef('0x1c')](_0x146337['body'],{'raw':_0x146337[_0xc4ef('0x8')]?_0x146337['options'][_0xc4ef('0x9')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x146337[_0xc4ef('0x8')]?_0x146337[_0xc4ef('0x8')][_0xc4ef('0xa')]||null:null,'attributes':_0x146337[_0xc4ef('0x8')]?_0x146337['options'][_0xc4ef('0xb')]||null:null,'limit':_0x146337[_0xc4ef('0x8')]?_0x146337[_0xc4ef('0x8')][_0xc4ef('0x1d')]||null:null})['then'](function(_0x3f4831){logger[_0xc4ef('0x10')]('UpdateCmHopper',_0x146337);logger['info']('UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON[_0xc4ef('0x13')](_0x146337[_0xc4ef('0x8')][_0xc4ef('0xa')]),_0x146337[_0xc4ef('0x1a')]['active']);logger[_0xc4ef('0x12')]('UpdateCmHopper',_0x146337,JSON[_0xc4ef('0x13')](_0x3f4831));_0x31a810(_0x3f4831);})[_0xc4ef('0x18')](function(_0x4ee530){logger['error']('UpdateCmHopper',_0x4ee530[_0xc4ef('0x14')],_0x146337);_0x3e34e0(_0x1b3fc9[_0xc4ef('0x15')](0x1f4,_0x4ee530[_0xc4ef('0x14')]));});});};exports[_0xc4ef('0x1e')]=function(_0x4dd284){var _0x11aa78=this;return new Promise(function(_0x473cb1,_0x43b0ed){return db[_0xc4ef('0x6')][_0xc4ef('0x1f')]({'where':_0x4dd284[_0xc4ef('0x8')]?_0x4dd284[_0xc4ef('0x8')][_0xc4ef('0xa')]||null:null})[_0xc4ef('0xf')](function(_0xa1bd59){logger[_0xc4ef('0x10')](_0xc4ef('0x1e'),_0x4dd284);logger['debug']('DestroyCmHopper',_0x4dd284,JSON['stringify'](_0xa1bd59));_0x473cb1(_0xa1bd59);})['catch'](function(_0x2c8453){logger[_0xc4ef('0x15')](_0xc4ef('0x1e'),_0x2c8453[_0xc4ef('0x14')],_0x4dd284);_0x43b0ed(_0x11aa78[_0xc4ef('0x15')](0x1f4,_0x2c8453[_0xc4ef('0x14')]));});});};exports['GetContactDialer']=function(_0x46334e){var _0x1e8318=this;return new Promise(function(_0x2ac7e9,_0x3a1d23){return db['CmContact']['describe']()[_0xc4ef('0xf')](function(_0x54f28b){return db['sequelize'][_0xc4ef('0x20')](function(_0x4a2543){return db[_0xc4ef('0x6')][_0xc4ef('0x7')]({'where':_0x46334e[_0xc4ef('0x8')]?_0x46334e[_0xc4ef('0x8')][_0xc4ef('0xa')]||null:null,'attributes':_0x46334e[_0xc4ef('0x8')]?_0x46334e[_0xc4ef('0x8')][_0xc4ef('0xb')]||null:null,'limit':_0x46334e[_0xc4ef('0x8')]?_0x46334e[_0xc4ef('0x8')][_0xc4ef('0x1d')]||null:null,'order':_0x46334e[_0xc4ef('0x8')]?_0x46334e['options'][_0xc4ef('0x21')]||null:null,'transaction':_0x4a2543,'lock':_0x4a2543[_0xc4ef('0x22')][_0xc4ef('0x23')],'include':[{'model':db[_0xc4ef('0x24')],'as':_0xc4ef('0x25'),'attributes':_['keys'](_0x54f28b)},{'model':db[_0xc4ef('0x26')],'as':_0xc4ef('0x27'),'attributes':['id',_0xc4ef('0x28'),_0xc4ef('0x29')]}]})['then'](function(_0x263d0d){var _0x60e79f=[];var _0x1b8262=[];for(var _0x21e69e=0x0;_0x21e69e<_0x263d0d[_0xc4ef('0x2a')];_0x21e69e+=0x1){var _0x2423fd=_0x263d0d[_0x21e69e][_0xc4ef('0x2b')];if(_0x2423fd===null){_0x60e79f[_0xc4ef('0x2c')](_0x263d0d[_0x21e69e][_0xc4ef('0x1c')](_0x46334e[_0xc4ef('0x1a')],{'transaction':_0x4a2543}));}else if(!_0x1b8262[_0xc4ef('0x2d')](_0x2423fd)){_0x1b8262[_0xc4ef('0x2c')](_0x2423fd);_0x60e79f[_0xc4ef('0x2c')](_0x263d0d[_0x21e69e][_0xc4ef('0x1c')](_0x46334e[_0xc4ef('0x1a')],{'transaction':_0x4a2543}));}}return BPromise[_0xc4ef('0x2e')](_0x60e79f);});})[_0xc4ef('0xf')](function(_0x334ed1){logger['info']('GetContactDialer',_0x46334e);if(_0x334ed1[_0xc4ef('0x2a')]>0x0){logger[_0xc4ef('0x10')](_0xc4ef('0x2f'),_0x334ed1[0x0]['dataValues']['id'],_0x334ed1[0x0][_0xc4ef('0x30')][_0xc4ef('0x31')],_0x334ed1[0x0][_0xc4ef('0x30')][_0xc4ef('0x32')]);}logger[_0xc4ef('0x12')](_0xc4ef('0x33'),_0x46334e,JSON[_0xc4ef('0x13')](_0x334ed1));_0x2ac7e9(_0x334ed1);})[_0xc4ef('0x18')](function(_0x2c4142){logger[_0xc4ef('0x15')]('GetContactDialer',_0x2c4142[_0xc4ef('0x14')],_0x46334e);_0x3a1d23(_0x1e8318['error'](0x1f4,_0x2c4142[_0xc4ef('0x14')]));});});});};exports[_0xc4ef('0x34')]=function(_0x3adc83){var _0x4c6a99=this;return new Promise(function(_0x246d9b,_0x53d935){return db[_0xc4ef('0x35')][_0xc4ef('0x20')](function(_0x57c831){return db[_0xc4ef('0x36')]['create'](_0x3adc83[_0xc4ef('0x1a')],{'raw':_0x3adc83[_0xc4ef('0x8')]?_0x3adc83[_0xc4ef('0x8')][_0xc4ef('0x9')]===undefined?!![]:![]:!![],'transaction':_0x57c831})[_0xc4ef('0xf')](function(){logger[_0xc4ef('0x10')]('MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON[_0xc4ef('0x13')](_0x3adc83['options'][_0xc4ef('0xa')]),_0x3adc83[_0xc4ef('0x8')][_0xc4ef('0xa')][_0xc4ef('0x32')]);return db['CmHopper']['destroy']({'where':_0x3adc83[_0xc4ef('0x8')]?_0x3adc83[_0xc4ef('0x8')][_0xc4ef('0xa')]||null:null,'transaction':_0x57c831});});})[_0xc4ef('0xf')](function(_0xaf9100){logger[_0xc4ef('0x10')](_0xc4ef('0x34'),_0x3adc83);logger[_0xc4ef('0x12')](_0xc4ef('0x34'),_0x3adc83,JSON['stringify'](_0xaf9100));_0x246d9b(_0xaf9100);})[_0xc4ef('0x18')](function(_0xe4a1dd){logger[_0xc4ef('0x15')](_0xc4ef('0x34'),_0xe4a1dd['message'],_0x3adc83);_0x53d935(_0x4c6a99[_0xc4ef('0x15')](0x1f4,_0xe4a1dd[_0xc4ef('0x14')]));});});};exports['CountReScheduled']=function(_0x1711bf){var _0x3b79c8=this;return new Promise(function(_0x5dc283,_0x41db1c){return db[_0xc4ef('0x6')][_0xc4ef('0x7')]({'raw':_0x1711bf[_0xc4ef('0x8')]?_0x1711bf[_0xc4ef('0x8')][_0xc4ef('0x9')]===undefined?!![]:![]:!![],'where':_0x1711bf['options']?_0x1711bf['options']['where']||null:null,'attributes':[[db[_0xc4ef('0x35')]['fn'](_0xc4ef('0x37'),db[_0xc4ef('0x35')]['fn']('IF',db['sequelize'][_0xc4ef('0x38')](_0xc4ef('0x39')+util[_0xc4ef('0x3a')]('\x22%s\x22',moment()[_0xc4ef('0x3a')](_0xc4ef('0x3b')))+_0xc4ef('0x3c')))),'contactsRescheduled']]})[_0xc4ef('0xf')](function(_0x8b57ff){logger[_0xc4ef('0x10')](_0xc4ef('0x3d'),_0x1711bf);logger[_0xc4ef('0x12')](_0xc4ef('0x3d'),_0x1711bf,JSON[_0xc4ef('0x13')](_0x8b57ff));_0x5dc283(_0x8b57ff);})[_0xc4ef('0x18')](function(_0x221af2){logger[_0xc4ef('0x15')](_0xc4ef('0x3d'),_0x221af2['message'],_0x1711bf);_0x41db1c(_0x3b79c8[_0xc4ef('0x15')](0x1f4,_0x221af2[_0xc4ef('0x14')]));});});};exports[_0xc4ef('0x3e')]=function(_0x39911c){var _0x444e22=this;return new Promise(function(_0x21e500,_0x5a1c27){return db['CmContact'][_0xc4ef('0x3f')]()[_0xc4ef('0xf')](function(){return db[_0xc4ef('0x35')][_0xc4ef('0x20')](function(_0x2c088d){return db[_0xc4ef('0x6')][_0xc4ef('0x7')]({'where':_0x39911c[_0xc4ef('0x8')]?_0x39911c[_0xc4ef('0x8')][_0xc4ef('0xa')]||null:null,'attributes':_0x39911c['options']?_0x39911c['options']['attributes']||null:null,'limit':0x1,'order':_0x39911c[_0xc4ef('0x8')]?_0x39911c['options']['order']||null:null,'group':db['CmHopper'][_0xc4ef('0x2b')],'transaction':_0x2c088d,'lock':_0x2c088d[_0xc4ef('0x22')][_0xc4ef('0x23')],'include':_0x39911c[_0xc4ef('0x8')]?_0x39911c[_0xc4ef('0x8')][_0xc4ef('0xc')]?_['map'](_0x39911c['options'][_0xc4ef('0xc')],function(_0x228ca3){return{'model':db[_0x228ca3['model']],'as':_0x228ca3['as'],'attributes':_0x228ca3[_0xc4ef('0xb')],'include':_0x228ca3[_0xc4ef('0xc')]?_['map'](_0x228ca3['include'],function(_0x35280c){return{'model':db[_0x35280c[_0xc4ef('0xe')]],'as':_0x35280c['as'],'attributes':_0x35280c['attributes'],'include':_0x35280c[_0xc4ef('0xc')]?_['map'](_0x35280c[_0xc4ef('0xc')],function(_0x19ad66){return{'model':db[_0x19ad66[_0xc4ef('0xe')]],'as':_0x19ad66['as'],'attributes':_0x19ad66[_0xc4ef('0xb')]};}):[]};}):[]};}):[]:[]})[_0xc4ef('0xf')](function(_0x3e102d){var _0x4b0797=[];for(var _0x336e2f=0x0;_0x336e2f<_0x3e102d[_0xc4ef('0x2a')];_0x336e2f+=0x1){_0x4b0797[_0xc4ef('0x2c')](_0x3e102d[_0x336e2f]['update'](_0x39911c[_0xc4ef('0x1a')],{'transaction':_0x2c088d}));}return BPromise[_0xc4ef('0x2e')](_0x4b0797);});})['then'](function(_0x201b72){logger[_0xc4ef('0x10')]('GetContactRecallMe',_0x39911c);logger[_0xc4ef('0x12')]('GetContactRecallMe',_0x39911c,JSON['stringify'](_0x201b72));_0x21e500(_0x201b72);})[_0xc4ef('0x18')](function(_0xb79e9a){logger[_0xc4ef('0x15')](_0xc4ef('0x3e'),_0xb79e9a[_0xc4ef('0x14')],_0x39911c);_0x5a1c27(_0x444e22[_0xc4ef('0x15')](0x1f4,_0xb79e9a[_0xc4ef('0x14')]));});});});};exports['GetCmHopperPreview']=function(_0x14ed86){var _0x305ac4=this;return new Promise(function(_0x1575fb,_0x36e519){db[_0xc4ef('0x24')]['describe']()[_0xc4ef('0xf')](function(_0x2ecfd4){return db['CmHopper'][_0xc4ef('0x7')]({'raw':_0x14ed86[_0xc4ef('0x8')]?_0x14ed86['options'][_0xc4ef('0x9')]===undefined?!![]:![]:!![],'where':_0x14ed86[_0xc4ef('0x8')]?_0x14ed86[_0xc4ef('0x8')][_0xc4ef('0xa')]||null:null,'attributes':_0x14ed86['options']?_0x14ed86['options'][_0xc4ef('0xb')]||null:null,'limit':_0x14ed86[_0xc4ef('0x8')]?_0x14ed86[_0xc4ef('0x8')][_0xc4ef('0x1d')]||null:null,'include':_0x14ed86['options']?_0x14ed86['options'][_0xc4ef('0xc')]?_['map'](_0x14ed86['options']['include'],function(_0x25a697){return{'model':db[_0x25a697['model']],'as':_0x25a697['as'],'attributes':_0x25a697['as']===_0xc4ef('0x25')?_[_0xc4ef('0x40')](_0x2ecfd4):_0x25a697['attributes'],'include':_0x25a697[_0xc4ef('0xc')]?_[_0xc4ef('0xd')](_0x25a697[_0xc4ef('0xc')],function(_0x14481c){return{'model':db[_0x14481c[_0xc4ef('0xe')]],'as':_0x14481c['as'],'attributes':_0x14481c[_0xc4ef('0xb')],'include':_0x14481c[_0xc4ef('0xc')]?_['map'](_0x14481c['include'],function(_0xf810c9){return{'model':db[_0xf810c9[_0xc4ef('0xe')]],'as':_0xf810c9['as'],'attributes':_0xf810c9[_0xc4ef('0xb')]};}):[]};}):[]};}):[]:[]})[_0xc4ef('0xf')](function(_0x4ba98c){logger[_0xc4ef('0x10')](_0xc4ef('0x11'),_0x14ed86);logger[_0xc4ef('0x12')](_0xc4ef('0x11'),_0x14ed86,JSON[_0xc4ef('0x13')](_0x4ba98c));_0x1575fb(_0x4ba98c);})[_0xc4ef('0x18')](function(_0xec2ba0){logger[_0xc4ef('0x15')]('GetCmHopper',_0xec2ba0[_0xc4ef('0x14')],_0x14ed86);_0x36e519(_0x305ac4[_0xc4ef('0x15')](0x1f4,_0xec2ba0['message']));});});});};exports['GetContactByPhone']=function(_0x505ba1){var _0x2169c9=this;return new Promise(function(_0x1139b2,_0x2b032e){return db['CmContact'][_0xc4ef('0x41')]({'raw':!![],'where':{'phone':_0x505ba1[_0xc4ef('0x8')][_0xc4ef('0xa')][_0xc4ef('0x42')]},'attributes':['id',_0xc4ef('0x43')],'order':[['id',_0xc4ef('0x44')]]})['then'](function(_0x30a9ad){logger['info'](_0xc4ef('0x45'),_0x505ba1);logger[_0xc4ef('0x12')](_0xc4ef('0x45'),_0x505ba1,JSON[_0xc4ef('0x13')](_0x30a9ad));_0x1139b2(_0x30a9ad);})[_0xc4ef('0x18')](function(_0x658495){logger['error'](_0xc4ef('0x45'),_0x658495[_0xc4ef('0x14')],_0x505ba1);_0x2b032e(_0x2169c9[_0xc4ef('0x15')](0x1f4,_0x658495['message']));});});};exports[_0xc4ef('0x46')]=function(_0x4e4552){var _0x3ffce1=this;return new Promise(function(_0x499849,_0x4b2c24){return db['sequelize'][_0xc4ef('0x20')](function(_0x5d284c){var _0x59d56a=_0x4e4552[_0xc4ef('0x8')]&&_0x4e4552['options'][_0xc4ef('0xa')]?_0x4e4552[_0xc4ef('0x8')]['where']:{};return db[_0xc4ef('0x6')][_0xc4ef('0x1c')](_0x4e4552['body'],{'where':_0x59d56a,'transaction':_0x5d284c})[_0xc4ef('0xf')](function(_0x423f3e){logger['info'](_0xc4ef('0x46'),_0x4e4552);logger[_0xc4ef('0x12')](_0xc4ef('0x46'),_0x4e4552,JSON[_0xc4ef('0x13')](_0x423f3e));_0x499849(_0x423f3e);})[_0xc4ef('0x18')](function(_0x48788d){logger['error'](_0xc4ef('0x46'),_0x48788d['message'],_0x4e4552);_0x4b2c24(_0x3ffce1[_0xc4ef('0x15')](0x1f4,_0x48788d['message']));});});});};exports[_0xc4ef('0x47')]=function(_0x37f459){var _0x4407d9=this;var _0x358f14=_0x37f459['body'][_0xc4ef('0xa')][_0xc4ef('0x48')];var _0x29a38f=_0x37f459[_0xc4ef('0x1a')]['where'][_0xc4ef('0x49')];var _0x3c4fd8=_0x37f459[_0xc4ef('0x1a')]['where'][_0xc4ef('0x4a')];return new Promise(function(_0x459ced,_0x503fab){return db[_0xc4ef('0x6')]['findAll']({'where':{'voiceQueueId':{'$in':_0x358f14},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0xc4ef('0x35')]['literal']('NOW()\x20+\x20INTERVAL\x20'+_0x29a38f+_0xc4ef('0x4b')),'$gt':db[_0xc4ef('0x35')][_0xc4ef('0x38')](_0xc4ef('0x4c'))}},'UserId':{'$in':_0x3c4fd8}},'include':[{'model':db[_0xc4ef('0x24')],'as':_0xc4ef('0x25')},{'model':db[_0xc4ef('0x26')],'as':_0xc4ef('0x27'),'attributes':['id',_0xc4ef('0x28'),'voicePause']},{'model':db['CmList'],'as':_0xc4ef('0x4d')}]})[_0xc4ef('0xf')](function(_0xf113a){if(_0xf113a[_0xc4ef('0x2a')]>0x0){return db[_0xc4ef('0x35')][_0xc4ef('0x20')](function(_0x4d028a){return db[_0xc4ef('0x6')]['update']({'recallmeNotifiedDate':db['sequelize']['literal'](_0xc4ef('0x4c'))},{'where':{'id':{'$in':_['map'](_0xf113a,'id')}},'transaction':_0x4d028a})['then'](function(){_0x459ced(_0xf113a);})[_0xc4ef('0x18')](function(_0x11febc){logger[_0xc4ef('0x15')](_0xc4ef('0x47'),_0x11febc['message'],_0x37f459);_0x503fab(_0x4407d9['error'](0x1f4,_0x11febc['message']));});})[_0xc4ef('0x18')](function(_0x531e27){logger['error'](_0xc4ef('0x47'),_0x531e27['message'],_0x37f459);_0x503fab(_0x4407d9[_0xc4ef('0x15')](0x1f4,_0x531e27[_0xc4ef('0x14')]));});}else{_0x459ced(_0xf113a);}});});};