Built motion from commit 192134f6.|2.6.25
[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 _0xea5e=['LOCK','UPDATE','keys','Agent','name','voicePause','length','UserId','includes','push','all','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','MoveContactManagedDialer','transaction','create','CountReScheduled','literal','`scheduledat`\x20>=\x20','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','contactsRescheduled','GetContactRecallMe','GetCmHopperPreview','GetContactByPhone','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueIds','interval','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','NOW()','Contact','CmList','lodash','util','bluebird','../../config/logger','rpc','GetCmHopper','CmHopper','findAll','options','raw','attributes','limit','include','map','model','then','info','debug','stringify','catch','error','message','find','where','ShowCmHopper','CreateCmHopper','body','UpdateCmHopper','update','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','destroy','DestroyCmHopper','GetContactDialer','CmContact','describe','sequelize','order'];(function(_0x548200,_0x3241b8){var _0x1a6d74=function(_0x412f84){while(--_0x412f84){_0x548200['push'](_0x548200['shift']());}};_0x1a6d74(++_0x3241b8);}(_0xea5e,0x10a));var _0xeea5=function(_0x543728,_0x564488){_0x543728=_0x543728-0x0;var _0x2a3ece=_0xea5e[_0x543728];return _0x2a3ece;};'use strict';var _=require(_0xeea5('0x0'));var util=require(_0xeea5('0x1'));var moment=require('moment');var BPromise=require(_0xeea5('0x2'));var db=require('../../mysqldb')['db'];var logger=require(_0xeea5('0x3'))(_0xeea5('0x4'));exports[_0xeea5('0x5')]=function(_0x1a5139){var _0x302c56=this;return new Promise(function(_0x2dae7f,_0x16470d){return db[_0xeea5('0x6')][_0xeea5('0x7')]({'raw':_0x1a5139[_0xeea5('0x8')]?_0x1a5139[_0xeea5('0x8')][_0xeea5('0x9')]===undefined?!![]:![]:!![],'where':_0x1a5139[_0xeea5('0x8')]?_0x1a5139[_0xeea5('0x8')]['where']||null:null,'attributes':_0x1a5139[_0xeea5('0x8')]?_0x1a5139[_0xeea5('0x8')][_0xeea5('0xa')]||null:null,'limit':_0x1a5139[_0xeea5('0x8')]?_0x1a5139[_0xeea5('0x8')][_0xeea5('0xb')]||null:null,'include':_0x1a5139[_0xeea5('0x8')]?_0x1a5139[_0xeea5('0x8')][_0xeea5('0xc')]?_[_0xeea5('0xd')](_0x1a5139['options'][_0xeea5('0xc')],function(_0x1cfff0){return{'model':db[_0x1cfff0[_0xeea5('0xe')]],'as':_0x1cfff0['as'],'attributes':_0x1cfff0['attributes'],'include':_0x1cfff0[_0xeea5('0xc')]?_[_0xeea5('0xd')](_0x1cfff0['include'],function(_0x5439b8){return{'model':db[_0x5439b8['model']],'as':_0x5439b8['as'],'attributes':_0x5439b8[_0xeea5('0xa')],'include':_0x5439b8[_0xeea5('0xc')]?_[_0xeea5('0xd')](_0x5439b8['include'],function(_0x17e5f4){return{'model':db[_0x17e5f4[_0xeea5('0xe')]],'as':_0x17e5f4['as'],'attributes':_0x17e5f4[_0xeea5('0xa')]};}):[]};}):[]};}):[]:[]})[_0xeea5('0xf')](function(_0xb4f018){logger[_0xeea5('0x10')](_0xeea5('0x5'),_0x1a5139);logger[_0xeea5('0x11')](_0xeea5('0x5'),_0x1a5139,JSON[_0xeea5('0x12')](_0xb4f018));_0x2dae7f(_0xb4f018);})[_0xeea5('0x13')](function(_0x420798){logger[_0xeea5('0x14')](_0xeea5('0x5'),_0x420798['message'],_0x1a5139);_0x16470d(_0x302c56['error'](0x1f4,_0x420798[_0xeea5('0x15')]));});});};exports['ShowCmHopper']=function(_0x157da3){var _0x3a796d=this;return new Promise(function(_0x3ff74c,_0x3a17dc){return db['CmHopper'][_0xeea5('0x16')]({'raw':_0x157da3[_0xeea5('0x8')]?_0x157da3[_0xeea5('0x8')][_0xeea5('0x9')]===undefined?!![]:![]:!![],'where':_0x157da3[_0xeea5('0x8')]?_0x157da3[_0xeea5('0x8')][_0xeea5('0x17')]||null:null,'attributes':_0x157da3[_0xeea5('0x8')]?_0x157da3['options'][_0xeea5('0xa')]||null:null,'include':_0x157da3[_0xeea5('0x8')]?_0x157da3[_0xeea5('0x8')]['include']?_[_0xeea5('0xd')](_0x157da3[_0xeea5('0x8')]['include'],function(_0x121696){return{'model':db[_0x121696[_0xeea5('0xe')]],'as':_0x121696['as'],'attributes':_0x121696[_0xeea5('0xa')],'include':_0x121696['include']?_[_0xeea5('0xd')](_0x121696['include'],function(_0x3c9200){return{'model':db[_0x3c9200[_0xeea5('0xe')]],'as':_0x3c9200['as'],'attributes':_0x3c9200['attributes'],'include':_0x3c9200['include']?_[_0xeea5('0xd')](_0x3c9200[_0xeea5('0xc')],function(_0x48e1ec){return{'model':db[_0x48e1ec['model']],'as':_0x48e1ec['as'],'attributes':_0x48e1ec[_0xeea5('0xa')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1b4339){logger[_0xeea5('0x10')](_0xeea5('0x18'),_0x157da3);logger[_0xeea5('0x11')]('ShowCmHopper',_0x157da3,JSON[_0xeea5('0x12')](_0x1b4339));_0x3ff74c(_0x1b4339);})[_0xeea5('0x13')](function(_0x373c2f){logger[_0xeea5('0x14')](_0xeea5('0x18'),_0x373c2f[_0xeea5('0x15')],_0x157da3);_0x3a17dc(_0x3a796d[_0xeea5('0x14')](0x1f4,_0x373c2f[_0xeea5('0x15')]));});});};exports[_0xeea5('0x19')]=function(_0x322407){var _0x503fee=this;return new Promise(function(_0x24e897,_0x1f078c){return db['CmHopper']['create'](_0x322407[_0xeea5('0x1a')],{'raw':_0x322407[_0xeea5('0x8')]?_0x322407[_0xeea5('0x8')][_0xeea5('0x9')]===undefined?!![]:![]:!![]})[_0xeea5('0xf')](function(_0x65e1d7){logger[_0xeea5('0x10')]('CreateCmHopper',_0x322407);logger['debug'](_0xeea5('0x19'),_0x322407,JSON[_0xeea5('0x12')](_0x65e1d7));_0x24e897(_0x65e1d7);})[_0xeea5('0x13')](function(_0x478ba4){logger[_0xeea5('0x14')](_0xeea5('0x19'),_0x478ba4[_0xeea5('0x15')],_0x322407);_0x1f078c(_0x503fee[_0xeea5('0x14')](0x1f4,_0x478ba4['message']));});});};exports[_0xeea5('0x1b')]=function(_0x1698ea){var _0x45413a=this;return new Promise(function(_0x2faafa,_0x1d4e44){return db[_0xeea5('0x6')][_0xeea5('0x1c')](_0x1698ea[_0xeea5('0x1a')],{'raw':_0x1698ea['options']?_0x1698ea[_0xeea5('0x8')][_0xeea5('0x9')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1698ea[_0xeea5('0x8')]?_0x1698ea[_0xeea5('0x8')][_0xeea5('0x17')]||null:null,'attributes':_0x1698ea[_0xeea5('0x8')]?_0x1698ea['options']['attributes']||null:null,'limit':_0x1698ea[_0xeea5('0x8')]?_0x1698ea['options'][_0xeea5('0xb')]||null:null})[_0xeea5('0xf')](function(_0x50d9e1){logger[_0xeea5('0x10')](_0xeea5('0x1b'),_0x1698ea);logger[_0xeea5('0x10')](_0xeea5('0x1d'),JSON['stringify'](_0x1698ea[_0xeea5('0x8')][_0xeea5('0x17')]),_0x1698ea[_0xeea5('0x1a')][_0xeea5('0x1e')]);logger[_0xeea5('0x11')](_0xeea5('0x1b'),_0x1698ea,JSON[_0xeea5('0x12')](_0x50d9e1));_0x2faafa(_0x50d9e1);})[_0xeea5('0x13')](function(_0x5c8bf9){logger[_0xeea5('0x14')]('UpdateCmHopper',_0x5c8bf9[_0xeea5('0x15')],_0x1698ea);_0x1d4e44(_0x45413a[_0xeea5('0x14')](0x1f4,_0x5c8bf9[_0xeea5('0x15')]));});});};exports['DestroyCmHopper']=function(_0x98ed9e){var _0xfa9d88=this;return new Promise(function(_0x3dd2ba,_0x57d640){return db[_0xeea5('0x6')][_0xeea5('0x1f')]({'where':_0x98ed9e['options']?_0x98ed9e[_0xeea5('0x8')][_0xeea5('0x17')]||null:null})[_0xeea5('0xf')](function(_0x3bd28f){logger[_0xeea5('0x10')](_0xeea5('0x20'),_0x98ed9e);logger[_0xeea5('0x11')]('DestroyCmHopper',_0x98ed9e,JSON[_0xeea5('0x12')](_0x3bd28f));_0x3dd2ba(_0x3bd28f);})[_0xeea5('0x13')](function(_0x55ec70){logger[_0xeea5('0x14')](_0xeea5('0x20'),_0x55ec70[_0xeea5('0x15')],_0x98ed9e);_0x57d640(_0xfa9d88[_0xeea5('0x14')](0x1f4,_0x55ec70[_0xeea5('0x15')]));});});};exports[_0xeea5('0x21')]=function(_0x6fe2f6){var _0x2d1b25=this;return new Promise(function(_0x5ea60d,_0x1d6990){return db[_0xeea5('0x22')][_0xeea5('0x23')]()['then'](function(_0x51eecf){return db[_0xeea5('0x24')]['transaction'](function(_0x32a085){return db['CmHopper']['findAll']({'where':_0x6fe2f6['options']?_0x6fe2f6[_0xeea5('0x8')][_0xeea5('0x17')]||null:null,'attributes':_0x6fe2f6['options']?_0x6fe2f6[_0xeea5('0x8')]['attributes']||null:null,'limit':_0x6fe2f6[_0xeea5('0x8')]?_0x6fe2f6[_0xeea5('0x8')][_0xeea5('0xb')]||null:null,'order':_0x6fe2f6['options']?_0x6fe2f6[_0xeea5('0x8')][_0xeea5('0x25')]||null:null,'transaction':_0x32a085,'lock':_0x32a085[_0xeea5('0x26')][_0xeea5('0x27')],'include':[{'model':db[_0xeea5('0x22')],'as':'Contact','attributes':_[_0xeea5('0x28')](_0x51eecf)},{'model':db['User'],'as':_0xeea5('0x29'),'attributes':['id',_0xeea5('0x2a'),_0xeea5('0x2b')]}]})['then'](function(_0x116277){var _0x2b211f=[];var _0x4d40de=[];for(var _0x3fa8ff=0x0;_0x3fa8ff<_0x116277[_0xeea5('0x2c')];_0x3fa8ff+=0x1){var _0x2d0ee5=_0x116277[_0x3fa8ff][_0xeea5('0x2d')];if(_0x2d0ee5===null){_0x2b211f['push'](_0x116277[_0x3fa8ff]['update'](_0x6fe2f6[_0xeea5('0x1a')],{'transaction':_0x32a085}));}else if(!_0x4d40de[_0xeea5('0x2e')](_0x2d0ee5)){_0x4d40de[_0xeea5('0x2f')](_0x2d0ee5);_0x2b211f[_0xeea5('0x2f')](_0x116277[_0x3fa8ff][_0xeea5('0x1c')](_0x6fe2f6['body'],{'transaction':_0x32a085}));}}return BPromise[_0xeea5('0x30')](_0x2b211f);});})[_0xeea5('0xf')](function(_0x1fdad4){logger[_0xeea5('0x10')](_0xeea5('0x21'),_0x6fe2f6);if(_0x1fdad4[_0xeea5('0x2c')]>0x0){logger['info'](_0xeea5('0x31'),_0x1fdad4[0x0][_0xeea5('0x32')]['id'],_0x1fdad4[0x0]['dataValues'][_0xeea5('0x33')],_0x1fdad4[0x0]['dataValues'][_0xeea5('0x1e')]);}logger['debug']('GetContactDialer',_0x6fe2f6,JSON[_0xeea5('0x12')](_0x1fdad4));_0x5ea60d(_0x1fdad4);})['catch'](function(_0xe0a69d){logger[_0xeea5('0x14')](_0xeea5('0x21'),_0xe0a69d['message'],_0x6fe2f6);_0x1d6990(_0x2d1b25[_0xeea5('0x14')](0x1f4,_0xe0a69d[_0xeea5('0x15')]));});});});};exports[_0xeea5('0x34')]=function(_0x45c08a){var _0x2e705c=this;return new Promise(function(_0x25e91a,_0x5e2d92){return db[_0xeea5('0x24')][_0xeea5('0x35')](function(_0x2e531e){return db['CmHopperFinal'][_0xeea5('0x36')](_0x45c08a[_0xeea5('0x1a')],{'raw':_0x45c08a['options']?_0x45c08a[_0xeea5('0x8')][_0xeea5('0x9')]===undefined?!![]:![]:!![],'transaction':_0x2e531e})[_0xeea5('0xf')](function(){logger[_0xeea5('0x10')]('MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON['stringify'](_0x45c08a[_0xeea5('0x8')][_0xeea5('0x17')]),_0x45c08a[_0xeea5('0x8')]['where'][_0xeea5('0x1e')]);return db[_0xeea5('0x6')]['destroy']({'where':_0x45c08a['options']?_0x45c08a['options']['where']||null:null,'transaction':_0x2e531e});});})['then'](function(_0x7b3e9e){logger[_0xeea5('0x10')](_0xeea5('0x34'),_0x45c08a);logger['debug'](_0xeea5('0x34'),_0x45c08a,JSON[_0xeea5('0x12')](_0x7b3e9e));_0x25e91a(_0x7b3e9e);})[_0xeea5('0x13')](function(_0x3e0c79){logger['error'](_0xeea5('0x34'),_0x3e0c79[_0xeea5('0x15')],_0x45c08a);_0x5e2d92(_0x2e705c[_0xeea5('0x14')](0x1f4,_0x3e0c79[_0xeea5('0x15')]));});});};exports[_0xeea5('0x37')]=function(_0x8df591){var _0x283245=this;return new Promise(function(_0x4a0d1f,_0x4a348b){return db[_0xeea5('0x6')][_0xeea5('0x7')]({'raw':_0x8df591[_0xeea5('0x8')]?_0x8df591[_0xeea5('0x8')][_0xeea5('0x9')]===undefined?!![]:![]:!![],'where':_0x8df591['options']?_0x8df591[_0xeea5('0x8')][_0xeea5('0x17')]||null:null,'attributes':[[db[_0xeea5('0x24')]['fn']('COUNT',db[_0xeea5('0x24')]['fn']('IF',db[_0xeea5('0x24')][_0xeea5('0x38')](_0xeea5('0x39')+util['format'](_0xeea5('0x3a'),moment()['format'](_0xeea5('0x3b')))+'\x20,\x201,\x20null'))),_0xeea5('0x3c')]]})['then'](function(_0x28b184){logger[_0xeea5('0x10')](_0xeea5('0x37'),_0x8df591);logger[_0xeea5('0x11')](_0xeea5('0x37'),_0x8df591,JSON[_0xeea5('0x12')](_0x28b184));_0x4a0d1f(_0x28b184);})[_0xeea5('0x13')](function(_0x57e655){logger[_0xeea5('0x14')](_0xeea5('0x37'),_0x57e655['message'],_0x8df591);_0x4a348b(_0x283245[_0xeea5('0x14')](0x1f4,_0x57e655[_0xeea5('0x15')]));});});};exports[_0xeea5('0x3d')]=function(_0x49d871){var _0x1d93b1=this;return new Promise(function(_0x464322,_0x5ea2cb){return db['CmContact'][_0xeea5('0x23')]()[_0xeea5('0xf')](function(){return db[_0xeea5('0x24')][_0xeea5('0x35')](function(_0x1887b4){return db[_0xeea5('0x6')]['findAll']({'where':_0x49d871[_0xeea5('0x8')]?_0x49d871['options']['where']||null:null,'attributes':_0x49d871[_0xeea5('0x8')]?_0x49d871[_0xeea5('0x8')]['attributes']||null:null,'limit':0x1,'order':_0x49d871['options']?_0x49d871['options'][_0xeea5('0x25')]||null:null,'group':db[_0xeea5('0x6')][_0xeea5('0x2d')],'transaction':_0x1887b4,'lock':_0x1887b4[_0xeea5('0x26')][_0xeea5('0x27')],'include':_0x49d871['options']?_0x49d871['options'][_0xeea5('0xc')]?_[_0xeea5('0xd')](_0x49d871[_0xeea5('0x8')][_0xeea5('0xc')],function(_0x5451ed){return{'model':db[_0x5451ed[_0xeea5('0xe')]],'as':_0x5451ed['as'],'attributes':_0x5451ed[_0xeea5('0xa')],'include':_0x5451ed['include']?_[_0xeea5('0xd')](_0x5451ed[_0xeea5('0xc')],function(_0x1dc021){return{'model':db[_0x1dc021['model']],'as':_0x1dc021['as'],'attributes':_0x1dc021[_0xeea5('0xa')],'include':_0x1dc021[_0xeea5('0xc')]?_[_0xeea5('0xd')](_0x1dc021[_0xeea5('0xc')],function(_0x479cee){return{'model':db[_0x479cee[_0xeea5('0xe')]],'as':_0x479cee['as'],'attributes':_0x479cee[_0xeea5('0xa')]};}):[]};}):[]};}):[]:[]})[_0xeea5('0xf')](function(_0x1244a8){var _0x3569bb=[];for(var _0x46a23b=0x0;_0x46a23b<_0x1244a8[_0xeea5('0x2c')];_0x46a23b+=0x1){_0x3569bb[_0xeea5('0x2f')](_0x1244a8[_0x46a23b][_0xeea5('0x1c')](_0x49d871[_0xeea5('0x1a')],{'transaction':_0x1887b4}));}return BPromise[_0xeea5('0x30')](_0x3569bb);});})[_0xeea5('0xf')](function(_0x412eb8){logger[_0xeea5('0x10')](_0xeea5('0x3d'),_0x49d871);logger['debug'](_0xeea5('0x3d'),_0x49d871,JSON[_0xeea5('0x12')](_0x412eb8));_0x464322(_0x412eb8);})['catch'](function(_0x46fd54){logger[_0xeea5('0x14')]('GetContactRecallMe',_0x46fd54[_0xeea5('0x15')],_0x49d871);_0x5ea2cb(_0x1d93b1['error'](0x1f4,_0x46fd54[_0xeea5('0x15')]));});});});};exports[_0xeea5('0x3e')]=function(_0x52fa99){var _0x166299=this;return new Promise(function(_0x4d9580,_0xbb991d){db[_0xeea5('0x22')][_0xeea5('0x23')]()[_0xeea5('0xf')](function(_0xae86e4){return db[_0xeea5('0x6')][_0xeea5('0x7')]({'raw':_0x52fa99[_0xeea5('0x8')]?_0x52fa99[_0xeea5('0x8')]['raw']===undefined?!![]:![]:!![],'where':_0x52fa99[_0xeea5('0x8')]?_0x52fa99[_0xeea5('0x8')][_0xeea5('0x17')]||null:null,'attributes':_0x52fa99['options']?_0x52fa99['options'][_0xeea5('0xa')]||null:null,'limit':_0x52fa99[_0xeea5('0x8')]?_0x52fa99[_0xeea5('0x8')][_0xeea5('0xb')]||null:null,'include':_0x52fa99[_0xeea5('0x8')]?_0x52fa99[_0xeea5('0x8')][_0xeea5('0xc')]?_[_0xeea5('0xd')](_0x52fa99['options'][_0xeea5('0xc')],function(_0x56f775){return{'model':db[_0x56f775[_0xeea5('0xe')]],'as':_0x56f775['as'],'attributes':_0x56f775['as']==='Contact'?_[_0xeea5('0x28')](_0xae86e4):_0x56f775['attributes'],'include':_0x56f775['include']?_[_0xeea5('0xd')](_0x56f775[_0xeea5('0xc')],function(_0x3de056){return{'model':db[_0x3de056[_0xeea5('0xe')]],'as':_0x3de056['as'],'attributes':_0x3de056[_0xeea5('0xa')],'include':_0x3de056['include']?_[_0xeea5('0xd')](_0x3de056['include'],function(_0x2154b7){return{'model':db[_0x2154b7[_0xeea5('0xe')]],'as':_0x2154b7['as'],'attributes':_0x2154b7[_0xeea5('0xa')]};}):[]};}):[]};}):[]:[]})[_0xeea5('0xf')](function(_0x2aa3f5){logger[_0xeea5('0x10')](_0xeea5('0x5'),_0x52fa99);logger[_0xeea5('0x11')](_0xeea5('0x5'),_0x52fa99,JSON['stringify'](_0x2aa3f5));_0x4d9580(_0x2aa3f5);})[_0xeea5('0x13')](function(_0x447c84){logger[_0xeea5('0x14')](_0xeea5('0x5'),_0x447c84['message'],_0x52fa99);_0xbb991d(_0x166299[_0xeea5('0x14')](0x1f4,_0x447c84['message']));});});});};exports[_0xeea5('0x3f')]=function(_0x3117d1){var _0x17f648=this;return new Promise(function(_0x232914,_0x15ccfb){return db['CmContact']['findOne']({'raw':!![],'where':{'phone':_0x3117d1[_0xeea5('0x8')][_0xeea5('0x17')]['phone']},'attributes':['id',_0xeea5('0x40')],'order':[['id',_0xeea5('0x41')]]})[_0xeea5('0xf')](function(_0x48ca02){logger[_0xeea5('0x10')]('getContactByPhone',_0x3117d1);logger[_0xeea5('0x11')](_0xeea5('0x42'),_0x3117d1,JSON['stringify'](_0x48ca02));_0x232914(_0x48ca02);})[_0xeea5('0x13')](function(_0x1a4707){logger[_0xeea5('0x14')](_0xeea5('0x42'),_0x1a4707['message'],_0x3117d1);_0x15ccfb(_0x17f648['error'](0x1f4,_0x1a4707[_0xeea5('0x15')]));});});};exports[_0xeea5('0x43')]=function(_0x218503){var _0x10007d=this;return new Promise(function(_0x274fef,_0x2aaaa2){return db[_0xeea5('0x24')][_0xeea5('0x35')](function(_0x47c5e6){var _0x7ca4f1=_0x218503[_0xeea5('0x8')]&&_0x218503['options'][_0xeea5('0x17')]?_0x218503['options'][_0xeea5('0x17')]:{};return db['CmHopper'][_0xeea5('0x1c')](_0x218503[_0xeea5('0x1a')],{'where':_0x7ca4f1,'transaction':_0x47c5e6})[_0xeea5('0xf')](function(_0x40f88b){logger['info'](_0xeea5('0x43'),_0x218503);logger['debug'](_0xeea5('0x43'),_0x218503,JSON[_0xeea5('0x12')](_0x40f88b));_0x274fef(_0x40f88b);})[_0xeea5('0x13')](function(_0x3f8acb){logger[_0xeea5('0x14')](_0xeea5('0x43'),_0x3f8acb[_0xeea5('0x15')],_0x218503);_0x2aaaa2(_0x10007d[_0xeea5('0x14')](0x1f4,_0x3f8acb[_0xeea5('0x15')]));});});});};exports[_0xeea5('0x44')]=function(_0x21f40c){var _0x1234ee=this;var _0x46748a=_0x21f40c[_0xeea5('0x1a')][_0xeea5('0x17')][_0xeea5('0x45')];var _0x203159=_0x21f40c[_0xeea5('0x1a')]['where'][_0xeea5('0x46')];var _0x37f7f4=_0x21f40c[_0xeea5('0x1a')][_0xeea5('0x17')]['availableAgentsIds'];return new Promise(function(_0x10c8a6,_0x416f93){return db['CmHopper'][_0xeea5('0x7')]({'where':{'voiceQueueId':{'$in':_0x46748a},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0xeea5('0x24')][_0xeea5('0x38')](_0xeea5('0x47')+_0x203159+_0xeea5('0x48')),'$gt':db[_0xeea5('0x24')]['literal'](_0xeea5('0x49'))}},'UserId':{'$in':_0x37f7f4}},'include':[{'model':db[_0xeea5('0x22')],'as':_0xeea5('0x4a')},{'model':db['User'],'as':_0xeea5('0x29'),'attributes':['id',_0xeea5('0x2a'),_0xeea5('0x2b')]},{'model':db[_0xeea5('0x4b')],'as':'List'}]})['then'](function(_0xd3f18e){if(_0xd3f18e[_0xeea5('0x2c')]>0x0){return db[_0xeea5('0x24')][_0xeea5('0x35')](function(_0x4be2ef){return db[_0xeea5('0x6')][_0xeea5('0x1c')]({'recallmeNotifiedDate':db[_0xeea5('0x24')]['literal']('NOW()')},{'where':{'id':{'$in':_['map'](_0xd3f18e,'id')}},'transaction':_0x4be2ef})[_0xeea5('0xf')](function(){_0x10c8a6(_0xd3f18e);})[_0xeea5('0x13')](function(_0x5649f7){logger['error'](_0xeea5('0x44'),_0x5649f7[_0xeea5('0x15')],_0x21f40c);_0x416f93(_0x1234ee['error'](0x1f4,_0x5649f7[_0xeea5('0x15')]));});})['catch'](function(_0x20ddea){logger[_0xeea5('0x14')](_0xeea5('0x44'),_0x20ddea[_0xeea5('0x15')],_0x21f40c);_0x416f93(_0x1234ee[_0xeea5('0x14')](0x1f4,_0x20ddea[_0xeea5('0x15')]));});}else{_0x10c8a6(_0xd3f18e);}});});};