Built motion from commit f67b3b02.|2.6.31
[motion2.git] / server / api / cmHopper / cmHopper.rpc.js
index 4d35f21..0af4a74 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x020b=['push','ContactId','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','MoveContactManagedDialer','CountReScheduled','COUNT','`scheduledat`\x20>=\x20','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','order','UserId','all','GetCmHopperPreview','findOne','phone','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueIds','interval','availableAgentsIds','literal','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','NOW()','CmList','lodash','util','../../config/logger','rpc','findAll','raw','options','attributes','limit','include','map','model','then','info','debug','GetCmHopper','catch','error','CmHopper','where','ShowCmHopper','stringify','message','create','body','CreateCmHopper','UpdateCmHopper','update','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','DestroyCmHopper','destroy','GetContactDialer','describe','sequelize','transaction','UPDATE','CmContact','Contact','keys','User','Agent','name','voicePause','length','includes'];(function(_0xf5e7da,_0x184898){var _0x34c0de=function(_0x45d258){while(--_0x45d258){_0xf5e7da['push'](_0xf5e7da['shift']());}};_0x34c0de(++_0x184898);}(_0x020b,0x1d8));var _0xb020=function(_0x30318c,_0x2bb953){_0x30318c=_0x30318c-0x0;var _0x478a4b=_0x020b[_0x30318c];return _0x478a4b;};'use strict';var _=require(_0xb020('0x0'));var util=require(_0xb020('0x1'));var moment=require('moment');var BPromise=require('bluebird');var db=require('../../mysqldb')['db'];var logger=require(_0xb020('0x2'))(_0xb020('0x3'));exports['GetCmHopper']=function(_0x391c73){var _0x4f98fd=this;return new Promise(function(_0x3a2e9c,_0x2978f7){return db['CmHopper'][_0xb020('0x4')]({'raw':_0x391c73['options']?_0x391c73['options'][_0xb020('0x5')]===undefined?!![]:![]:!![],'where':_0x391c73['options']?_0x391c73['options']['where']||null:null,'attributes':_0x391c73[_0xb020('0x6')]?_0x391c73[_0xb020('0x6')][_0xb020('0x7')]||null:null,'limit':_0x391c73['options']?_0x391c73[_0xb020('0x6')][_0xb020('0x8')]||null:null,'include':_0x391c73[_0xb020('0x6')]?_0x391c73[_0xb020('0x6')][_0xb020('0x9')]?_[_0xb020('0xa')](_0x391c73[_0xb020('0x6')]['include'],function(_0x2a850a){return{'model':db[_0x2a850a[_0xb020('0xb')]],'as':_0x2a850a['as'],'attributes':_0x2a850a[_0xb020('0x7')],'include':_0x2a850a[_0xb020('0x9')]?_[_0xb020('0xa')](_0x2a850a[_0xb020('0x9')],function(_0x1ea19){return{'model':db[_0x1ea19['model']],'as':_0x1ea19['as'],'attributes':_0x1ea19[_0xb020('0x7')],'include':_0x1ea19[_0xb020('0x9')]?_['map'](_0x1ea19['include'],function(_0xafe043){return{'model':db[_0xafe043[_0xb020('0xb')]],'as':_0xafe043['as'],'attributes':_0xafe043[_0xb020('0x7')]};}):[]};}):[]};}):[]:[]})[_0xb020('0xc')](function(_0x36f9d7){logger[_0xb020('0xd')]('GetCmHopper',_0x391c73);logger[_0xb020('0xe')](_0xb020('0xf'),_0x391c73,JSON['stringify'](_0x36f9d7));_0x3a2e9c(_0x36f9d7);})[_0xb020('0x10')](function(_0x165b19){logger[_0xb020('0x11')]('GetCmHopper',_0x165b19['message'],_0x391c73);_0x2978f7(_0x4f98fd['error'](0x1f4,_0x165b19['message']));});});};exports['ShowCmHopper']=function(_0x22fb9a){var _0x509539=this;return new Promise(function(_0x10d34d,_0x258d2f){return db[_0xb020('0x12')]['find']({'raw':_0x22fb9a[_0xb020('0x6')]?_0x22fb9a[_0xb020('0x6')][_0xb020('0x5')]===undefined?!![]:![]:!![],'where':_0x22fb9a[_0xb020('0x6')]?_0x22fb9a[_0xb020('0x6')][_0xb020('0x13')]||null:null,'attributes':_0x22fb9a[_0xb020('0x6')]?_0x22fb9a[_0xb020('0x6')][_0xb020('0x7')]||null:null,'include':_0x22fb9a[_0xb020('0x6')]?_0x22fb9a[_0xb020('0x6')][_0xb020('0x9')]?_['map'](_0x22fb9a[_0xb020('0x6')][_0xb020('0x9')],function(_0x464e27){return{'model':db[_0x464e27[_0xb020('0xb')]],'as':_0x464e27['as'],'attributes':_0x464e27[_0xb020('0x7')],'include':_0x464e27[_0xb020('0x9')]?_['map'](_0x464e27[_0xb020('0x9')],function(_0x18f3c0){return{'model':db[_0x18f3c0[_0xb020('0xb')]],'as':_0x18f3c0['as'],'attributes':_0x18f3c0[_0xb020('0x7')],'include':_0x18f3c0[_0xb020('0x9')]?_['map'](_0x18f3c0['include'],function(_0x5f2c2a){return{'model':db[_0x5f2c2a[_0xb020('0xb')]],'as':_0x5f2c2a['as'],'attributes':_0x5f2c2a[_0xb020('0x7')]};}):[]};}):[]};}):[]:[]})[_0xb020('0xc')](function(_0x3020a4){logger[_0xb020('0xd')]('ShowCmHopper',_0x22fb9a);logger[_0xb020('0xe')](_0xb020('0x14'),_0x22fb9a,JSON[_0xb020('0x15')](_0x3020a4));_0x10d34d(_0x3020a4);})[_0xb020('0x10')](function(_0x2d9506){logger[_0xb020('0x11')](_0xb020('0x14'),_0x2d9506[_0xb020('0x16')],_0x22fb9a);_0x258d2f(_0x509539[_0xb020('0x11')](0x1f4,_0x2d9506[_0xb020('0x16')]));});});};exports['CreateCmHopper']=function(_0x41e51){var _0x11e595=this;return new Promise(function(_0x2271bc,_0x26508f){return db[_0xb020('0x12')][_0xb020('0x17')](_0x41e51[_0xb020('0x18')],{'raw':_0x41e51[_0xb020('0x6')]?_0x41e51[_0xb020('0x6')][_0xb020('0x5')]===undefined?!![]:![]:!![]})[_0xb020('0xc')](function(_0x5050bf){logger[_0xb020('0xd')](_0xb020('0x19'),_0x41e51);logger[_0xb020('0xe')](_0xb020('0x19'),_0x41e51,JSON[_0xb020('0x15')](_0x5050bf));_0x2271bc(_0x5050bf);})[_0xb020('0x10')](function(_0x30b39d){logger[_0xb020('0x11')](_0xb020('0x19'),_0x30b39d[_0xb020('0x16')],_0x41e51);_0x26508f(_0x11e595[_0xb020('0x11')](0x1f4,_0x30b39d[_0xb020('0x16')]));});});};exports[_0xb020('0x1a')]=function(_0xea205d){var _0x493a35=this;return new Promise(function(_0x4b9782,_0x51fa95){return db[_0xb020('0x12')][_0xb020('0x1b')](_0xea205d['body'],{'raw':_0xea205d[_0xb020('0x6')]?_0xea205d['options'][_0xb020('0x5')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xea205d[_0xb020('0x6')]?_0xea205d[_0xb020('0x6')][_0xb020('0x13')]||null:null,'attributes':_0xea205d[_0xb020('0x6')]?_0xea205d[_0xb020('0x6')]['attributes']||null:null,'limit':_0xea205d['options']?_0xea205d['options'][_0xb020('0x8')]||null:null})[_0xb020('0xc')](function(_0xe594a1){logger[_0xb020('0xd')]('UpdateCmHopper',_0xea205d);logger[_0xb020('0xd')](_0xb020('0x1c'),JSON[_0xb020('0x15')](_0xea205d[_0xb020('0x6')][_0xb020('0x13')]),_0xea205d[_0xb020('0x18')][_0xb020('0x1d')]);logger[_0xb020('0xe')](_0xb020('0x1a'),_0xea205d,JSON[_0xb020('0x15')](_0xe594a1));_0x4b9782(_0xe594a1);})[_0xb020('0x10')](function(_0x43378d){logger[_0xb020('0x11')]('UpdateCmHopper',_0x43378d['message'],_0xea205d);_0x51fa95(_0x493a35['error'](0x1f4,_0x43378d[_0xb020('0x16')]));});});};exports[_0xb020('0x1e')]=function(_0x56205a){var _0x23eee1=this;return new Promise(function(_0x94d0b8,_0x5552b4){return db[_0xb020('0x12')][_0xb020('0x1f')]({'where':_0x56205a[_0xb020('0x6')]?_0x56205a['options']['where']||null:null})[_0xb020('0xc')](function(_0x437bac){logger[_0xb020('0xd')]('DestroyCmHopper',_0x56205a);logger[_0xb020('0xe')](_0xb020('0x1e'),_0x56205a,JSON[_0xb020('0x15')](_0x437bac));_0x94d0b8(_0x437bac);})['catch'](function(_0x2b57e0){logger[_0xb020('0x11')]('DestroyCmHopper',_0x2b57e0[_0xb020('0x16')],_0x56205a);_0x5552b4(_0x23eee1[_0xb020('0x11')](0x1f4,_0x2b57e0['message']));});});};exports[_0xb020('0x20')]=function(_0x4c2598){var _0x316804=this;return new Promise(function(_0x10d26f,_0x5259f7){return db['CmContact'][_0xb020('0x21')]()[_0xb020('0xc')](function(_0xe301c5){return db[_0xb020('0x22')][_0xb020('0x23')](function(_0x1e3539){return db[_0xb020('0x12')][_0xb020('0x4')]({'where':_0x4c2598[_0xb020('0x6')]?_0x4c2598[_0xb020('0x6')][_0xb020('0x13')]||null:null,'attributes':_0x4c2598['options']?_0x4c2598[_0xb020('0x6')][_0xb020('0x7')]||null:null,'limit':_0x4c2598[_0xb020('0x6')]?_0x4c2598[_0xb020('0x6')][_0xb020('0x8')]||null:null,'order':_0x4c2598[_0xb020('0x6')]?_0x4c2598[_0xb020('0x6')]['order']||null:null,'transaction':_0x1e3539,'lock':_0x1e3539['LOCK'][_0xb020('0x24')],'include':[{'model':db[_0xb020('0x25')],'as':_0xb020('0x26'),'attributes':_[_0xb020('0x27')](_0xe301c5)},{'model':db[_0xb020('0x28')],'as':_0xb020('0x29'),'attributes':['id',_0xb020('0x2a'),_0xb020('0x2b')]}]})[_0xb020('0xc')](function(_0xf52948){var _0x2755b8=[];var _0x3ea6d9=[];for(var _0x4a6a11=0x0;_0x4a6a11<_0xf52948[_0xb020('0x2c')];_0x4a6a11+=0x1){var _0x1a165c=_0xf52948[_0x4a6a11]['UserId'];if(_0x1a165c===null){_0x2755b8['push'](_0xf52948[_0x4a6a11][_0xb020('0x1b')](_0x4c2598[_0xb020('0x18')],{'transaction':_0x1e3539}));}else if(!_0x3ea6d9[_0xb020('0x2d')](_0x1a165c)){_0x3ea6d9[_0xb020('0x2e')](_0x1a165c);_0x2755b8['push'](_0xf52948[_0x4a6a11]['update'](_0x4c2598[_0xb020('0x18')],{'transaction':_0x1e3539}));}}return BPromise['all'](_0x2755b8);});})[_0xb020('0xc')](function(_0x480513){logger[_0xb020('0xd')](_0xb020('0x20'),_0x4c2598);if(_0x480513[_0xb020('0x2c')]>0x0){logger[_0xb020('0xd')]('GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]',_0x480513[0x0]['dataValues']['id'],_0x480513[0x0]['dataValues'][_0xb020('0x2f')],_0x480513[0x0]['dataValues'][_0xb020('0x1d')]);}logger[_0xb020('0xe')](_0xb020('0x20'),_0x4c2598,JSON[_0xb020('0x15')](_0x480513));_0x10d26f(_0x480513);})['catch'](function(_0x29da64){logger[_0xb020('0x11')](_0xb020('0x20'),_0x29da64[_0xb020('0x16')],_0x4c2598);_0x5259f7(_0x316804[_0xb020('0x11')](0x1f4,_0x29da64[_0xb020('0x16')]));});});});};exports['MoveContactManagedDialer']=function(_0x5d3bd0){var _0x286284=this;return new Promise(function(_0x3aeab0,_0xfe9d3){return db[_0xb020('0x22')]['transaction'](function(_0x4721a8){return db['CmHopperFinal'][_0xb020('0x17')](_0x5d3bd0[_0xb020('0x18')],{'raw':_0x5d3bd0[_0xb020('0x6')]?_0x5d3bd0[_0xb020('0x6')][_0xb020('0x5')]===undefined?!![]:![]:!![],'transaction':_0x4721a8})[_0xb020('0xc')](function(){logger['info'](_0xb020('0x30'),JSON[_0xb020('0x15')](_0x5d3bd0['options']['where']),_0x5d3bd0[_0xb020('0x6')][_0xb020('0x13')][_0xb020('0x1d')]);return db['CmHopper'][_0xb020('0x1f')]({'where':_0x5d3bd0[_0xb020('0x6')]?_0x5d3bd0[_0xb020('0x6')][_0xb020('0x13')]||null:null,'transaction':_0x4721a8});});})[_0xb020('0xc')](function(_0x2871d7){logger['info'](_0xb020('0x31'),_0x5d3bd0);logger[_0xb020('0xe')](_0xb020('0x31'),_0x5d3bd0,JSON['stringify'](_0x2871d7));_0x3aeab0(_0x2871d7);})[_0xb020('0x10')](function(_0x43d8b1){logger[_0xb020('0x11')](_0xb020('0x31'),_0x43d8b1[_0xb020('0x16')],_0x5d3bd0);_0xfe9d3(_0x286284[_0xb020('0x11')](0x1f4,_0x43d8b1[_0xb020('0x16')]));});});};exports[_0xb020('0x32')]=function(_0x16cbfd){var _0x5632f9=this;return new Promise(function(_0x33ffdf,_0x27f954){return db[_0xb020('0x12')]['findAll']({'raw':_0x16cbfd[_0xb020('0x6')]?_0x16cbfd[_0xb020('0x6')][_0xb020('0x5')]===undefined?!![]:![]:!![],'where':_0x16cbfd[_0xb020('0x6')]?_0x16cbfd[_0xb020('0x6')][_0xb020('0x13')]||null:null,'attributes':[[db[_0xb020('0x22')]['fn'](_0xb020('0x33'),db[_0xb020('0x22')]['fn']('IF',db[_0xb020('0x22')]['literal'](_0xb020('0x34')+util['format']('\x22%s\x22',moment()['format'](_0xb020('0x35')))+_0xb020('0x36')))),_0xb020('0x37')]]})[_0xb020('0xc')](function(_0x56df29){logger[_0xb020('0xd')](_0xb020('0x32'),_0x16cbfd);logger[_0xb020('0xe')](_0xb020('0x32'),_0x16cbfd,JSON[_0xb020('0x15')](_0x56df29));_0x33ffdf(_0x56df29);})[_0xb020('0x10')](function(_0x17ebe9){logger[_0xb020('0x11')](_0xb020('0x32'),_0x17ebe9[_0xb020('0x16')],_0x16cbfd);_0x27f954(_0x5632f9[_0xb020('0x11')](0x1f4,_0x17ebe9[_0xb020('0x16')]));});});};exports[_0xb020('0x38')]=function(_0x447b0e){var _0x1a7d88=this;return new Promise(function(_0xdf1ced,_0x2deb38){return db['CmContact']['describe']()[_0xb020('0xc')](function(){return db['sequelize'][_0xb020('0x23')](function(_0x331fe3){return db['CmHopper'][_0xb020('0x4')]({'where':_0x447b0e[_0xb020('0x6')]?_0x447b0e[_0xb020('0x6')][_0xb020('0x13')]||null:null,'attributes':_0x447b0e['options']?_0x447b0e[_0xb020('0x6')]['attributes']||null:null,'limit':0x1,'order':_0x447b0e[_0xb020('0x6')]?_0x447b0e[_0xb020('0x6')][_0xb020('0x39')]||null:null,'group':db['CmHopper'][_0xb020('0x3a')],'transaction':_0x331fe3,'lock':_0x331fe3['LOCK'][_0xb020('0x24')],'include':_0x447b0e[_0xb020('0x6')]?_0x447b0e['options'][_0xb020('0x9')]?_[_0xb020('0xa')](_0x447b0e[_0xb020('0x6')]['include'],function(_0x381218){return{'model':db[_0x381218[_0xb020('0xb')]],'as':_0x381218['as'],'attributes':_0x381218[_0xb020('0x7')],'include':_0x381218[_0xb020('0x9')]?_['map'](_0x381218[_0xb020('0x9')],function(_0x30a24b){return{'model':db[_0x30a24b[_0xb020('0xb')]],'as':_0x30a24b['as'],'attributes':_0x30a24b[_0xb020('0x7')],'include':_0x30a24b[_0xb020('0x9')]?_[_0xb020('0xa')](_0x30a24b['include'],function(_0xbda664){return{'model':db[_0xbda664[_0xb020('0xb')]],'as':_0xbda664['as'],'attributes':_0xbda664['attributes']};}):[]};}):[]};}):[]:[]})[_0xb020('0xc')](function(_0x5076cd){var _0x594def=[];for(var _0x499de8=0x0;_0x499de8<_0x5076cd['length'];_0x499de8+=0x1){_0x594def[_0xb020('0x2e')](_0x5076cd[_0x499de8][_0xb020('0x1b')](_0x447b0e[_0xb020('0x18')],{'transaction':_0x331fe3}));}return BPromise[_0xb020('0x3b')](_0x594def);});})[_0xb020('0xc')](function(_0x5ad148){logger[_0xb020('0xd')](_0xb020('0x38'),_0x447b0e);logger[_0xb020('0xe')](_0xb020('0x38'),_0x447b0e,JSON[_0xb020('0x15')](_0x5ad148));_0xdf1ced(_0x5ad148);})[_0xb020('0x10')](function(_0x1d00b6){logger['error'](_0xb020('0x38'),_0x1d00b6[_0xb020('0x16')],_0x447b0e);_0x2deb38(_0x1a7d88[_0xb020('0x11')](0x1f4,_0x1d00b6[_0xb020('0x16')]));});});});};exports[_0xb020('0x3c')]=function(_0x4402bd){var _0x3e35ca=this;return new Promise(function(_0x4b5444,_0x37e5fe){db[_0xb020('0x25')][_0xb020('0x21')]()['then'](function(_0x5eda5c){return db[_0xb020('0x12')][_0xb020('0x4')]({'raw':_0x4402bd[_0xb020('0x6')]?_0x4402bd['options'][_0xb020('0x5')]===undefined?!![]:![]:!![],'where':_0x4402bd[_0xb020('0x6')]?_0x4402bd[_0xb020('0x6')]['where']||null:null,'attributes':_0x4402bd[_0xb020('0x6')]?_0x4402bd['options'][_0xb020('0x7')]||null:null,'limit':_0x4402bd[_0xb020('0x6')]?_0x4402bd['options'][_0xb020('0x8')]||null:null,'include':_0x4402bd[_0xb020('0x6')]?_0x4402bd[_0xb020('0x6')]['include']?_[_0xb020('0xa')](_0x4402bd[_0xb020('0x6')][_0xb020('0x9')],function(_0x215096){return{'model':db[_0x215096['model']],'as':_0x215096['as'],'attributes':_0x215096['as']==='Contact'?_['keys'](_0x5eda5c):_0x215096[_0xb020('0x7')],'include':_0x215096[_0xb020('0x9')]?_[_0xb020('0xa')](_0x215096['include'],function(_0x50dfbd){return{'model':db[_0x50dfbd[_0xb020('0xb')]],'as':_0x50dfbd['as'],'attributes':_0x50dfbd[_0xb020('0x7')],'include':_0x50dfbd[_0xb020('0x9')]?_[_0xb020('0xa')](_0x50dfbd['include'],function(_0x2975ac){return{'model':db[_0x2975ac[_0xb020('0xb')]],'as':_0x2975ac['as'],'attributes':_0x2975ac['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x6907a8){logger[_0xb020('0xd')]('GetCmHopper',_0x4402bd);logger['debug'](_0xb020('0xf'),_0x4402bd,JSON[_0xb020('0x15')](_0x6907a8));_0x4b5444(_0x6907a8);})[_0xb020('0x10')](function(_0x14bd26){logger['error'](_0xb020('0xf'),_0x14bd26[_0xb020('0x16')],_0x4402bd);_0x37e5fe(_0x3e35ca[_0xb020('0x11')](0x1f4,_0x14bd26[_0xb020('0x16')]));});});});};exports['GetContactByPhone']=function(_0xa79721){var _0x3b7f81=this;return new Promise(function(_0xf06b63,_0x5ef951){return db[_0xb020('0x25')][_0xb020('0x3d')]({'raw':!![],'where':{'phone':_0xa79721[_0xb020('0x6')][_0xb020('0x13')][_0xb020('0x3e')]},'attributes':['id','dialTimezone'],'order':[['id','DESC']]})[_0xb020('0xc')](function(_0x2563f4){logger[_0xb020('0xd')](_0xb020('0x3f'),_0xa79721);logger[_0xb020('0xe')](_0xb020('0x3f'),_0xa79721,JSON['stringify'](_0x2563f4));_0xf06b63(_0x2563f4);})['catch'](function(_0x5ee165){logger[_0xb020('0x11')](_0xb020('0x3f'),_0x5ee165[_0xb020('0x16')],_0xa79721);_0x5ef951(_0x3b7f81[_0xb020('0x11')](0x1f4,_0x5ee165[_0xb020('0x16')]));});});};exports['ResetActiveCalls']=function(_0x59005c){var _0xba73=this;return new Promise(function(_0x277490,_0x29f441){return db[_0xb020('0x22')][_0xb020('0x23')](function(_0x3cc7f4){var _0x59b172=_0x59005c[_0xb020('0x6')]&&_0x59005c[_0xb020('0x6')][_0xb020('0x13')]?_0x59005c[_0xb020('0x6')]['where']:{};return db[_0xb020('0x12')][_0xb020('0x1b')](_0x59005c['body'],{'where':_0x59b172,'transaction':_0x3cc7f4})[_0xb020('0xc')](function(_0x5f2103){logger[_0xb020('0xd')]('ResetActiveCalls',_0x59005c);logger[_0xb020('0xe')](_0xb020('0x40'),_0x59005c,JSON['stringify'](_0x5f2103));_0x277490(_0x5f2103);})[_0xb020('0x10')](function(_0x4a024e){logger['error'](_0xb020('0x40'),_0x4a024e[_0xb020('0x16')],_0x59005c);_0x29f441(_0xba73[_0xb020('0x11')](0x1f4,_0x4a024e[_0xb020('0x16')]));});});});};exports[_0xb020('0x41')]=function(_0x168e30){var _0x49639f=this;var _0x30a4ba=_0x168e30[_0xb020('0x18')][_0xb020('0x13')][_0xb020('0x42')];var _0x2ce36e=_0x168e30[_0xb020('0x18')]['where'][_0xb020('0x43')];var _0x351511=_0x168e30[_0xb020('0x18')]['where'][_0xb020('0x44')];return new Promise(function(_0x273711,_0x46cc9b){return db[_0xb020('0x12')]['findAll']({'where':{'voiceQueueId':{'$in':_0x30a4ba},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db['sequelize'][_0xb020('0x45')](_0xb020('0x46')+_0x2ce36e+_0xb020('0x47')),'$gt':db[_0xb020('0x22')][_0xb020('0x45')](_0xb020('0x48'))}},'UserId':{'$in':_0x351511}},'include':[{'model':db[_0xb020('0x25')],'as':'Contact'},{'model':db['User'],'as':_0xb020('0x29'),'attributes':['id',_0xb020('0x2a'),'voicePause']},{'model':db[_0xb020('0x49')],'as':'List'}]})[_0xb020('0xc')](function(_0x39da17){if(_0x39da17['length']>0x0){return db[_0xb020('0x22')]['transaction'](function(_0x97b117){return db[_0xb020('0x12')][_0xb020('0x1b')]({'recallmeNotifiedDate':db[_0xb020('0x22')][_0xb020('0x45')](_0xb020('0x48'))},{'where':{'id':{'$in':_[_0xb020('0xa')](_0x39da17,'id')}},'transaction':_0x97b117})[_0xb020('0xc')](function(){_0x273711(_0x39da17);})[_0xb020('0x10')](function(_0x546218){logger['error']('CmHopperHandlePreviewRecallNotifications',_0x546218['message'],_0x168e30);_0x46cc9b(_0x49639f[_0xb020('0x11')](0x1f4,_0x546218[_0xb020('0x16')]));});})['catch'](function(_0x5a5a8e){logger[_0xb020('0x11')](_0xb020('0x41'),_0x5a5a8e[_0xb020('0x16')],_0x168e30);_0x46cc9b(_0x49639f[_0xb020('0x11')](0x1f4,_0x5a5a8e[_0xb020('0x16')]));});}else{_0x273711(_0x39da17);}});});};
\ No newline at end of file
+var _0x6f67=['options','raw','where','attributes','map','include','model','then','GetCmHopper','debug','catch','error','message','ShowCmHopper','CmHopper','find','info','stringify','create','body','CreateCmHopper','UpdateCmHopper','update','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','DestroyCmHopper','destroy','describe','transaction','limit','order','LOCK','CmContact','Contact','keys','User','Agent','name','voicePause','UserId','push','includes','all','length','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','GetContactDialer','MoveContactManagedDialer','sequelize','CmHopperFinal','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','\x20,\x201,\x20null','GetContactRecallMe','UPDATE','GetContactByPhone','findOne','phone','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueIds','availableAgentsIds','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','NOW()','CmList','List','lodash','util','moment','../../mysqldb','rpc','findAll'];(function(_0x4c6c3a,_0x18836d){var _0x253c13=function(_0x1a9a31){while(--_0x1a9a31){_0x4c6c3a['push'](_0x4c6c3a['shift']());}};_0x253c13(++_0x18836d);}(_0x6f67,0xf0));var _0x76f6=function(_0x187a0a,_0x2d285c){_0x187a0a=_0x187a0a-0x0;var _0x1847a6=_0x6f67[_0x187a0a];return _0x1847a6;};'use strict';var _=require(_0x76f6('0x0'));var util=require(_0x76f6('0x1'));var moment=require(_0x76f6('0x2'));var BPromise=require('bluebird');var db=require(_0x76f6('0x3'))['db'];var logger=require('../../config/logger')(_0x76f6('0x4'));exports['GetCmHopper']=function(_0x22ce4b){var _0x3806fb=this;return new Promise(function(_0x3b2546,_0x7a91ed){return db['CmHopper'][_0x76f6('0x5')]({'raw':_0x22ce4b[_0x76f6('0x6')]?_0x22ce4b[_0x76f6('0x6')][_0x76f6('0x7')]===undefined?!![]:![]:!![],'where':_0x22ce4b[_0x76f6('0x6')]?_0x22ce4b[_0x76f6('0x6')][_0x76f6('0x8')]||null:null,'attributes':_0x22ce4b[_0x76f6('0x6')]?_0x22ce4b[_0x76f6('0x6')][_0x76f6('0x9')]||null:null,'limit':_0x22ce4b['options']?_0x22ce4b[_0x76f6('0x6')]['limit']||null:null,'include':_0x22ce4b[_0x76f6('0x6')]?_0x22ce4b['options']['include']?_[_0x76f6('0xa')](_0x22ce4b[_0x76f6('0x6')][_0x76f6('0xb')],function(_0x1c8193){return{'model':db[_0x1c8193['model']],'as':_0x1c8193['as'],'attributes':_0x1c8193[_0x76f6('0x9')],'include':_0x1c8193[_0x76f6('0xb')]?_['map'](_0x1c8193[_0x76f6('0xb')],function(_0x336045){return{'model':db[_0x336045[_0x76f6('0xc')]],'as':_0x336045['as'],'attributes':_0x336045[_0x76f6('0x9')],'include':_0x336045['include']?_[_0x76f6('0xa')](_0x336045[_0x76f6('0xb')],function(_0x73a50c){return{'model':db[_0x73a50c[_0x76f6('0xc')]],'as':_0x73a50c['as'],'attributes':_0x73a50c[_0x76f6('0x9')]};}):[]};}):[]};}):[]:[]})[_0x76f6('0xd')](function(_0x2668dc){logger['info'](_0x76f6('0xe'),_0x22ce4b);logger[_0x76f6('0xf')](_0x76f6('0xe'),_0x22ce4b,JSON['stringify'](_0x2668dc));_0x3b2546(_0x2668dc);})[_0x76f6('0x10')](function(_0x2af9af){logger[_0x76f6('0x11')](_0x76f6('0xe'),_0x2af9af[_0x76f6('0x12')],_0x22ce4b);_0x7a91ed(_0x3806fb['error'](0x1f4,_0x2af9af[_0x76f6('0x12')]));});});};exports[_0x76f6('0x13')]=function(_0x390673){var _0x3b98d2=this;return new Promise(function(_0x2883fc,_0xf0d8c3){return db[_0x76f6('0x14')][_0x76f6('0x15')]({'raw':_0x390673[_0x76f6('0x6')]?_0x390673[_0x76f6('0x6')][_0x76f6('0x7')]===undefined?!![]:![]:!![],'where':_0x390673[_0x76f6('0x6')]?_0x390673[_0x76f6('0x6')][_0x76f6('0x8')]||null:null,'attributes':_0x390673['options']?_0x390673['options'][_0x76f6('0x9')]||null:null,'include':_0x390673[_0x76f6('0x6')]?_0x390673[_0x76f6('0x6')]['include']?_[_0x76f6('0xa')](_0x390673[_0x76f6('0x6')][_0x76f6('0xb')],function(_0xdd5345){return{'model':db[_0xdd5345[_0x76f6('0xc')]],'as':_0xdd5345['as'],'attributes':_0xdd5345['attributes'],'include':_0xdd5345[_0x76f6('0xb')]?_[_0x76f6('0xa')](_0xdd5345[_0x76f6('0xb')],function(_0x253eba){return{'model':db[_0x253eba['model']],'as':_0x253eba['as'],'attributes':_0x253eba[_0x76f6('0x9')],'include':_0x253eba[_0x76f6('0xb')]?_[_0x76f6('0xa')](_0x253eba[_0x76f6('0xb')],function(_0x425892){return{'model':db[_0x425892[_0x76f6('0xc')]],'as':_0x425892['as'],'attributes':_0x425892[_0x76f6('0x9')]};}):[]};}):[]};}):[]:[]})[_0x76f6('0xd')](function(_0x5eaad0){logger[_0x76f6('0x16')](_0x76f6('0x13'),_0x390673);logger['debug'](_0x76f6('0x13'),_0x390673,JSON[_0x76f6('0x17')](_0x5eaad0));_0x2883fc(_0x5eaad0);})['catch'](function(_0x51151c){logger['error'](_0x76f6('0x13'),_0x51151c[_0x76f6('0x12')],_0x390673);_0xf0d8c3(_0x3b98d2[_0x76f6('0x11')](0x1f4,_0x51151c[_0x76f6('0x12')]));});});};exports['CreateCmHopper']=function(_0xaf4261){var _0xc390b8=this;return new Promise(function(_0x3af179,_0x2b625a){return db[_0x76f6('0x14')][_0x76f6('0x18')](_0xaf4261[_0x76f6('0x19')],{'raw':_0xaf4261['options']?_0xaf4261[_0x76f6('0x6')][_0x76f6('0x7')]===undefined?!![]:![]:!![]})[_0x76f6('0xd')](function(_0x2d2251){logger[_0x76f6('0x16')](_0x76f6('0x1a'),_0xaf4261);logger[_0x76f6('0xf')](_0x76f6('0x1a'),_0xaf4261,JSON['stringify'](_0x2d2251));_0x3af179(_0x2d2251);})['catch'](function(_0x1449fa){logger['error'](_0x76f6('0x1a'),_0x1449fa['message'],_0xaf4261);_0x2b625a(_0xc390b8['error'](0x1f4,_0x1449fa['message']));});});};exports[_0x76f6('0x1b')]=function(_0x39c6e7){var _0x35a75f=this;return new Promise(function(_0x286ef5,_0x507180){return db[_0x76f6('0x14')][_0x76f6('0x1c')](_0x39c6e7[_0x76f6('0x19')],{'raw':_0x39c6e7['options']?_0x39c6e7['options'][_0x76f6('0x7')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x39c6e7[_0x76f6('0x6')]?_0x39c6e7[_0x76f6('0x6')]['where']||null:null,'attributes':_0x39c6e7[_0x76f6('0x6')]?_0x39c6e7[_0x76f6('0x6')][_0x76f6('0x9')]||null:null,'limit':_0x39c6e7[_0x76f6('0x6')]?_0x39c6e7[_0x76f6('0x6')]['limit']||null:null})[_0x76f6('0xd')](function(_0x6b9ce6){logger[_0x76f6('0x16')](_0x76f6('0x1b'),_0x39c6e7);logger['info'](_0x76f6('0x1d'),JSON[_0x76f6('0x17')](_0x39c6e7['options'][_0x76f6('0x8')]),_0x39c6e7[_0x76f6('0x19')][_0x76f6('0x1e')]);logger[_0x76f6('0xf')](_0x76f6('0x1b'),_0x39c6e7,JSON[_0x76f6('0x17')](_0x6b9ce6));_0x286ef5(_0x6b9ce6);})[_0x76f6('0x10')](function(_0x5c5a46){logger[_0x76f6('0x11')](_0x76f6('0x1b'),_0x5c5a46[_0x76f6('0x12')],_0x39c6e7);_0x507180(_0x35a75f[_0x76f6('0x11')](0x1f4,_0x5c5a46[_0x76f6('0x12')]));});});};exports[_0x76f6('0x1f')]=function(_0x3ebbc6){var _0x34ff3a=this;return new Promise(function(_0x21991b,_0xc92f47){return db[_0x76f6('0x14')][_0x76f6('0x20')]({'where':_0x3ebbc6[_0x76f6('0x6')]?_0x3ebbc6['options'][_0x76f6('0x8')]||null:null})['then'](function(_0x3254cf){logger[_0x76f6('0x16')](_0x76f6('0x1f'),_0x3ebbc6);logger[_0x76f6('0xf')](_0x76f6('0x1f'),_0x3ebbc6,JSON[_0x76f6('0x17')](_0x3254cf));_0x21991b(_0x3254cf);})[_0x76f6('0x10')](function(_0x2c8c71){logger['error'](_0x76f6('0x1f'),_0x2c8c71[_0x76f6('0x12')],_0x3ebbc6);_0xc92f47(_0x34ff3a[_0x76f6('0x11')](0x1f4,_0x2c8c71[_0x76f6('0x12')]));});});};exports['GetContactDialer']=function(_0x3068d5){var _0x5ec943=this;return new Promise(function(_0x3b9c1c,_0x4b4247){return db['CmContact'][_0x76f6('0x21')]()[_0x76f6('0xd')](function(_0x5188ad){return db['sequelize'][_0x76f6('0x22')](function(_0x269c1c){return db['CmHopper'][_0x76f6('0x5')]({'where':_0x3068d5[_0x76f6('0x6')]?_0x3068d5['options'][_0x76f6('0x8')]||null:null,'attributes':_0x3068d5[_0x76f6('0x6')]?_0x3068d5[_0x76f6('0x6')][_0x76f6('0x9')]||null:null,'limit':_0x3068d5[_0x76f6('0x6')]?_0x3068d5['options'][_0x76f6('0x23')]||null:null,'order':_0x3068d5[_0x76f6('0x6')]?_0x3068d5[_0x76f6('0x6')][_0x76f6('0x24')]||null:null,'transaction':_0x269c1c,'lock':_0x269c1c[_0x76f6('0x25')]['UPDATE'],'include':[{'model':db[_0x76f6('0x26')],'as':_0x76f6('0x27'),'attributes':_[_0x76f6('0x28')](_0x5188ad)},{'model':db[_0x76f6('0x29')],'as':_0x76f6('0x2a'),'attributes':['id',_0x76f6('0x2b'),_0x76f6('0x2c')]}]})[_0x76f6('0xd')](function(_0x2372c1){var _0xf529c4=[];var _0x53d9ce=[];for(var _0x47ef36=0x0;_0x47ef36<_0x2372c1['length'];_0x47ef36+=0x1){var _0x4df99e=_0x2372c1[_0x47ef36][_0x76f6('0x2d')];if(_0x4df99e===null){_0xf529c4[_0x76f6('0x2e')](_0x2372c1[_0x47ef36][_0x76f6('0x1c')](_0x3068d5[_0x76f6('0x19')],{'transaction':_0x269c1c}));}else if(!_0x53d9ce[_0x76f6('0x2f')](_0x4df99e)){_0x53d9ce[_0x76f6('0x2e')](_0x4df99e);_0xf529c4[_0x76f6('0x2e')](_0x2372c1[_0x47ef36]['update'](_0x3068d5[_0x76f6('0x19')],{'transaction':_0x269c1c}));}}return BPromise[_0x76f6('0x30')](_0xf529c4);});})[_0x76f6('0xd')](function(_0x993d4c){logger['info']('GetContactDialer',_0x3068d5);if(_0x993d4c[_0x76f6('0x31')]>0x0){logger[_0x76f6('0x16')](_0x76f6('0x32'),_0x993d4c[0x0][_0x76f6('0x33')]['id'],_0x993d4c[0x0][_0x76f6('0x33')][_0x76f6('0x34')],_0x993d4c[0x0][_0x76f6('0x33')][_0x76f6('0x1e')]);}logger[_0x76f6('0xf')](_0x76f6('0x35'),_0x3068d5,JSON[_0x76f6('0x17')](_0x993d4c));_0x3b9c1c(_0x993d4c);})[_0x76f6('0x10')](function(_0x22083f){logger[_0x76f6('0x11')](_0x76f6('0x35'),_0x22083f['message'],_0x3068d5);_0x4b4247(_0x5ec943[_0x76f6('0x11')](0x1f4,_0x22083f['message']));});});});};exports[_0x76f6('0x36')]=function(_0x4dba4e){var _0x1d24c4=this;return new Promise(function(_0x32c4c7,_0x4911af){return db[_0x76f6('0x37')][_0x76f6('0x22')](function(_0x4e8de7){return db[_0x76f6('0x38')][_0x76f6('0x18')](_0x4dba4e[_0x76f6('0x19')],{'raw':_0x4dba4e[_0x76f6('0x6')]?_0x4dba4e[_0x76f6('0x6')][_0x76f6('0x7')]===undefined?!![]:![]:!![],'transaction':_0x4e8de7})[_0x76f6('0xd')](function(){logger['info'](_0x76f6('0x39'),JSON[_0x76f6('0x17')](_0x4dba4e[_0x76f6('0x6')][_0x76f6('0x8')]),_0x4dba4e[_0x76f6('0x6')][_0x76f6('0x8')]['active']);return db['CmHopper'][_0x76f6('0x20')]({'where':_0x4dba4e[_0x76f6('0x6')]?_0x4dba4e['options']['where']||null:null,'transaction':_0x4e8de7});});})['then'](function(_0x166bea){logger[_0x76f6('0x16')]('MoveContactManagedDialer',_0x4dba4e);logger[_0x76f6('0xf')](_0x76f6('0x36'),_0x4dba4e,JSON[_0x76f6('0x17')](_0x166bea));_0x32c4c7(_0x166bea);})[_0x76f6('0x10')](function(_0x3e83fa){logger[_0x76f6('0x11')](_0x76f6('0x36'),_0x3e83fa['message'],_0x4dba4e);_0x4911af(_0x1d24c4[_0x76f6('0x11')](0x1f4,_0x3e83fa['message']));});});};exports[_0x76f6('0x3a')]=function(_0x5eef47){var _0x221e15=this;return new Promise(function(_0x1a7532,_0x58f3be){return db[_0x76f6('0x14')][_0x76f6('0x5')]({'raw':_0x5eef47['options']?_0x5eef47[_0x76f6('0x6')]['raw']===undefined?!![]:![]:!![],'where':_0x5eef47[_0x76f6('0x6')]?_0x5eef47[_0x76f6('0x6')][_0x76f6('0x8')]||null:null,'attributes':[[db[_0x76f6('0x37')]['fn'](_0x76f6('0x3b'),db[_0x76f6('0x37')]['fn']('IF',db['sequelize'][_0x76f6('0x3c')](_0x76f6('0x3d')+util[_0x76f6('0x3e')](_0x76f6('0x3f'),moment()['format']('YYYY-MM-DD\x20HH:mm:ss'))+_0x76f6('0x40')))),'contactsRescheduled']]})[_0x76f6('0xd')](function(_0x18cbc3){logger['info'](_0x76f6('0x3a'),_0x5eef47);logger['debug'](_0x76f6('0x3a'),_0x5eef47,JSON[_0x76f6('0x17')](_0x18cbc3));_0x1a7532(_0x18cbc3);})[_0x76f6('0x10')](function(_0x5c0105){logger[_0x76f6('0x11')](_0x76f6('0x3a'),_0x5c0105['message'],_0x5eef47);_0x58f3be(_0x221e15['error'](0x1f4,_0x5c0105[_0x76f6('0x12')]));});});};exports[_0x76f6('0x41')]=function(_0x70c420){var _0x28deca=this;return new Promise(function(_0x581a9a,_0x5889be){return db['CmContact'][_0x76f6('0x21')]()[_0x76f6('0xd')](function(){return db[_0x76f6('0x37')][_0x76f6('0x22')](function(_0x5ba526){return db[_0x76f6('0x14')][_0x76f6('0x5')]({'where':_0x70c420[_0x76f6('0x6')]?_0x70c420[_0x76f6('0x6')]['where']||null:null,'attributes':_0x70c420[_0x76f6('0x6')]?_0x70c420['options']['attributes']||null:null,'limit':0x1,'order':_0x70c420[_0x76f6('0x6')]?_0x70c420[_0x76f6('0x6')]['order']||null:null,'group':db[_0x76f6('0x14')][_0x76f6('0x2d')],'transaction':_0x5ba526,'lock':_0x5ba526[_0x76f6('0x25')][_0x76f6('0x42')],'include':_0x70c420[_0x76f6('0x6')]?_0x70c420[_0x76f6('0x6')]['include']?_[_0x76f6('0xa')](_0x70c420[_0x76f6('0x6')][_0x76f6('0xb')],function(_0x41addc){return{'model':db[_0x41addc['model']],'as':_0x41addc['as'],'attributes':_0x41addc[_0x76f6('0x9')],'include':_0x41addc[_0x76f6('0xb')]?_[_0x76f6('0xa')](_0x41addc['include'],function(_0x2c6fb4){return{'model':db[_0x2c6fb4[_0x76f6('0xc')]],'as':_0x2c6fb4['as'],'attributes':_0x2c6fb4['attributes'],'include':_0x2c6fb4[_0x76f6('0xb')]?_[_0x76f6('0xa')](_0x2c6fb4['include'],function(_0x3152fa){return{'model':db[_0x3152fa['model']],'as':_0x3152fa['as'],'attributes':_0x3152fa[_0x76f6('0x9')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3dffa0){var _0x420b22=[];for(var _0xc69216=0x0;_0xc69216<_0x3dffa0[_0x76f6('0x31')];_0xc69216+=0x1){_0x420b22['push'](_0x3dffa0[_0xc69216][_0x76f6('0x1c')](_0x70c420[_0x76f6('0x19')],{'transaction':_0x5ba526}));}return BPromise[_0x76f6('0x30')](_0x420b22);});})['then'](function(_0x5025f9){logger['info'](_0x76f6('0x41'),_0x70c420);logger[_0x76f6('0xf')](_0x76f6('0x41'),_0x70c420,JSON[_0x76f6('0x17')](_0x5025f9));_0x581a9a(_0x5025f9);})[_0x76f6('0x10')](function(_0x1b2c60){logger[_0x76f6('0x11')](_0x76f6('0x41'),_0x1b2c60[_0x76f6('0x12')],_0x70c420);_0x5889be(_0x28deca['error'](0x1f4,_0x1b2c60[_0x76f6('0x12')]));});});});};exports['GetCmHopperPreview']=function(_0x21e54f){var _0x5d073e=this;return new Promise(function(_0x3e9ec0,_0xde1ae9){db[_0x76f6('0x26')][_0x76f6('0x21')]()[_0x76f6('0xd')](function(_0x443908){return db['CmHopper'][_0x76f6('0x5')]({'raw':_0x21e54f['options']?_0x21e54f[_0x76f6('0x6')][_0x76f6('0x7')]===undefined?!![]:![]:!![],'where':_0x21e54f[_0x76f6('0x6')]?_0x21e54f[_0x76f6('0x6')][_0x76f6('0x8')]||null:null,'attributes':_0x21e54f[_0x76f6('0x6')]?_0x21e54f[_0x76f6('0x6')][_0x76f6('0x9')]||null:null,'limit':_0x21e54f[_0x76f6('0x6')]?_0x21e54f['options'][_0x76f6('0x23')]||null:null,'include':_0x21e54f[_0x76f6('0x6')]?_0x21e54f[_0x76f6('0x6')][_0x76f6('0xb')]?_[_0x76f6('0xa')](_0x21e54f[_0x76f6('0x6')]['include'],function(_0x17f0b5){return{'model':db[_0x17f0b5[_0x76f6('0xc')]],'as':_0x17f0b5['as'],'attributes':_0x17f0b5['as']==='Contact'?_[_0x76f6('0x28')](_0x443908):_0x17f0b5[_0x76f6('0x9')],'include':_0x17f0b5[_0x76f6('0xb')]?_[_0x76f6('0xa')](_0x17f0b5[_0x76f6('0xb')],function(_0x439e7e){return{'model':db[_0x439e7e[_0x76f6('0xc')]],'as':_0x439e7e['as'],'attributes':_0x439e7e['attributes'],'include':_0x439e7e['include']?_[_0x76f6('0xa')](_0x439e7e[_0x76f6('0xb')],function(_0x15467b){return{'model':db[_0x15467b['model']],'as':_0x15467b['as'],'attributes':_0x15467b[_0x76f6('0x9')]};}):[]};}):[]};}):[]:[]})[_0x76f6('0xd')](function(_0x23f501){logger['info'](_0x76f6('0xe'),_0x21e54f);logger[_0x76f6('0xf')]('GetCmHopper',_0x21e54f,JSON['stringify'](_0x23f501));_0x3e9ec0(_0x23f501);})['catch'](function(_0x154ead){logger[_0x76f6('0x11')](_0x76f6('0xe'),_0x154ead[_0x76f6('0x12')],_0x21e54f);_0xde1ae9(_0x5d073e[_0x76f6('0x11')](0x1f4,_0x154ead['message']));});});});};exports[_0x76f6('0x43')]=function(_0x26ef3e){var _0x23fa87=this;return new Promise(function(_0xa2c7c8,_0x4aca68){return db[_0x76f6('0x26')][_0x76f6('0x44')]({'raw':!![],'where':{'phone':_0x26ef3e[_0x76f6('0x6')][_0x76f6('0x8')][_0x76f6('0x45')]},'attributes':['id',_0x76f6('0x46')],'order':[['id',_0x76f6('0x47')]]})['then'](function(_0x1079a4){logger[_0x76f6('0x16')](_0x76f6('0x48'),_0x26ef3e);logger[_0x76f6('0xf')]('getContactByPhone',_0x26ef3e,JSON[_0x76f6('0x17')](_0x1079a4));_0xa2c7c8(_0x1079a4);})[_0x76f6('0x10')](function(_0x430cf3){logger[_0x76f6('0x11')](_0x76f6('0x48'),_0x430cf3[_0x76f6('0x12')],_0x26ef3e);_0x4aca68(_0x23fa87[_0x76f6('0x11')](0x1f4,_0x430cf3[_0x76f6('0x12')]));});});};exports[_0x76f6('0x49')]=function(_0xcb9ff6){var _0x27ab80=this;return new Promise(function(_0x3811f6,_0xa6d072){return db[_0x76f6('0x37')][_0x76f6('0x22')](function(_0x5492b7){var _0x436c8b=_0xcb9ff6[_0x76f6('0x6')]&&_0xcb9ff6['options']['where']?_0xcb9ff6['options'][_0x76f6('0x8')]:{};return db[_0x76f6('0x14')][_0x76f6('0x1c')](_0xcb9ff6['body'],{'where':_0x436c8b,'transaction':_0x5492b7})['then'](function(_0x1e7f6b){logger['info']('ResetActiveCalls',_0xcb9ff6);logger[_0x76f6('0xf')](_0x76f6('0x49'),_0xcb9ff6,JSON['stringify'](_0x1e7f6b));_0x3811f6(_0x1e7f6b);})[_0x76f6('0x10')](function(_0x5e8910){logger['error']('ResetActiveCalls',_0x5e8910[_0x76f6('0x12')],_0xcb9ff6);_0xa6d072(_0x27ab80[_0x76f6('0x11')](0x1f4,_0x5e8910[_0x76f6('0x12')]));});});});};exports[_0x76f6('0x4a')]=function(_0x1d36ce){var _0x1fc84a=this;var _0x29e6f1=_0x1d36ce[_0x76f6('0x19')][_0x76f6('0x8')][_0x76f6('0x4b')];var _0x12d292=_0x1d36ce['body'][_0x76f6('0x8')]['interval'];var _0x4b8368=_0x1d36ce[_0x76f6('0x19')]['where'][_0x76f6('0x4c')];return new Promise(function(_0x48894a,_0x3cf94b){return db[_0x76f6('0x14')]['findAll']({'where':{'voiceQueueId':{'$in':_0x29e6f1},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0x76f6('0x37')][_0x76f6('0x3c')](_0x76f6('0x4d')+_0x12d292+_0x76f6('0x4e')),'$gt':db['sequelize'][_0x76f6('0x3c')](_0x76f6('0x4f'))}},'UserId':{'$in':_0x4b8368}},'include':[{'model':db[_0x76f6('0x26')],'as':_0x76f6('0x27')},{'model':db[_0x76f6('0x29')],'as':_0x76f6('0x2a'),'attributes':['id','name',_0x76f6('0x2c')]},{'model':db[_0x76f6('0x50')],'as':_0x76f6('0x51')}]})[_0x76f6('0xd')](function(_0x4660fb){if(_0x4660fb['length']>0x0){return db[_0x76f6('0x37')][_0x76f6('0x22')](function(_0x35cf79){return db[_0x76f6('0x14')][_0x76f6('0x1c')]({'recallmeNotifiedDate':db['sequelize'][_0x76f6('0x3c')]('NOW()')},{'where':{'id':{'$in':_[_0x76f6('0xa')](_0x4660fb,'id')}},'transaction':_0x35cf79})[_0x76f6('0xd')](function(){_0x48894a(_0x4660fb);})[_0x76f6('0x10')](function(_0x4986b2){logger[_0x76f6('0x11')](_0x76f6('0x4a'),_0x4986b2['message'],_0x1d36ce);_0x3cf94b(_0x1fc84a[_0x76f6('0x11')](0x1f4,_0x4986b2[_0x76f6('0x12')]));});})[_0x76f6('0x10')](function(_0x239df2){logger['error'](_0x76f6('0x4a'),_0x239df2['message'],_0x1d36ce);_0x3cf94b(_0x1fc84a[_0x76f6('0x11')](0x1f4,_0x239df2['message']));});}else{_0x48894a(_0x4660fb);}});});};
\ No newline at end of file