Built motion from commit f541bb3b.|2.6.14
[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 _0x9dde=['then','info','GetCmHopper','debug','stringify','error','message','ShowCmHopper','catch','CreateCmHopper','create','body','UpdateCmHopper','update','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','DestroyCmHopper','destroy','CmContact','describe','transaction','order','UPDATE','Contact','keys','User','name','voicePause','push','all','length','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','GetContactDialer','MoveContactManagedDialer','sequelize','CmHopperFinal','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','LOCK','GetCmHopperPreview','GetContactByPhone','findOne','phone','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueIds','interval','availableAgentsIds','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','NOW()','Agent','CmList','List','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','CmHopper','findAll','options','raw','where','limit','include','map','model','attributes'];(function(_0x2ac0df,_0x4f0ffe){var _0x662592=function(_0x1228a9){while(--_0x1228a9){_0x2ac0df['push'](_0x2ac0df['shift']());}};_0x662592(++_0x4f0ffe);}(_0x9dde,0x1e2));var _0xe9dd=function(_0x145cd6,_0x55b5a5){_0x145cd6=_0x145cd6-0x0;var _0x535c8f=_0x9dde[_0x145cd6];return _0x535c8f;};'use strict';var _=require('lodash');var util=require(_0xe9dd('0x0'));var moment=require(_0xe9dd('0x1'));var BPromise=require(_0xe9dd('0x2'));var db=require(_0xe9dd('0x3'))['db'];var logger=require(_0xe9dd('0x4'))(_0xe9dd('0x5'));exports['GetCmHopper']=function(_0x28acc0){var _0x54078b=this;return new Promise(function(_0x349e0e,_0x38e1b9){return db[_0xe9dd('0x6')][_0xe9dd('0x7')]({'raw':_0x28acc0[_0xe9dd('0x8')]?_0x28acc0[_0xe9dd('0x8')][_0xe9dd('0x9')]===undefined?!![]:![]:!![],'where':_0x28acc0[_0xe9dd('0x8')]?_0x28acc0['options'][_0xe9dd('0xa')]||null:null,'attributes':_0x28acc0['options']?_0x28acc0[_0xe9dd('0x8')]['attributes']||null:null,'limit':_0x28acc0['options']?_0x28acc0[_0xe9dd('0x8')][_0xe9dd('0xb')]||null:null,'include':_0x28acc0[_0xe9dd('0x8')]?_0x28acc0[_0xe9dd('0x8')][_0xe9dd('0xc')]?_[_0xe9dd('0xd')](_0x28acc0['options']['include'],function(_0x227832){return{'model':db[_0x227832[_0xe9dd('0xe')]],'as':_0x227832['as'],'attributes':_0x227832[_0xe9dd('0xf')],'include':_0x227832['include']?_['map'](_0x227832[_0xe9dd('0xc')],function(_0x57baea){return{'model':db[_0x57baea[_0xe9dd('0xe')]],'as':_0x57baea['as'],'attributes':_0x57baea[_0xe9dd('0xf')],'include':_0x57baea[_0xe9dd('0xc')]?_[_0xe9dd('0xd')](_0x57baea[_0xe9dd('0xc')],function(_0x1e5eaa){return{'model':db[_0x1e5eaa[_0xe9dd('0xe')]],'as':_0x1e5eaa['as'],'attributes':_0x1e5eaa[_0xe9dd('0xf')]};}):[]};}):[]};}):[]:[]})[_0xe9dd('0x10')](function(_0x1e5256){logger[_0xe9dd('0x11')](_0xe9dd('0x12'),_0x28acc0);logger[_0xe9dd('0x13')](_0xe9dd('0x12'),_0x28acc0,JSON[_0xe9dd('0x14')](_0x1e5256));_0x349e0e(_0x1e5256);})['catch'](function(_0x1b5e85){logger[_0xe9dd('0x15')](_0xe9dd('0x12'),_0x1b5e85[_0xe9dd('0x16')],_0x28acc0);_0x38e1b9(_0x54078b[_0xe9dd('0x15')](0x1f4,_0x1b5e85[_0xe9dd('0x16')]));});});};exports[_0xe9dd('0x17')]=function(_0x4ef7e4){var _0x45feaf=this;return new Promise(function(_0x50700a,_0x26a787){return db['CmHopper']['find']({'raw':_0x4ef7e4[_0xe9dd('0x8')]?_0x4ef7e4['options'][_0xe9dd('0x9')]===undefined?!![]:![]:!![],'where':_0x4ef7e4[_0xe9dd('0x8')]?_0x4ef7e4[_0xe9dd('0x8')][_0xe9dd('0xa')]||null:null,'attributes':_0x4ef7e4[_0xe9dd('0x8')]?_0x4ef7e4['options']['attributes']||null:null,'include':_0x4ef7e4['options']?_0x4ef7e4[_0xe9dd('0x8')][_0xe9dd('0xc')]?_[_0xe9dd('0xd')](_0x4ef7e4[_0xe9dd('0x8')]['include'],function(_0x349e1c){return{'model':db[_0x349e1c['model']],'as':_0x349e1c['as'],'attributes':_0x349e1c[_0xe9dd('0xf')],'include':_0x349e1c[_0xe9dd('0xc')]?_[_0xe9dd('0xd')](_0x349e1c[_0xe9dd('0xc')],function(_0x10c99d){return{'model':db[_0x10c99d[_0xe9dd('0xe')]],'as':_0x10c99d['as'],'attributes':_0x10c99d[_0xe9dd('0xf')],'include':_0x10c99d['include']?_[_0xe9dd('0xd')](_0x10c99d[_0xe9dd('0xc')],function(_0x52969a){return{'model':db[_0x52969a[_0xe9dd('0xe')]],'as':_0x52969a['as'],'attributes':_0x52969a['attributes']};}):[]};}):[]};}):[]:[]})[_0xe9dd('0x10')](function(_0x1ec997){logger[_0xe9dd('0x11')](_0xe9dd('0x17'),_0x4ef7e4);logger[_0xe9dd('0x13')](_0xe9dd('0x17'),_0x4ef7e4,JSON[_0xe9dd('0x14')](_0x1ec997));_0x50700a(_0x1ec997);})[_0xe9dd('0x18')](function(_0xa8c3fe){logger[_0xe9dd('0x15')](_0xe9dd('0x17'),_0xa8c3fe[_0xe9dd('0x16')],_0x4ef7e4);_0x26a787(_0x45feaf[_0xe9dd('0x15')](0x1f4,_0xa8c3fe[_0xe9dd('0x16')]));});});};exports[_0xe9dd('0x19')]=function(_0xe5fa56){var _0x381878=this;return new Promise(function(_0x393d96,_0x230085){return db[_0xe9dd('0x6')][_0xe9dd('0x1a')](_0xe5fa56[_0xe9dd('0x1b')],{'raw':_0xe5fa56['options']?_0xe5fa56[_0xe9dd('0x8')][_0xe9dd('0x9')]===undefined?!![]:![]:!![]})['then'](function(_0x3bcd14){logger[_0xe9dd('0x11')](_0xe9dd('0x19'),_0xe5fa56);logger[_0xe9dd('0x13')]('CreateCmHopper',_0xe5fa56,JSON[_0xe9dd('0x14')](_0x3bcd14));_0x393d96(_0x3bcd14);})[_0xe9dd('0x18')](function(_0x18d71a){logger[_0xe9dd('0x15')](_0xe9dd('0x19'),_0x18d71a[_0xe9dd('0x16')],_0xe5fa56);_0x230085(_0x381878['error'](0x1f4,_0x18d71a[_0xe9dd('0x16')]));});});};exports[_0xe9dd('0x1c')]=function(_0x4ed3ee){var _0x4cd61c=this;return new Promise(function(_0x576f0e,_0x462d6e){return db[_0xe9dd('0x6')][_0xe9dd('0x1d')](_0x4ed3ee['body'],{'raw':_0x4ed3ee[_0xe9dd('0x8')]?_0x4ed3ee['options'][_0xe9dd('0x9')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4ed3ee[_0xe9dd('0x8')]?_0x4ed3ee[_0xe9dd('0x8')]['where']||null:null,'attributes':_0x4ed3ee[_0xe9dd('0x8')]?_0x4ed3ee[_0xe9dd('0x8')][_0xe9dd('0xf')]||null:null,'limit':_0x4ed3ee[_0xe9dd('0x8')]?_0x4ed3ee[_0xe9dd('0x8')]['limit']||null:null})[_0xe9dd('0x10')](function(_0x2c9987){logger[_0xe9dd('0x11')](_0xe9dd('0x1c'),_0x4ed3ee);logger[_0xe9dd('0x11')](_0xe9dd('0x1e'),JSON[_0xe9dd('0x14')](_0x4ed3ee[_0xe9dd('0x8')][_0xe9dd('0xa')]),_0x4ed3ee[_0xe9dd('0x1b')][_0xe9dd('0x1f')]);logger[_0xe9dd('0x13')](_0xe9dd('0x1c'),_0x4ed3ee,JSON[_0xe9dd('0x14')](_0x2c9987));_0x576f0e(_0x2c9987);})[_0xe9dd('0x18')](function(_0x4435d1){logger[_0xe9dd('0x15')](_0xe9dd('0x1c'),_0x4435d1[_0xe9dd('0x16')],_0x4ed3ee);_0x462d6e(_0x4cd61c[_0xe9dd('0x15')](0x1f4,_0x4435d1['message']));});});};exports[_0xe9dd('0x20')]=function(_0x3cceca){var _0x5dc27b=this;return new Promise(function(_0x31cc0f,_0x33b449){return db[_0xe9dd('0x6')][_0xe9dd('0x21')]({'where':_0x3cceca['options']?_0x3cceca[_0xe9dd('0x8')][_0xe9dd('0xa')]||null:null})['then'](function(_0xd85494){logger[_0xe9dd('0x11')](_0xe9dd('0x20'),_0x3cceca);logger[_0xe9dd('0x13')]('DestroyCmHopper',_0x3cceca,JSON[_0xe9dd('0x14')](_0xd85494));_0x31cc0f(_0xd85494);})['catch'](function(_0x12c7df){logger[_0xe9dd('0x15')](_0xe9dd('0x20'),_0x12c7df['message'],_0x3cceca);_0x33b449(_0x5dc27b[_0xe9dd('0x15')](0x1f4,_0x12c7df[_0xe9dd('0x16')]));});});};exports['GetContactDialer']=function(_0x31ba68){var _0x434f4b=this;return new Promise(function(_0xb22b73,_0x48bd27){return db[_0xe9dd('0x22')][_0xe9dd('0x23')]()[_0xe9dd('0x10')](function(_0x5d5554){return db['sequelize'][_0xe9dd('0x24')](function(_0x1c1246){return db[_0xe9dd('0x6')][_0xe9dd('0x7')]({'where':_0x31ba68[_0xe9dd('0x8')]?_0x31ba68[_0xe9dd('0x8')][_0xe9dd('0xa')]||null:null,'attributes':_0x31ba68['options']?_0x31ba68[_0xe9dd('0x8')]['attributes']||null:null,'limit':_0x31ba68['options']?_0x31ba68[_0xe9dd('0x8')][_0xe9dd('0xb')]||null:null,'order':_0x31ba68[_0xe9dd('0x8')]?_0x31ba68['options'][_0xe9dd('0x25')]||null:null,'transaction':_0x1c1246,'lock':_0x1c1246['LOCK'][_0xe9dd('0x26')],'include':[{'model':db[_0xe9dd('0x22')],'as':_0xe9dd('0x27'),'attributes':_[_0xe9dd('0x28')](_0x5d5554)},{'model':db[_0xe9dd('0x29')],'as':'Agent','attributes':['id',_0xe9dd('0x2a'),_0xe9dd('0x2b')]}]})['then'](function(_0x33dc2f){var _0x2d1e3a=[];var _0x178162=[];for(var _0xfb11b4=0x0;_0xfb11b4<_0x33dc2f['length'];_0xfb11b4+=0x1){var _0x163613=_0x33dc2f[_0xfb11b4]['UserId'];if(_0x163613===null){_0x2d1e3a[_0xe9dd('0x2c')](_0x33dc2f[_0xfb11b4][_0xe9dd('0x1d')](_0x31ba68[_0xe9dd('0x1b')],{'transaction':_0x1c1246}));}else if(!_0x178162['includes'](_0x163613)){_0x178162[_0xe9dd('0x2c')](_0x163613);_0x2d1e3a['push'](_0x33dc2f[_0xfb11b4][_0xe9dd('0x1d')](_0x31ba68['body'],{'transaction':_0x1c1246}));}}return BPromise[_0xe9dd('0x2d')](_0x2d1e3a);});})[_0xe9dd('0x10')](function(_0x305844){logger[_0xe9dd('0x11')]('GetContactDialer',_0x31ba68);if(_0x305844[_0xe9dd('0x2e')]>0x0){logger[_0xe9dd('0x11')](_0xe9dd('0x2f'),_0x305844[0x0]['dataValues']['id'],_0x305844[0x0][_0xe9dd('0x30')][_0xe9dd('0x31')],_0x305844[0x0][_0xe9dd('0x30')][_0xe9dd('0x1f')]);}logger['debug'](_0xe9dd('0x32'),_0x31ba68,JSON[_0xe9dd('0x14')](_0x305844));_0xb22b73(_0x305844);})[_0xe9dd('0x18')](function(_0x29c7a2){logger[_0xe9dd('0x15')](_0xe9dd('0x32'),_0x29c7a2[_0xe9dd('0x16')],_0x31ba68);_0x48bd27(_0x434f4b['error'](0x1f4,_0x29c7a2['message']));});});});};exports[_0xe9dd('0x33')]=function(_0x52de31){var _0x18d135=this;return new Promise(function(_0x155d6c,_0x3b97d7){return db[_0xe9dd('0x34')][_0xe9dd('0x24')](function(_0x14c740){return db[_0xe9dd('0x35')][_0xe9dd('0x1a')](_0x52de31[_0xe9dd('0x1b')],{'raw':_0x52de31[_0xe9dd('0x8')]?_0x52de31[_0xe9dd('0x8')][_0xe9dd('0x9')]===undefined?!![]:![]:!![],'transaction':_0x14c740})['then'](function(){logger[_0xe9dd('0x11')]('MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON['stringify'](_0x52de31[_0xe9dd('0x8')][_0xe9dd('0xa')]),_0x52de31[_0xe9dd('0x8')]['where'][_0xe9dd('0x1f')]);return db['CmHopper'][_0xe9dd('0x21')]({'where':_0x52de31['options']?_0x52de31['options'][_0xe9dd('0xa')]||null:null,'transaction':_0x14c740});});})['then'](function(_0x55e1f7){logger['info'](_0xe9dd('0x33'),_0x52de31);logger['debug']('MoveContactManagedDialer',_0x52de31,JSON['stringify'](_0x55e1f7));_0x155d6c(_0x55e1f7);})[_0xe9dd('0x18')](function(_0x38c0ed){logger[_0xe9dd('0x15')]('MoveContactManagedDialer',_0x38c0ed[_0xe9dd('0x16')],_0x52de31);_0x3b97d7(_0x18d135['error'](0x1f4,_0x38c0ed[_0xe9dd('0x16')]));});});};exports[_0xe9dd('0x36')]=function(_0x402024){var _0x213918=this;return new Promise(function(_0x3f5a35,_0x2495e6){return db['CmHopper'][_0xe9dd('0x7')]({'raw':_0x402024[_0xe9dd('0x8')]?_0x402024[_0xe9dd('0x8')][_0xe9dd('0x9')]===undefined?!![]:![]:!![],'where':_0x402024[_0xe9dd('0x8')]?_0x402024['options']['where']||null:null,'attributes':[[db[_0xe9dd('0x34')]['fn'](_0xe9dd('0x37'),db[_0xe9dd('0x34')]['fn']('IF',db[_0xe9dd('0x34')][_0xe9dd('0x38')](_0xe9dd('0x39')+util[_0xe9dd('0x3a')](_0xe9dd('0x3b'),moment()[_0xe9dd('0x3a')](_0xe9dd('0x3c')))+_0xe9dd('0x3d')))),_0xe9dd('0x3e')]]})[_0xe9dd('0x10')](function(_0x346f79){logger[_0xe9dd('0x11')](_0xe9dd('0x36'),_0x402024);logger['debug'](_0xe9dd('0x36'),_0x402024,JSON['stringify'](_0x346f79));_0x3f5a35(_0x346f79);})[_0xe9dd('0x18')](function(_0x10ebdd){logger['error'](_0xe9dd('0x36'),_0x10ebdd[_0xe9dd('0x16')],_0x402024);_0x2495e6(_0x213918['error'](0x1f4,_0x10ebdd[_0xe9dd('0x16')]));});});};exports[_0xe9dd('0x3f')]=function(_0x551928){var _0x3431e4=this;return new Promise(function(_0x496eb5,_0x636ca9){return db['CmContact'][_0xe9dd('0x23')]()[_0xe9dd('0x10')](function(){return db['sequelize'][_0xe9dd('0x24')](function(_0xf45158){return db[_0xe9dd('0x6')][_0xe9dd('0x7')]({'where':_0x551928['options']?_0x551928[_0xe9dd('0x8')][_0xe9dd('0xa')]||null:null,'attributes':_0x551928[_0xe9dd('0x8')]?_0x551928[_0xe9dd('0x8')][_0xe9dd('0xf')]||null:null,'limit':0x1,'order':_0x551928[_0xe9dd('0x8')]?_0x551928[_0xe9dd('0x8')]['order']||null:null,'group':db['CmHopper']['UserId'],'transaction':_0xf45158,'lock':_0xf45158[_0xe9dd('0x40')]['UPDATE'],'include':_0x551928['options']?_0x551928[_0xe9dd('0x8')][_0xe9dd('0xc')]?_[_0xe9dd('0xd')](_0x551928[_0xe9dd('0x8')][_0xe9dd('0xc')],function(_0x228dc5){return{'model':db[_0x228dc5['model']],'as':_0x228dc5['as'],'attributes':_0x228dc5['attributes'],'include':_0x228dc5[_0xe9dd('0xc')]?_[_0xe9dd('0xd')](_0x228dc5[_0xe9dd('0xc')],function(_0x31bf88){return{'model':db[_0x31bf88[_0xe9dd('0xe')]],'as':_0x31bf88['as'],'attributes':_0x31bf88[_0xe9dd('0xf')],'include':_0x31bf88[_0xe9dd('0xc')]?_['map'](_0x31bf88[_0xe9dd('0xc')],function(_0x38c3b7){return{'model':db[_0x38c3b7['model']],'as':_0x38c3b7['as'],'attributes':_0x38c3b7[_0xe9dd('0xf')]};}):[]};}):[]};}):[]:[]})[_0xe9dd('0x10')](function(_0x4e1fb8){var _0x502cb1=[];for(var _0x138fb2=0x0;_0x138fb2<_0x4e1fb8[_0xe9dd('0x2e')];_0x138fb2+=0x1){_0x502cb1[_0xe9dd('0x2c')](_0x4e1fb8[_0x138fb2][_0xe9dd('0x1d')](_0x551928[_0xe9dd('0x1b')],{'transaction':_0xf45158}));}return BPromise['all'](_0x502cb1);});})[_0xe9dd('0x10')](function(_0xfbe24c){logger[_0xe9dd('0x11')]('GetContactRecallMe',_0x551928);logger['debug'](_0xe9dd('0x3f'),_0x551928,JSON[_0xe9dd('0x14')](_0xfbe24c));_0x496eb5(_0xfbe24c);})[_0xe9dd('0x18')](function(_0x48c4a6){logger[_0xe9dd('0x15')](_0xe9dd('0x3f'),_0x48c4a6[_0xe9dd('0x16')],_0x551928);_0x636ca9(_0x3431e4[_0xe9dd('0x15')](0x1f4,_0x48c4a6['message']));});});});};exports[_0xe9dd('0x41')]=function(_0x1095f4){var _0x3eec5c=this;return new Promise(function(_0x3092c1,_0x175046){db[_0xe9dd('0x22')][_0xe9dd('0x23')]()[_0xe9dd('0x10')](function(_0x2d576a){return db[_0xe9dd('0x6')][_0xe9dd('0x7')]({'raw':_0x1095f4[_0xe9dd('0x8')]?_0x1095f4[_0xe9dd('0x8')][_0xe9dd('0x9')]===undefined?!![]:![]:!![],'where':_0x1095f4[_0xe9dd('0x8')]?_0x1095f4[_0xe9dd('0x8')][_0xe9dd('0xa')]||null:null,'attributes':_0x1095f4[_0xe9dd('0x8')]?_0x1095f4['options'][_0xe9dd('0xf')]||null:null,'limit':_0x1095f4[_0xe9dd('0x8')]?_0x1095f4[_0xe9dd('0x8')][_0xe9dd('0xb')]||null:null,'include':_0x1095f4[_0xe9dd('0x8')]?_0x1095f4[_0xe9dd('0x8')][_0xe9dd('0xc')]?_['map'](_0x1095f4[_0xe9dd('0x8')][_0xe9dd('0xc')],function(_0x3689d1){return{'model':db[_0x3689d1[_0xe9dd('0xe')]],'as':_0x3689d1['as'],'attributes':_0x3689d1['as']===_0xe9dd('0x27')?_[_0xe9dd('0x28')](_0x2d576a):_0x3689d1[_0xe9dd('0xf')],'include':_0x3689d1[_0xe9dd('0xc')]?_[_0xe9dd('0xd')](_0x3689d1['include'],function(_0x3260dc){return{'model':db[_0x3260dc[_0xe9dd('0xe')]],'as':_0x3260dc['as'],'attributes':_0x3260dc[_0xe9dd('0xf')],'include':_0x3260dc[_0xe9dd('0xc')]?_['map'](_0x3260dc[_0xe9dd('0xc')],function(_0x34e23a){return{'model':db[_0x34e23a['model']],'as':_0x34e23a['as'],'attributes':_0x34e23a[_0xe9dd('0xf')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3ab0b6){logger[_0xe9dd('0x11')](_0xe9dd('0x12'),_0x1095f4);logger[_0xe9dd('0x13')](_0xe9dd('0x12'),_0x1095f4,JSON[_0xe9dd('0x14')](_0x3ab0b6));_0x3092c1(_0x3ab0b6);})[_0xe9dd('0x18')](function(_0x10e7b1){logger[_0xe9dd('0x15')](_0xe9dd('0x12'),_0x10e7b1['message'],_0x1095f4);_0x175046(_0x3eec5c['error'](0x1f4,_0x10e7b1[_0xe9dd('0x16')]));});});});};exports[_0xe9dd('0x42')]=function(_0x3b3330){var _0x22b36e=this;return new Promise(function(_0x31cfb4,_0x3aaa11){return db['CmContact'][_0xe9dd('0x43')]({'raw':!![],'where':{'phone':_0x3b3330[_0xe9dd('0x8')][_0xe9dd('0xa')][_0xe9dd('0x44')]},'attributes':['id',_0xe9dd('0x45')],'order':[['id',_0xe9dd('0x46')]]})[_0xe9dd('0x10')](function(_0x2d9663){logger['info'](_0xe9dd('0x47'),_0x3b3330);logger[_0xe9dd('0x13')](_0xe9dd('0x47'),_0x3b3330,JSON[_0xe9dd('0x14')](_0x2d9663));_0x31cfb4(_0x2d9663);})[_0xe9dd('0x18')](function(_0x4601b8){logger['error'](_0xe9dd('0x47'),_0x4601b8[_0xe9dd('0x16')],_0x3b3330);_0x3aaa11(_0x22b36e[_0xe9dd('0x15')](0x1f4,_0x4601b8[_0xe9dd('0x16')]));});});};exports[_0xe9dd('0x48')]=function(_0x8dfd71){var _0x397a91=this;return new Promise(function(_0x575c48,_0x1061c1){return db['sequelize'][_0xe9dd('0x24')](function(_0x4ad0cb){var _0x183280=_0x8dfd71[_0xe9dd('0x8')]&&_0x8dfd71[_0xe9dd('0x8')][_0xe9dd('0xa')]?_0x8dfd71['options'][_0xe9dd('0xa')]:{};return db['CmHopper'][_0xe9dd('0x1d')](_0x8dfd71[_0xe9dd('0x1b')],{'where':_0x183280,'transaction':_0x4ad0cb})[_0xe9dd('0x10')](function(_0x3a4d01){logger[_0xe9dd('0x11')](_0xe9dd('0x48'),_0x8dfd71);logger[_0xe9dd('0x13')](_0xe9dd('0x48'),_0x8dfd71,JSON[_0xe9dd('0x14')](_0x3a4d01));_0x575c48(_0x3a4d01);})['catch'](function(_0x38cfbf){logger[_0xe9dd('0x15')](_0xe9dd('0x48'),_0x38cfbf[_0xe9dd('0x16')],_0x8dfd71);_0x1061c1(_0x397a91[_0xe9dd('0x15')](0x1f4,_0x38cfbf['message']));});});});};exports[_0xe9dd('0x49')]=function(_0x7a9f71){var _0x51415c=this;var _0x5cc548=_0x7a9f71[_0xe9dd('0x1b')][_0xe9dd('0xa')][_0xe9dd('0x4a')];var _0xf48dec=_0x7a9f71[_0xe9dd('0x1b')][_0xe9dd('0xa')][_0xe9dd('0x4b')];var _0x146bb6=_0x7a9f71['body'][_0xe9dd('0xa')][_0xe9dd('0x4c')];return new Promise(function(_0x3e80a5,_0x5a176b){return db['CmHopper'][_0xe9dd('0x7')]({'where':{'voiceQueueId':{'$in':_0x5cc548},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0xe9dd('0x34')]['literal'](_0xe9dd('0x4d')+_0xf48dec+_0xe9dd('0x4e')),'$gt':db[_0xe9dd('0x34')][_0xe9dd('0x38')](_0xe9dd('0x4f'))}},'UserId':{'$in':_0x146bb6}},'include':[{'model':db[_0xe9dd('0x22')],'as':_0xe9dd('0x27')},{'model':db[_0xe9dd('0x29')],'as':_0xe9dd('0x50'),'attributes':['id',_0xe9dd('0x2a'),_0xe9dd('0x2b')]},{'model':db[_0xe9dd('0x51')],'as':_0xe9dd('0x52')}]})[_0xe9dd('0x10')](function(_0x58cb8c){if(_0x58cb8c['length']>0x0){return db['sequelize'][_0xe9dd('0x24')](function(_0x4c1e82){return db[_0xe9dd('0x6')][_0xe9dd('0x1d')]({'recallmeNotifiedDate':db[_0xe9dd('0x34')][_0xe9dd('0x38')](_0xe9dd('0x4f'))},{'where':{'id':{'$in':_['map'](_0x58cb8c,'id')}},'transaction':_0x4c1e82})[_0xe9dd('0x10')](function(){_0x3e80a5(_0x58cb8c);})['catch'](function(_0x1f786d){logger[_0xe9dd('0x15')](_0xe9dd('0x49'),_0x1f786d[_0xe9dd('0x16')],_0x7a9f71);_0x5a176b(_0x51415c['error'](0x1f4,_0x1f786d[_0xe9dd('0x16')]));});})[_0xe9dd('0x18')](function(_0x47e5ce){logger[_0xe9dd('0x15')](_0xe9dd('0x49'),_0x47e5ce[_0xe9dd('0x16')],_0x7a9f71);_0x5a176b(_0x51415c[_0xe9dd('0x15')](0x1f4,_0x47e5ce[_0xe9dd('0x16')]));});}else{_0x3e80a5(_0x58cb8c);}});});};