5a64f27a7d2be1b8ffb462199ecdc6a3fd2a7b68
[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 _0xb120=['find','where','CreateCmHopper','create','body','UpdateCmHopper','active','DestroyCmHopper','destroy','CmContact','describe','sequelize','UPDATE','keys','User','Agent','name','voicePause','UserId','push','update','all','GetContactDialer','length','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','MoveContactManagedDialer','transaction','CmHopperFinal','CountReScheduled','literal','format','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','order','LOCK','GetCmHopperPreview','GetContactByPhone','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueIds','interval','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','NOW()','Contact','List','util','moment','bluebird','../../mysqldb','rpc','GetCmHopper','CmHopper','findAll','options','raw','attributes','limit','include','map','model','then','info','debug','stringify','catch','error','message','ShowCmHopper'];(function(_0x2d34d6,_0x397ff9){var _0x1d3d12=function(_0x558800){while(--_0x558800){_0x2d34d6['push'](_0x2d34d6['shift']());}};_0x1d3d12(++_0x397ff9);}(_0xb120,0x7f));var _0x0b12=function(_0x3a05c4,_0x1937e4){_0x3a05c4=_0x3a05c4-0x0;var _0x439be5=_0xb120[_0x3a05c4];return _0x439be5;};'use strict';var _=require('lodash');var util=require(_0x0b12('0x0'));var moment=require(_0x0b12('0x1'));var BPromise=require(_0x0b12('0x2'));var db=require(_0x0b12('0x3'))['db'];var logger=require('../../config/logger')(_0x0b12('0x4'));exports[_0x0b12('0x5')]=function(_0x27cf79){var _0x463d39=this;return new Promise(function(_0x141986,_0x128ff5){return db[_0x0b12('0x6')][_0x0b12('0x7')]({'raw':_0x27cf79[_0x0b12('0x8')]?_0x27cf79[_0x0b12('0x8')][_0x0b12('0x9')]===undefined?!![]:![]:!![],'where':_0x27cf79[_0x0b12('0x8')]?_0x27cf79[_0x0b12('0x8')]['where']||null:null,'attributes':_0x27cf79[_0x0b12('0x8')]?_0x27cf79[_0x0b12('0x8')][_0x0b12('0xa')]||null:null,'limit':_0x27cf79['options']?_0x27cf79[_0x0b12('0x8')][_0x0b12('0xb')]||null:null,'include':_0x27cf79[_0x0b12('0x8')]?_0x27cf79[_0x0b12('0x8')]['include']?_['map'](_0x27cf79['options'][_0x0b12('0xc')],function(_0x12ee7c){return{'model':db[_0x12ee7c['model']],'as':_0x12ee7c['as'],'attributes':_0x12ee7c[_0x0b12('0xa')],'include':_0x12ee7c['include']?_[_0x0b12('0xd')](_0x12ee7c[_0x0b12('0xc')],function(_0x4a2d96){return{'model':db[_0x4a2d96[_0x0b12('0xe')]],'as':_0x4a2d96['as'],'attributes':_0x4a2d96[_0x0b12('0xa')],'include':_0x4a2d96['include']?_[_0x0b12('0xd')](_0x4a2d96[_0x0b12('0xc')],function(_0x21569c){return{'model':db[_0x21569c[_0x0b12('0xe')]],'as':_0x21569c['as'],'attributes':_0x21569c[_0x0b12('0xa')]};}):[]};}):[]};}):[]:[]})[_0x0b12('0xf')](function(_0x19a1a7){logger[_0x0b12('0x10')](_0x0b12('0x5'),_0x27cf79);logger[_0x0b12('0x11')](_0x0b12('0x5'),_0x27cf79,JSON[_0x0b12('0x12')](_0x19a1a7));_0x141986(_0x19a1a7);})[_0x0b12('0x13')](function(_0x240ce6){logger[_0x0b12('0x14')](_0x0b12('0x5'),_0x240ce6[_0x0b12('0x15')],_0x27cf79);_0x128ff5(_0x463d39[_0x0b12('0x14')](0x1f4,_0x240ce6[_0x0b12('0x15')]));});});};exports[_0x0b12('0x16')]=function(_0x2ece66){var _0x43d08c=this;return new Promise(function(_0x44d3b2,_0x5899be){return db[_0x0b12('0x6')][_0x0b12('0x17')]({'raw':_0x2ece66[_0x0b12('0x8')]?_0x2ece66['options'][_0x0b12('0x9')]===undefined?!![]:![]:!![],'where':_0x2ece66[_0x0b12('0x8')]?_0x2ece66['options'][_0x0b12('0x18')]||null:null,'attributes':_0x2ece66[_0x0b12('0x8')]?_0x2ece66[_0x0b12('0x8')][_0x0b12('0xa')]||null:null,'include':_0x2ece66[_0x0b12('0x8')]?_0x2ece66[_0x0b12('0x8')][_0x0b12('0xc')]?_[_0x0b12('0xd')](_0x2ece66['options'][_0x0b12('0xc')],function(_0x2c0d7b){return{'model':db[_0x2c0d7b[_0x0b12('0xe')]],'as':_0x2c0d7b['as'],'attributes':_0x2c0d7b[_0x0b12('0xa')],'include':_0x2c0d7b[_0x0b12('0xc')]?_[_0x0b12('0xd')](_0x2c0d7b[_0x0b12('0xc')],function(_0x232933){return{'model':db[_0x232933[_0x0b12('0xe')]],'as':_0x232933['as'],'attributes':_0x232933[_0x0b12('0xa')],'include':_0x232933[_0x0b12('0xc')]?_[_0x0b12('0xd')](_0x232933[_0x0b12('0xc')],function(_0xe664b0){return{'model':db[_0xe664b0['model']],'as':_0xe664b0['as'],'attributes':_0xe664b0[_0x0b12('0xa')]};}):[]};}):[]};}):[]:[]})[_0x0b12('0xf')](function(_0x1a86bf){logger[_0x0b12('0x10')](_0x0b12('0x16'),_0x2ece66);logger['debug'](_0x0b12('0x16'),_0x2ece66,JSON[_0x0b12('0x12')](_0x1a86bf));_0x44d3b2(_0x1a86bf);})['catch'](function(_0x36b22e){logger['error'](_0x0b12('0x16'),_0x36b22e[_0x0b12('0x15')],_0x2ece66);_0x5899be(_0x43d08c[_0x0b12('0x14')](0x1f4,_0x36b22e[_0x0b12('0x15')]));});});};exports[_0x0b12('0x19')]=function(_0x40679a){var _0x4ce434=this;return new Promise(function(_0x30598a,_0x57dc12){return db[_0x0b12('0x6')][_0x0b12('0x1a')](_0x40679a[_0x0b12('0x1b')],{'raw':_0x40679a['options']?_0x40679a[_0x0b12('0x8')][_0x0b12('0x9')]===undefined?!![]:![]:!![]})['then'](function(_0x3d2850){logger[_0x0b12('0x10')](_0x0b12('0x19'),_0x40679a);logger[_0x0b12('0x11')]('CreateCmHopper',_0x40679a,JSON[_0x0b12('0x12')](_0x3d2850));_0x30598a(_0x3d2850);})[_0x0b12('0x13')](function(_0x21195b){logger[_0x0b12('0x14')]('CreateCmHopper',_0x21195b[_0x0b12('0x15')],_0x40679a);_0x57dc12(_0x4ce434['error'](0x1f4,_0x21195b[_0x0b12('0x15')]));});});};exports['UpdateCmHopper']=function(_0x589879){var _0x9ea4e=this;return new Promise(function(_0x17f70b,_0x426c64){return db['CmHopper']['update'](_0x589879[_0x0b12('0x1b')],{'raw':_0x589879[_0x0b12('0x8')]?_0x589879['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x589879['options']?_0x589879[_0x0b12('0x8')][_0x0b12('0x18')]||null:null,'attributes':_0x589879[_0x0b12('0x8')]?_0x589879[_0x0b12('0x8')][_0x0b12('0xa')]||null:null,'limit':_0x589879['options']?_0x589879[_0x0b12('0x8')][_0x0b12('0xb')]||null:null})[_0x0b12('0xf')](function(_0x23ebde){logger[_0x0b12('0x10')](_0x0b12('0x1c'),_0x589879);logger[_0x0b12('0x10')]('UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON['stringify'](_0x589879[_0x0b12('0x8')][_0x0b12('0x18')]),_0x589879['body'][_0x0b12('0x1d')]);logger[_0x0b12('0x11')](_0x0b12('0x1c'),_0x589879,JSON[_0x0b12('0x12')](_0x23ebde));_0x17f70b(_0x23ebde);})[_0x0b12('0x13')](function(_0x4e725d){logger[_0x0b12('0x14')](_0x0b12('0x1c'),_0x4e725d['message'],_0x589879);_0x426c64(_0x9ea4e[_0x0b12('0x14')](0x1f4,_0x4e725d[_0x0b12('0x15')]));});});};exports[_0x0b12('0x1e')]=function(_0x4f2523){var _0x457498=this;return new Promise(function(_0x5e35a2,_0x5677c7){return db['CmHopper'][_0x0b12('0x1f')]({'where':_0x4f2523[_0x0b12('0x8')]?_0x4f2523[_0x0b12('0x8')]['where']||null:null})[_0x0b12('0xf')](function(_0x459e91){logger[_0x0b12('0x10')](_0x0b12('0x1e'),_0x4f2523);logger[_0x0b12('0x11')](_0x0b12('0x1e'),_0x4f2523,JSON[_0x0b12('0x12')](_0x459e91));_0x5e35a2(_0x459e91);})[_0x0b12('0x13')](function(_0x2c5106){logger['error'](_0x0b12('0x1e'),_0x2c5106[_0x0b12('0x15')],_0x4f2523);_0x5677c7(_0x457498[_0x0b12('0x14')](0x1f4,_0x2c5106[_0x0b12('0x15')]));});});};exports['GetContactDialer']=function(_0x2887c2){var _0x5e21c0=this;return new Promise(function(_0xf8aa4,_0x2999fe){return db[_0x0b12('0x20')][_0x0b12('0x21')]()[_0x0b12('0xf')](function(_0xffc328){return db[_0x0b12('0x22')]['transaction'](function(_0x33dcc5){return db['CmHopper'][_0x0b12('0x7')]({'where':_0x2887c2[_0x0b12('0x8')]?_0x2887c2[_0x0b12('0x8')]['where']||null:null,'attributes':_0x2887c2[_0x0b12('0x8')]?_0x2887c2[_0x0b12('0x8')]['attributes']||null:null,'limit':_0x2887c2[_0x0b12('0x8')]?_0x2887c2[_0x0b12('0x8')][_0x0b12('0xb')]||null:null,'order':_0x2887c2[_0x0b12('0x8')]?_0x2887c2[_0x0b12('0x8')]['order']||null:null,'transaction':_0x33dcc5,'lock':_0x33dcc5['LOCK'][_0x0b12('0x23')],'include':[{'model':db['CmContact'],'as':'Contact','attributes':_[_0x0b12('0x24')](_0xffc328)},{'model':db[_0x0b12('0x25')],'as':_0x0b12('0x26'),'attributes':['id',_0x0b12('0x27'),_0x0b12('0x28')]}]})[_0x0b12('0xf')](function(_0x47d641){var _0x129292=[];var _0x5d2dc7=[];for(var _0x10d068=0x0;_0x10d068<_0x47d641['length'];_0x10d068+=0x1){var _0x191a4e=_0x47d641[_0x10d068][_0x0b12('0x29')];if(_0x191a4e===null){_0x129292[_0x0b12('0x2a')](_0x47d641[_0x10d068][_0x0b12('0x2b')](_0x2887c2['body'],{'transaction':_0x33dcc5}));}else if(!_0x5d2dc7['includes'](_0x191a4e)){_0x5d2dc7['push'](_0x191a4e);_0x129292[_0x0b12('0x2a')](_0x47d641[_0x10d068][_0x0b12('0x2b')](_0x2887c2[_0x0b12('0x1b')],{'transaction':_0x33dcc5}));}}return BPromise[_0x0b12('0x2c')](_0x129292);});})[_0x0b12('0xf')](function(_0xdfcae5){logger[_0x0b12('0x10')](_0x0b12('0x2d'),_0x2887c2);if(_0xdfcae5[_0x0b12('0x2e')]>0x0){logger[_0x0b12('0x10')](_0x0b12('0x2f'),_0xdfcae5[0x0][_0x0b12('0x30')]['id'],_0xdfcae5[0x0][_0x0b12('0x30')]['ContactId'],_0xdfcae5[0x0][_0x0b12('0x30')][_0x0b12('0x1d')]);}logger[_0x0b12('0x11')]('GetContactDialer',_0x2887c2,JSON[_0x0b12('0x12')](_0xdfcae5));_0xf8aa4(_0xdfcae5);})[_0x0b12('0x13')](function(_0x232bc6){logger[_0x0b12('0x14')]('GetContactDialer',_0x232bc6[_0x0b12('0x15')],_0x2887c2);_0x2999fe(_0x5e21c0[_0x0b12('0x14')](0x1f4,_0x232bc6['message']));});});});};exports[_0x0b12('0x31')]=function(_0x360814){var _0x483c99=this;return new Promise(function(_0x283bb1,_0x52ec08){return db[_0x0b12('0x22')][_0x0b12('0x32')](function(_0x2387ef){return db[_0x0b12('0x33')][_0x0b12('0x1a')](_0x360814[_0x0b12('0x1b')],{'raw':_0x360814[_0x0b12('0x8')]?_0x360814[_0x0b12('0x8')]['raw']===undefined?!![]:![]:!![],'transaction':_0x2387ef})[_0x0b12('0xf')](function(){logger[_0x0b12('0x10')]('MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON[_0x0b12('0x12')](_0x360814['options'][_0x0b12('0x18')]),_0x360814[_0x0b12('0x8')][_0x0b12('0x18')][_0x0b12('0x1d')]);return db[_0x0b12('0x6')][_0x0b12('0x1f')]({'where':_0x360814[_0x0b12('0x8')]?_0x360814[_0x0b12('0x8')][_0x0b12('0x18')]||null:null,'transaction':_0x2387ef});});})[_0x0b12('0xf')](function(_0x568901){logger[_0x0b12('0x10')](_0x0b12('0x31'),_0x360814);logger[_0x0b12('0x11')](_0x0b12('0x31'),_0x360814,JSON[_0x0b12('0x12')](_0x568901));_0x283bb1(_0x568901);})['catch'](function(_0x38a101){logger[_0x0b12('0x14')](_0x0b12('0x31'),_0x38a101[_0x0b12('0x15')],_0x360814);_0x52ec08(_0x483c99['error'](0x1f4,_0x38a101[_0x0b12('0x15')]));});});};exports[_0x0b12('0x34')]=function(_0x2ca3f8){var _0x25e516=this;return new Promise(function(_0x36790d,_0x2ce5c8){return db['CmHopper'][_0x0b12('0x7')]({'raw':_0x2ca3f8[_0x0b12('0x8')]?_0x2ca3f8[_0x0b12('0x8')][_0x0b12('0x9')]===undefined?!![]:![]:!![],'where':_0x2ca3f8[_0x0b12('0x8')]?_0x2ca3f8[_0x0b12('0x8')][_0x0b12('0x18')]||null:null,'attributes':[[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x0b12('0x22')][_0x0b12('0x35')]('`scheduledat`\x20>=\x20'+util[_0x0b12('0x36')]('\x22%s\x22',moment()[_0x0b12('0x36')](_0x0b12('0x37')))+_0x0b12('0x38')))),_0x0b12('0x39')]]})[_0x0b12('0xf')](function(_0x41e708){logger['info'](_0x0b12('0x34'),_0x2ca3f8);logger[_0x0b12('0x11')](_0x0b12('0x34'),_0x2ca3f8,JSON['stringify'](_0x41e708));_0x36790d(_0x41e708);})[_0x0b12('0x13')](function(_0x14ce15){logger[_0x0b12('0x14')]('CountReScheduled',_0x14ce15['message'],_0x2ca3f8);_0x2ce5c8(_0x25e516[_0x0b12('0x14')](0x1f4,_0x14ce15[_0x0b12('0x15')]));});});};exports[_0x0b12('0x3a')]=function(_0x158e8b){var _0x42258b=this;return new Promise(function(_0x4a2856,_0x13cac5){return db[_0x0b12('0x20')]['describe']()[_0x0b12('0xf')](function(){return db['sequelize']['transaction'](function(_0x2f8075){return db['CmHopper']['findAll']({'where':_0x158e8b[_0x0b12('0x8')]?_0x158e8b['options'][_0x0b12('0x18')]||null:null,'attributes':_0x158e8b['options']?_0x158e8b[_0x0b12('0x8')][_0x0b12('0xa')]||null:null,'limit':0x1,'order':_0x158e8b[_0x0b12('0x8')]?_0x158e8b[_0x0b12('0x8')][_0x0b12('0x3b')]||null:null,'group':db[_0x0b12('0x6')]['UserId'],'transaction':_0x2f8075,'lock':_0x2f8075[_0x0b12('0x3c')]['UPDATE'],'include':_0x158e8b[_0x0b12('0x8')]?_0x158e8b[_0x0b12('0x8')][_0x0b12('0xc')]?_['map'](_0x158e8b[_0x0b12('0x8')][_0x0b12('0xc')],function(_0x47a879){return{'model':db[_0x47a879[_0x0b12('0xe')]],'as':_0x47a879['as'],'attributes':_0x47a879[_0x0b12('0xa')],'include':_0x47a879[_0x0b12('0xc')]?_[_0x0b12('0xd')](_0x47a879[_0x0b12('0xc')],function(_0x3daa29){return{'model':db[_0x3daa29['model']],'as':_0x3daa29['as'],'attributes':_0x3daa29[_0x0b12('0xa')],'include':_0x3daa29[_0x0b12('0xc')]?_[_0x0b12('0xd')](_0x3daa29['include'],function(_0x41c2e8){return{'model':db[_0x41c2e8[_0x0b12('0xe')]],'as':_0x41c2e8['as'],'attributes':_0x41c2e8[_0x0b12('0xa')]};}):[]};}):[]};}):[]:[]})[_0x0b12('0xf')](function(_0x2404d1){var _0x4330ec=[];for(var _0x4fd87b=0x0;_0x4fd87b<_0x2404d1[_0x0b12('0x2e')];_0x4fd87b+=0x1){_0x4330ec[_0x0b12('0x2a')](_0x2404d1[_0x4fd87b][_0x0b12('0x2b')](_0x158e8b[_0x0b12('0x1b')],{'transaction':_0x2f8075}));}return BPromise['all'](_0x4330ec);});})['then'](function(_0x5f5129){logger[_0x0b12('0x10')](_0x0b12('0x3a'),_0x158e8b);logger[_0x0b12('0x11')]('GetContactRecallMe',_0x158e8b,JSON[_0x0b12('0x12')](_0x5f5129));_0x4a2856(_0x5f5129);})[_0x0b12('0x13')](function(_0x5a2fcf){logger[_0x0b12('0x14')](_0x0b12('0x3a'),_0x5a2fcf[_0x0b12('0x15')],_0x158e8b);_0x13cac5(_0x42258b[_0x0b12('0x14')](0x1f4,_0x5a2fcf[_0x0b12('0x15')]));});});});};exports[_0x0b12('0x3d')]=function(_0x5f2b17){var _0x323cff=this;return new Promise(function(_0x53f1d9,_0x2a3095){db[_0x0b12('0x20')][_0x0b12('0x21')]()[_0x0b12('0xf')](function(_0x568d45){return db[_0x0b12('0x6')][_0x0b12('0x7')]({'raw':_0x5f2b17[_0x0b12('0x8')]?_0x5f2b17[_0x0b12('0x8')]['raw']===undefined?!![]:![]:!![],'where':_0x5f2b17[_0x0b12('0x8')]?_0x5f2b17['options']['where']||null:null,'attributes':_0x5f2b17['options']?_0x5f2b17[_0x0b12('0x8')][_0x0b12('0xa')]||null:null,'limit':_0x5f2b17[_0x0b12('0x8')]?_0x5f2b17['options'][_0x0b12('0xb')]||null:null,'include':_0x5f2b17[_0x0b12('0x8')]?_0x5f2b17['options']['include']?_['map'](_0x5f2b17[_0x0b12('0x8')][_0x0b12('0xc')],function(_0x2b5fd6){return{'model':db[_0x2b5fd6[_0x0b12('0xe')]],'as':_0x2b5fd6['as'],'attributes':_0x2b5fd6['as']==='Contact'?_[_0x0b12('0x24')](_0x568d45):_0x2b5fd6[_0x0b12('0xa')],'include':_0x2b5fd6[_0x0b12('0xc')]?_[_0x0b12('0xd')](_0x2b5fd6[_0x0b12('0xc')],function(_0xa94c01){return{'model':db[_0xa94c01[_0x0b12('0xe')]],'as':_0xa94c01['as'],'attributes':_0xa94c01[_0x0b12('0xa')],'include':_0xa94c01['include']?_[_0x0b12('0xd')](_0xa94c01[_0x0b12('0xc')],function(_0xad28fe){return{'model':db[_0xad28fe[_0x0b12('0xe')]],'as':_0xad28fe['as'],'attributes':_0xad28fe['attributes']};}):[]};}):[]};}):[]:[]})[_0x0b12('0xf')](function(_0x2dcc30){logger['info'](_0x0b12('0x5'),_0x5f2b17);logger[_0x0b12('0x11')]('GetCmHopper',_0x5f2b17,JSON[_0x0b12('0x12')](_0x2dcc30));_0x53f1d9(_0x2dcc30);})['catch'](function(_0x3a20ee){logger[_0x0b12('0x14')](_0x0b12('0x5'),_0x3a20ee[_0x0b12('0x15')],_0x5f2b17);_0x2a3095(_0x323cff[_0x0b12('0x14')](0x1f4,_0x3a20ee['message']));});});});};exports[_0x0b12('0x3e')]=function(_0x2caab0){var _0x25a47e=this;return new Promise(function(_0x5449ad,_0xaa1a9c){return db[_0x0b12('0x20')]['findOne']({'raw':!![],'where':{'phone':_0x2caab0['options']['where']['phone']},'attributes':['id',_0x0b12('0x3f')],'order':[['id',_0x0b12('0x40')]]})[_0x0b12('0xf')](function(_0x2f2437){logger[_0x0b12('0x10')](_0x0b12('0x41'),_0x2caab0);logger[_0x0b12('0x11')]('getContactByPhone',_0x2caab0,JSON[_0x0b12('0x12')](_0x2f2437));_0x5449ad(_0x2f2437);})['catch'](function(_0x1405d3){logger[_0x0b12('0x14')]('getContactByPhone',_0x1405d3[_0x0b12('0x15')],_0x2caab0);_0xaa1a9c(_0x25a47e[_0x0b12('0x14')](0x1f4,_0x1405d3[_0x0b12('0x15')]));});});};exports[_0x0b12('0x42')]=function(_0x4c6d6e){var _0x493aad=this;return new Promise(function(_0x25cded,_0x398dcc){return db[_0x0b12('0x22')][_0x0b12('0x32')](function(_0x5b2999){var _0x2c4839=_0x4c6d6e[_0x0b12('0x8')]&&_0x4c6d6e[_0x0b12('0x8')][_0x0b12('0x18')]?_0x4c6d6e[_0x0b12('0x8')][_0x0b12('0x18')]:{};return db[_0x0b12('0x6')][_0x0b12('0x2b')](_0x4c6d6e['body'],{'where':_0x2c4839,'transaction':_0x5b2999})[_0x0b12('0xf')](function(_0x96c0fc){logger[_0x0b12('0x10')](_0x0b12('0x42'),_0x4c6d6e);logger[_0x0b12('0x11')](_0x0b12('0x42'),_0x4c6d6e,JSON[_0x0b12('0x12')](_0x96c0fc));_0x25cded(_0x96c0fc);})[_0x0b12('0x13')](function(_0x2f31a2){logger['error'](_0x0b12('0x42'),_0x2f31a2[_0x0b12('0x15')],_0x4c6d6e);_0x398dcc(_0x493aad[_0x0b12('0x14')](0x1f4,_0x2f31a2[_0x0b12('0x15')]));});});});};exports[_0x0b12('0x43')]=function(_0x5348d9){var _0x4c64db=this;var _0xc3a0d0=_0x5348d9[_0x0b12('0x1b')][_0x0b12('0x18')][_0x0b12('0x44')];var _0x331298=_0x5348d9[_0x0b12('0x1b')]['where'][_0x0b12('0x45')];var _0x359b1d=_0x5348d9[_0x0b12('0x1b')]['where']['availableAgentsIds'];return new Promise(function(_0x6ee020,_0x370909){return db['CmHopper']['findAll']({'where':{'voiceQueueId':{'$in':_0xc3a0d0},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db['sequelize'][_0x0b12('0x35')](_0x0b12('0x46')+_0x331298+_0x0b12('0x47')),'$gt':db[_0x0b12('0x22')][_0x0b12('0x35')](_0x0b12('0x48'))}},'UserId':{'$in':_0x359b1d}},'include':[{'model':db[_0x0b12('0x20')],'as':_0x0b12('0x49')},{'model':db[_0x0b12('0x25')],'as':_0x0b12('0x26'),'attributes':['id','name',_0x0b12('0x28')]},{'model':db['CmList'],'as':_0x0b12('0x4a')}]})[_0x0b12('0xf')](function(_0x358a91){if(_0x358a91[_0x0b12('0x2e')]>0x0){return db[_0x0b12('0x22')][_0x0b12('0x32')](function(_0x5ae4d7){return db[_0x0b12('0x6')][_0x0b12('0x2b')]({'recallmeNotifiedDate':db['sequelize'][_0x0b12('0x35')](_0x0b12('0x48'))},{'where':{'id':{'$in':_[_0x0b12('0xd')](_0x358a91,'id')}},'transaction':_0x5ae4d7})[_0x0b12('0xf')](function(){_0x6ee020(_0x358a91);})[_0x0b12('0x13')](function(_0x33e1f6){logger[_0x0b12('0x14')](_0x0b12('0x43'),_0x33e1f6[_0x0b12('0x15')],_0x5348d9);_0x370909(_0x4c64db[_0x0b12('0x14')](0x1f4,_0x33e1f6[_0x0b12('0x15')]));});})[_0x0b12('0x13')](function(_0x276593){logger[_0x0b12('0x14')](_0x0b12('0x43'),_0x276593[_0x0b12('0x15')],_0x5348d9);_0x370909(_0x4c64db[_0x0b12('0x14')](0x1f4,_0x276593[_0x0b12('0x15')]));});}else{_0x6ee020(_0x358a91);}});});};