f54aacaee0c3bc7763665d487ed2d81011d059da
[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 _0x05bf=['find','raw','info','catch','CreateCmHopper','CmHopper','create','body','stringify','UpdateCmHopper','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','DestroyCmHopper','destroy','GetContactDialer','CmContact','describe','sequelize','transaction','findAll','order','Contact','keys','Agent','name','voicePause','length','UserId','push','update','all','dataValues','MoveContactManagedDialer','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','LOCK','UPDATE','GetCmHopperPreview','findOne','phone','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueIds','interval','availableAgentsIds','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','NOW()','User','CmList','List','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','GetCmHopper','options','where','attributes','limit','include','map','model','then','debug','error','message','ShowCmHopper'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0x05bf,0xe5));var _0xf05b=function(_0x12ca50,_0x28ecef){_0x12ca50=_0x12ca50-0x0;var _0x19a89b=_0x05bf[_0x12ca50];return _0x19a89b;};'use strict';var _=require(_0xf05b('0x0'));var util=require(_0xf05b('0x1'));var moment=require(_0xf05b('0x2'));var BPromise=require(_0xf05b('0x3'));var db=require(_0xf05b('0x4'))['db'];var logger=require(_0xf05b('0x5'))(_0xf05b('0x6'));exports[_0xf05b('0x7')]=function(_0x2693f8){var _0x236984=this;return new Promise(function(_0x58ad59,_0x3456d6){return db['CmHopper']['findAll']({'raw':_0x2693f8[_0xf05b('0x8')]?_0x2693f8['options']['raw']===undefined?!![]:![]:!![],'where':_0x2693f8[_0xf05b('0x8')]?_0x2693f8[_0xf05b('0x8')][_0xf05b('0x9')]||null:null,'attributes':_0x2693f8[_0xf05b('0x8')]?_0x2693f8['options'][_0xf05b('0xa')]||null:null,'limit':_0x2693f8[_0xf05b('0x8')]?_0x2693f8['options'][_0xf05b('0xb')]||null:null,'include':_0x2693f8[_0xf05b('0x8')]?_0x2693f8[_0xf05b('0x8')][_0xf05b('0xc')]?_[_0xf05b('0xd')](_0x2693f8[_0xf05b('0x8')][_0xf05b('0xc')],function(_0xf28f2f){return{'model':db[_0xf28f2f[_0xf05b('0xe')]],'as':_0xf28f2f['as'],'attributes':_0xf28f2f[_0xf05b('0xa')],'include':_0xf28f2f[_0xf05b('0xc')]?_[_0xf05b('0xd')](_0xf28f2f[_0xf05b('0xc')],function(_0x969c5){return{'model':db[_0x969c5[_0xf05b('0xe')]],'as':_0x969c5['as'],'attributes':_0x969c5['attributes'],'include':_0x969c5[_0xf05b('0xc')]?_['map'](_0x969c5[_0xf05b('0xc')],function(_0x53ac4f){return{'model':db[_0x53ac4f[_0xf05b('0xe')]],'as':_0x53ac4f['as'],'attributes':_0x53ac4f[_0xf05b('0xa')]};}):[]};}):[]};}):[]:[]})[_0xf05b('0xf')](function(_0x30b6ee){logger['info'](_0xf05b('0x7'),_0x2693f8);logger[_0xf05b('0x10')](_0xf05b('0x7'),_0x2693f8,JSON['stringify'](_0x30b6ee));_0x58ad59(_0x30b6ee);})['catch'](function(_0x120b79){logger[_0xf05b('0x11')]('GetCmHopper',_0x120b79['message'],_0x2693f8);_0x3456d6(_0x236984[_0xf05b('0x11')](0x1f4,_0x120b79[_0xf05b('0x12')]));});});};exports[_0xf05b('0x13')]=function(_0x2348e2){var _0x3694f7=this;return new Promise(function(_0x4c3d61,_0x158da7){return db['CmHopper'][_0xf05b('0x14')]({'raw':_0x2348e2[_0xf05b('0x8')]?_0x2348e2['options'][_0xf05b('0x15')]===undefined?!![]:![]:!![],'where':_0x2348e2[_0xf05b('0x8')]?_0x2348e2[_0xf05b('0x8')][_0xf05b('0x9')]||null:null,'attributes':_0x2348e2['options']?_0x2348e2[_0xf05b('0x8')][_0xf05b('0xa')]||null:null,'include':_0x2348e2['options']?_0x2348e2[_0xf05b('0x8')][_0xf05b('0xc')]?_[_0xf05b('0xd')](_0x2348e2[_0xf05b('0x8')]['include'],function(_0x598f4a){return{'model':db[_0x598f4a['model']],'as':_0x598f4a['as'],'attributes':_0x598f4a[_0xf05b('0xa')],'include':_0x598f4a[_0xf05b('0xc')]?_[_0xf05b('0xd')](_0x598f4a[_0xf05b('0xc')],function(_0x1aa155){return{'model':db[_0x1aa155[_0xf05b('0xe')]],'as':_0x1aa155['as'],'attributes':_0x1aa155[_0xf05b('0xa')],'include':_0x1aa155[_0xf05b('0xc')]?_['map'](_0x1aa155[_0xf05b('0xc')],function(_0x192a25){return{'model':db[_0x192a25[_0xf05b('0xe')]],'as':_0x192a25['as'],'attributes':_0x192a25[_0xf05b('0xa')]};}):[]};}):[]};}):[]:[]})[_0xf05b('0xf')](function(_0x1d907d){logger[_0xf05b('0x16')](_0xf05b('0x13'),_0x2348e2);logger[_0xf05b('0x10')](_0xf05b('0x13'),_0x2348e2,JSON['stringify'](_0x1d907d));_0x4c3d61(_0x1d907d);})[_0xf05b('0x17')](function(_0x21d500){logger[_0xf05b('0x11')](_0xf05b('0x13'),_0x21d500[_0xf05b('0x12')],_0x2348e2);_0x158da7(_0x3694f7[_0xf05b('0x11')](0x1f4,_0x21d500[_0xf05b('0x12')]));});});};exports[_0xf05b('0x18')]=function(_0x441a92){var _0x5195a5=this;return new Promise(function(_0x3c9942,_0x2e27d2){return db[_0xf05b('0x19')][_0xf05b('0x1a')](_0x441a92[_0xf05b('0x1b')],{'raw':_0x441a92[_0xf05b('0x8')]?_0x441a92['options'][_0xf05b('0x15')]===undefined?!![]:![]:!![]})['then'](function(_0x12ea39){logger[_0xf05b('0x16')](_0xf05b('0x18'),_0x441a92);logger[_0xf05b('0x10')]('CreateCmHopper',_0x441a92,JSON[_0xf05b('0x1c')](_0x12ea39));_0x3c9942(_0x12ea39);})[_0xf05b('0x17')](function(_0x21225d){logger[_0xf05b('0x11')](_0xf05b('0x18'),_0x21225d['message'],_0x441a92);_0x2e27d2(_0x5195a5[_0xf05b('0x11')](0x1f4,_0x21225d['message']));});});};exports['UpdateCmHopper']=function(_0x2d72a2){var _0x1fecdf=this;return new Promise(function(_0xc3eb39,_0x44d183){return db['CmHopper']['update'](_0x2d72a2[_0xf05b('0x1b')],{'raw':_0x2d72a2['options']?_0x2d72a2[_0xf05b('0x8')][_0xf05b('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2d72a2[_0xf05b('0x8')]?_0x2d72a2[_0xf05b('0x8')]['where']||null:null,'attributes':_0x2d72a2[_0xf05b('0x8')]?_0x2d72a2[_0xf05b('0x8')][_0xf05b('0xa')]||null:null,'limit':_0x2d72a2['options']?_0x2d72a2[_0xf05b('0x8')][_0xf05b('0xb')]||null:null})[_0xf05b('0xf')](function(_0x44dd57){logger[_0xf05b('0x16')](_0xf05b('0x1d'),_0x2d72a2);logger[_0xf05b('0x16')](_0xf05b('0x1e'),JSON['stringify'](_0x2d72a2[_0xf05b('0x8')][_0xf05b('0x9')]),_0x2d72a2[_0xf05b('0x1b')][_0xf05b('0x1f')]);logger['debug'](_0xf05b('0x1d'),_0x2d72a2,JSON[_0xf05b('0x1c')](_0x44dd57));_0xc3eb39(_0x44dd57);})[_0xf05b('0x17')](function(_0x5bde58){logger[_0xf05b('0x11')]('UpdateCmHopper',_0x5bde58[_0xf05b('0x12')],_0x2d72a2);_0x44d183(_0x1fecdf['error'](0x1f4,_0x5bde58['message']));});});};exports[_0xf05b('0x20')]=function(_0x408d33){var _0x5e3ae4=this;return new Promise(function(_0x52ed2b,_0x20748f){return db[_0xf05b('0x19')][_0xf05b('0x21')]({'where':_0x408d33[_0xf05b('0x8')]?_0x408d33[_0xf05b('0x8')][_0xf05b('0x9')]||null:null})[_0xf05b('0xf')](function(_0x57766c){logger[_0xf05b('0x16')](_0xf05b('0x20'),_0x408d33);logger[_0xf05b('0x10')](_0xf05b('0x20'),_0x408d33,JSON['stringify'](_0x57766c));_0x52ed2b(_0x57766c);})[_0xf05b('0x17')](function(_0x1441cc){logger[_0xf05b('0x11')](_0xf05b('0x20'),_0x1441cc[_0xf05b('0x12')],_0x408d33);_0x20748f(_0x5e3ae4['error'](0x1f4,_0x1441cc[_0xf05b('0x12')]));});});};exports[_0xf05b('0x22')]=function(_0x1300aa){var _0x222edc=this;return new Promise(function(_0x1267ac,_0x388211){return db[_0xf05b('0x23')][_0xf05b('0x24')]()[_0xf05b('0xf')](function(_0x260e71){return db[_0xf05b('0x25')][_0xf05b('0x26')](function(_0x4d9ad3){return db[_0xf05b('0x19')][_0xf05b('0x27')]({'where':_0x1300aa[_0xf05b('0x8')]?_0x1300aa['options'][_0xf05b('0x9')]||null:null,'attributes':_0x1300aa['options']?_0x1300aa['options']['attributes']||null:null,'limit':_0x1300aa['options']?_0x1300aa[_0xf05b('0x8')][_0xf05b('0xb')]||null:null,'order':_0x1300aa[_0xf05b('0x8')]?_0x1300aa[_0xf05b('0x8')][_0xf05b('0x28')]||null:null,'transaction':_0x4d9ad3,'lock':_0x4d9ad3['LOCK']['UPDATE'],'include':[{'model':db[_0xf05b('0x23')],'as':_0xf05b('0x29'),'attributes':_[_0xf05b('0x2a')](_0x260e71)},{'model':db['User'],'as':_0xf05b('0x2b'),'attributes':['id',_0xf05b('0x2c'),_0xf05b('0x2d')]}]})[_0xf05b('0xf')](function(_0x14e119){var _0x33760f=[];var _0x476599=[];for(var _0xb96a14=0x0;_0xb96a14<_0x14e119[_0xf05b('0x2e')];_0xb96a14+=0x1){var _0x44050a=_0x14e119[_0xb96a14][_0xf05b('0x2f')];if(_0x44050a===null){_0x33760f[_0xf05b('0x30')](_0x14e119[_0xb96a14][_0xf05b('0x31')](_0x1300aa[_0xf05b('0x1b')],{'transaction':_0x4d9ad3}));}else if(!_0x476599['includes'](_0x44050a)){_0x476599[_0xf05b('0x30')](_0x44050a);_0x33760f[_0xf05b('0x30')](_0x14e119[_0xb96a14][_0xf05b('0x31')](_0x1300aa[_0xf05b('0x1b')],{'transaction':_0x4d9ad3}));}}return BPromise[_0xf05b('0x32')](_0x33760f);});})[_0xf05b('0xf')](function(_0xbff09b){logger[_0xf05b('0x16')](_0xf05b('0x22'),_0x1300aa);if(_0xbff09b[_0xf05b('0x2e')]>0x0){logger[_0xf05b('0x16')]('GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]',_0xbff09b[0x0][_0xf05b('0x33')]['id'],_0xbff09b[0x0][_0xf05b('0x33')]['ContactId'],_0xbff09b[0x0][_0xf05b('0x33')][_0xf05b('0x1f')]);}logger[_0xf05b('0x10')](_0xf05b('0x22'),_0x1300aa,JSON[_0xf05b('0x1c')](_0xbff09b));_0x1267ac(_0xbff09b);})['catch'](function(_0x537ef5){logger[_0xf05b('0x11')](_0xf05b('0x22'),_0x537ef5[_0xf05b('0x12')],_0x1300aa);_0x388211(_0x222edc[_0xf05b('0x11')](0x1f4,_0x537ef5['message']));});});});};exports[_0xf05b('0x34')]=function(_0x3bddc7){var _0x5ae820=this;return new Promise(function(_0x4a85d0,_0x1f343f){return db[_0xf05b('0x25')][_0xf05b('0x26')](function(_0x3193c0){return db['CmHopperFinal'][_0xf05b('0x1a')](_0x3bddc7['body'],{'raw':_0x3bddc7[_0xf05b('0x8')]?_0x3bddc7[_0xf05b('0x8')][_0xf05b('0x15')]===undefined?!![]:![]:!![],'transaction':_0x3193c0})[_0xf05b('0xf')](function(){logger[_0xf05b('0x16')](_0xf05b('0x35'),JSON[_0xf05b('0x1c')](_0x3bddc7[_0xf05b('0x8')]['where']),_0x3bddc7[_0xf05b('0x8')][_0xf05b('0x9')][_0xf05b('0x1f')]);return db[_0xf05b('0x19')]['destroy']({'where':_0x3bddc7[_0xf05b('0x8')]?_0x3bddc7[_0xf05b('0x8')][_0xf05b('0x9')]||null:null,'transaction':_0x3193c0});});})[_0xf05b('0xf')](function(_0x13a234){logger[_0xf05b('0x16')](_0xf05b('0x34'),_0x3bddc7);logger[_0xf05b('0x10')](_0xf05b('0x34'),_0x3bddc7,JSON[_0xf05b('0x1c')](_0x13a234));_0x4a85d0(_0x13a234);})['catch'](function(_0x44aedd){logger[_0xf05b('0x11')](_0xf05b('0x34'),_0x44aedd['message'],_0x3bddc7);_0x1f343f(_0x5ae820[_0xf05b('0x11')](0x1f4,_0x44aedd[_0xf05b('0x12')]));});});};exports[_0xf05b('0x36')]=function(_0x4cdf23){var _0x2523c8=this;return new Promise(function(_0x388595,_0x13161c){return db[_0xf05b('0x19')][_0xf05b('0x27')]({'raw':_0x4cdf23[_0xf05b('0x8')]?_0x4cdf23['options']['raw']===undefined?!![]:![]:!![],'where':_0x4cdf23[_0xf05b('0x8')]?_0x4cdf23['options']['where']||null:null,'attributes':[[db['sequelize']['fn'](_0xf05b('0x37'),db[_0xf05b('0x25')]['fn']('IF',db[_0xf05b('0x25')][_0xf05b('0x38')](_0xf05b('0x39')+util[_0xf05b('0x3a')](_0xf05b('0x3b'),moment()[_0xf05b('0x3a')](_0xf05b('0x3c')))+_0xf05b('0x3d')))),_0xf05b('0x3e')]]})[_0xf05b('0xf')](function(_0x3956b4){logger[_0xf05b('0x16')](_0xf05b('0x36'),_0x4cdf23);logger[_0xf05b('0x10')](_0xf05b('0x36'),_0x4cdf23,JSON['stringify'](_0x3956b4));_0x388595(_0x3956b4);})[_0xf05b('0x17')](function(_0x5ee529){logger['error'](_0xf05b('0x36'),_0x5ee529[_0xf05b('0x12')],_0x4cdf23);_0x13161c(_0x2523c8['error'](0x1f4,_0x5ee529['message']));});});};exports[_0xf05b('0x3f')]=function(_0x4cab9f){var _0x227029=this;return new Promise(function(_0x1c4859,_0x16e459){return db[_0xf05b('0x23')][_0xf05b('0x24')]()['then'](function(){return db[_0xf05b('0x25')][_0xf05b('0x26')](function(_0x5e6669){return db['CmHopper'][_0xf05b('0x27')]({'where':_0x4cab9f['options']?_0x4cab9f['options']['where']||null:null,'attributes':_0x4cab9f[_0xf05b('0x8')]?_0x4cab9f[_0xf05b('0x8')]['attributes']||null:null,'limit':0x1,'order':_0x4cab9f[_0xf05b('0x8')]?_0x4cab9f['options'][_0xf05b('0x28')]||null:null,'group':db[_0xf05b('0x19')][_0xf05b('0x2f')],'transaction':_0x5e6669,'lock':_0x5e6669[_0xf05b('0x40')][_0xf05b('0x41')],'include':_0x4cab9f[_0xf05b('0x8')]?_0x4cab9f['options']['include']?_[_0xf05b('0xd')](_0x4cab9f[_0xf05b('0x8')][_0xf05b('0xc')],function(_0x2ce175){return{'model':db[_0x2ce175['model']],'as':_0x2ce175['as'],'attributes':_0x2ce175['attributes'],'include':_0x2ce175[_0xf05b('0xc')]?_[_0xf05b('0xd')](_0x2ce175['include'],function(_0x30e85b){return{'model':db[_0x30e85b[_0xf05b('0xe')]],'as':_0x30e85b['as'],'attributes':_0x30e85b[_0xf05b('0xa')],'include':_0x30e85b[_0xf05b('0xc')]?_[_0xf05b('0xd')](_0x30e85b[_0xf05b('0xc')],function(_0x2c40c7){return{'model':db[_0x2c40c7[_0xf05b('0xe')]],'as':_0x2c40c7['as'],'attributes':_0x2c40c7['attributes']};}):[]};}):[]};}):[]:[]})[_0xf05b('0xf')](function(_0x136c20){var _0x53e477=[];for(var _0x2f4ca2=0x0;_0x2f4ca2<_0x136c20[_0xf05b('0x2e')];_0x2f4ca2+=0x1){_0x53e477[_0xf05b('0x30')](_0x136c20[_0x2f4ca2][_0xf05b('0x31')](_0x4cab9f[_0xf05b('0x1b')],{'transaction':_0x5e6669}));}return BPromise['all'](_0x53e477);});})[_0xf05b('0xf')](function(_0x3e7da7){logger[_0xf05b('0x16')](_0xf05b('0x3f'),_0x4cab9f);logger[_0xf05b('0x10')](_0xf05b('0x3f'),_0x4cab9f,JSON[_0xf05b('0x1c')](_0x3e7da7));_0x1c4859(_0x3e7da7);})[_0xf05b('0x17')](function(_0x4e44ed){logger['error'](_0xf05b('0x3f'),_0x4e44ed[_0xf05b('0x12')],_0x4cab9f);_0x16e459(_0x227029[_0xf05b('0x11')](0x1f4,_0x4e44ed[_0xf05b('0x12')]));});});});};exports[_0xf05b('0x42')]=function(_0x39d522){var _0x46d0a2=this;return new Promise(function(_0x4cabe4,_0x5011fa){db[_0xf05b('0x23')]['describe']()[_0xf05b('0xf')](function(_0x48288f){return db[_0xf05b('0x19')][_0xf05b('0x27')]({'raw':_0x39d522[_0xf05b('0x8')]?_0x39d522[_0xf05b('0x8')][_0xf05b('0x15')]===undefined?!![]:![]:!![],'where':_0x39d522['options']?_0x39d522['options']['where']||null:null,'attributes':_0x39d522[_0xf05b('0x8')]?_0x39d522[_0xf05b('0x8')][_0xf05b('0xa')]||null:null,'limit':_0x39d522[_0xf05b('0x8')]?_0x39d522[_0xf05b('0x8')][_0xf05b('0xb')]||null:null,'include':_0x39d522[_0xf05b('0x8')]?_0x39d522['options'][_0xf05b('0xc')]?_['map'](_0x39d522[_0xf05b('0x8')]['include'],function(_0x3e1b89){return{'model':db[_0x3e1b89[_0xf05b('0xe')]],'as':_0x3e1b89['as'],'attributes':_0x3e1b89['as']===_0xf05b('0x29')?_[_0xf05b('0x2a')](_0x48288f):_0x3e1b89[_0xf05b('0xa')],'include':_0x3e1b89[_0xf05b('0xc')]?_[_0xf05b('0xd')](_0x3e1b89[_0xf05b('0xc')],function(_0x2d2d77){return{'model':db[_0x2d2d77[_0xf05b('0xe')]],'as':_0x2d2d77['as'],'attributes':_0x2d2d77[_0xf05b('0xa')],'include':_0x2d2d77['include']?_['map'](_0x2d2d77[_0xf05b('0xc')],function(_0x1e6fdb){return{'model':db[_0x1e6fdb['model']],'as':_0x1e6fdb['as'],'attributes':_0x1e6fdb[_0xf05b('0xa')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x36ab78){logger[_0xf05b('0x16')]('GetCmHopper',_0x39d522);logger[_0xf05b('0x10')](_0xf05b('0x7'),_0x39d522,JSON['stringify'](_0x36ab78));_0x4cabe4(_0x36ab78);})[_0xf05b('0x17')](function(_0x31ea4b){logger[_0xf05b('0x11')](_0xf05b('0x7'),_0x31ea4b[_0xf05b('0x12')],_0x39d522);_0x5011fa(_0x46d0a2[_0xf05b('0x11')](0x1f4,_0x31ea4b['message']));});});});};exports['GetContactByPhone']=function(_0x1db52c){var _0x5e6069=this;return new Promise(function(_0x5ce65a,_0x3162b0){return db[_0xf05b('0x23')][_0xf05b('0x43')]({'raw':!![],'where':{'phone':_0x1db52c[_0xf05b('0x8')][_0xf05b('0x9')][_0xf05b('0x44')]},'attributes':['id',_0xf05b('0x45')],'order':[['id',_0xf05b('0x46')]]})[_0xf05b('0xf')](function(_0x40d2e6){logger[_0xf05b('0x16')](_0xf05b('0x47'),_0x1db52c);logger[_0xf05b('0x10')]('getContactByPhone',_0x1db52c,JSON[_0xf05b('0x1c')](_0x40d2e6));_0x5ce65a(_0x40d2e6);})[_0xf05b('0x17')](function(_0x9e14d8){logger[_0xf05b('0x11')](_0xf05b('0x47'),_0x9e14d8[_0xf05b('0x12')],_0x1db52c);_0x3162b0(_0x5e6069[_0xf05b('0x11')](0x1f4,_0x9e14d8[_0xf05b('0x12')]));});});};exports['ResetActiveCalls']=function(_0x13a756){var _0x12ef9f=this;return new Promise(function(_0x4faa5f,_0x437265){return db['sequelize']['transaction'](function(_0x79e74e){var _0x58b044=_0x13a756['options']&&_0x13a756['options']['where']?_0x13a756[_0xf05b('0x8')]['where']:{};return db[_0xf05b('0x19')][_0xf05b('0x31')](_0x13a756['body'],{'where':_0x58b044,'transaction':_0x79e74e})['then'](function(_0x411c10){logger[_0xf05b('0x16')](_0xf05b('0x48'),_0x13a756);logger['debug'](_0xf05b('0x48'),_0x13a756,JSON[_0xf05b('0x1c')](_0x411c10));_0x4faa5f(_0x411c10);})['catch'](function(_0x55a720){logger['error'](_0xf05b('0x48'),_0x55a720[_0xf05b('0x12')],_0x13a756);_0x437265(_0x12ef9f['error'](0x1f4,_0x55a720[_0xf05b('0x12')]));});});});};exports[_0xf05b('0x49')]=function(_0x163e38){var _0x135f47=this;var _0xbf7c99=_0x163e38['body'][_0xf05b('0x9')][_0xf05b('0x4a')];var _0x234fe2=_0x163e38['body'][_0xf05b('0x9')][_0xf05b('0x4b')];var _0x5edd43=_0x163e38['body'][_0xf05b('0x9')][_0xf05b('0x4c')];return new Promise(function(_0x34c930,_0x563376){return db['CmHopper'][_0xf05b('0x27')]({'where':{'voiceQueueId':{'$in':_0xbf7c99},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0xf05b('0x25')][_0xf05b('0x38')](_0xf05b('0x4d')+_0x234fe2+_0xf05b('0x4e')),'$gt':db[_0xf05b('0x25')][_0xf05b('0x38')](_0xf05b('0x4f'))}},'UserId':{'$in':_0x5edd43}},'include':[{'model':db[_0xf05b('0x23')],'as':_0xf05b('0x29')},{'model':db[_0xf05b('0x50')],'as':'Agent','attributes':['id',_0xf05b('0x2c'),_0xf05b('0x2d')]},{'model':db[_0xf05b('0x51')],'as':_0xf05b('0x52')}]})[_0xf05b('0xf')](function(_0x3df0aa){if(_0x3df0aa[_0xf05b('0x2e')]>0x0){return db[_0xf05b('0x25')][_0xf05b('0x26')](function(_0x4d56bf){return db['CmHopper'][_0xf05b('0x31')]({'recallmeNotifiedDate':db[_0xf05b('0x25')][_0xf05b('0x38')](_0xf05b('0x4f'))},{'where':{'id':{'$in':_[_0xf05b('0xd')](_0x3df0aa,'id')}},'transaction':_0x4d56bf})[_0xf05b('0xf')](function(){_0x34c930(_0x3df0aa);})[_0xf05b('0x17')](function(_0x9e4443){logger['error']('CmHopperHandlePreviewRecallNotifications',_0x9e4443[_0xf05b('0x12')],_0x163e38);_0x563376(_0x135f47[_0xf05b('0x11')](0x1f4,_0x9e4443[_0xf05b('0x12')]));});})[_0xf05b('0x17')](function(_0x3451d8){logger[_0xf05b('0x11')](_0xf05b('0x49'),_0x3451d8[_0xf05b('0x12')],_0x163e38);_0x563376(_0x135f47['error'](0x1f4,_0x3451d8['message']));});}else{_0x34c930(_0x3df0aa);}});});};