Built motion from commit a8c4dd89.|2.6.33
[motion2.git] / server / api / cmHopper / cmHopper.rpc.js
index 0af4a74..f7da19d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-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
+var _0xbc1b=['YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','UserId','LOCK','GetCmHopperPreview','findOne','phone','dialTimezone','getContactByPhone','ResetActiveCalls','interval','availableAgentsIds','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','NOW()','CmList','List','CmHopperHandlePreviewRecallNotifications','lodash','util','moment','bluebird','../../config/logger','rpc','GetCmHopper','CmHopper','findAll','options','raw','where','attributes','limit','include','model','map','then','info','debug','stringify','catch','message','error','ShowCmHopper','find','create','body','CreateCmHopper','UpdateCmHopper','update','active','DestroyCmHopper','destroy','GetContactDialer','describe','transaction','order','UPDATE','CmContact','Contact','User','Agent','name','voicePause','length','includes','push','all','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','ContactId','MoveContactManagedDialer','CmHopperFinal','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','CountReScheduled','sequelize','COUNT','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22'];(function(_0x40c9a2,_0x5b6985){var _0xc879f=function(_0x492976){while(--_0x492976){_0x40c9a2['push'](_0x40c9a2['shift']());}};_0xc879f(++_0x5b6985);}(_0xbc1b,0xb6));var _0xbbc1=function(_0x2e50a2,_0x27f31e){_0x2e50a2=_0x2e50a2-0x0;var _0x47e5de=_0xbc1b[_0x2e50a2];return _0x47e5de;};'use strict';var _=require(_0xbbc1('0x0'));var util=require(_0xbbc1('0x1'));var moment=require(_0xbbc1('0x2'));var BPromise=require(_0xbbc1('0x3'));var db=require('../../mysqldb')['db'];var logger=require(_0xbbc1('0x4'))(_0xbbc1('0x5'));exports[_0xbbc1('0x6')]=function(_0x329a80){var _0x10e61c=this;return new Promise(function(_0x423d3e,_0xd1653b){return db[_0xbbc1('0x7')][_0xbbc1('0x8')]({'raw':_0x329a80[_0xbbc1('0x9')]?_0x329a80[_0xbbc1('0x9')][_0xbbc1('0xa')]===undefined?!![]:![]:!![],'where':_0x329a80[_0xbbc1('0x9')]?_0x329a80[_0xbbc1('0x9')][_0xbbc1('0xb')]||null:null,'attributes':_0x329a80[_0xbbc1('0x9')]?_0x329a80[_0xbbc1('0x9')][_0xbbc1('0xc')]||null:null,'limit':_0x329a80[_0xbbc1('0x9')]?_0x329a80[_0xbbc1('0x9')][_0xbbc1('0xd')]||null:null,'include':_0x329a80['options']?_0x329a80[_0xbbc1('0x9')][_0xbbc1('0xe')]?_['map'](_0x329a80[_0xbbc1('0x9')][_0xbbc1('0xe')],function(_0x4434f9){return{'model':db[_0x4434f9[_0xbbc1('0xf')]],'as':_0x4434f9['as'],'attributes':_0x4434f9[_0xbbc1('0xc')],'include':_0x4434f9['include']?_[_0xbbc1('0x10')](_0x4434f9['include'],function(_0x4fc061){return{'model':db[_0x4fc061[_0xbbc1('0xf')]],'as':_0x4fc061['as'],'attributes':_0x4fc061[_0xbbc1('0xc')],'include':_0x4fc061['include']?_[_0xbbc1('0x10')](_0x4fc061[_0xbbc1('0xe')],function(_0x48ef94){return{'model':db[_0x48ef94[_0xbbc1('0xf')]],'as':_0x48ef94['as'],'attributes':_0x48ef94[_0xbbc1('0xc')]};}):[]};}):[]};}):[]:[]})[_0xbbc1('0x11')](function(_0x15b7da){logger[_0xbbc1('0x12')](_0xbbc1('0x6'),_0x329a80);logger[_0xbbc1('0x13')](_0xbbc1('0x6'),_0x329a80,JSON[_0xbbc1('0x14')](_0x15b7da));_0x423d3e(_0x15b7da);})[_0xbbc1('0x15')](function(_0xa64ea8){logger['error'](_0xbbc1('0x6'),_0xa64ea8[_0xbbc1('0x16')],_0x329a80);_0xd1653b(_0x10e61c[_0xbbc1('0x17')](0x1f4,_0xa64ea8[_0xbbc1('0x16')]));});});};exports[_0xbbc1('0x18')]=function(_0x4a4754){var _0x369bd8=this;return new Promise(function(_0x5f59fc,_0x5d14ee){return db['CmHopper'][_0xbbc1('0x19')]({'raw':_0x4a4754[_0xbbc1('0x9')]?_0x4a4754[_0xbbc1('0x9')][_0xbbc1('0xa')]===undefined?!![]:![]:!![],'where':_0x4a4754[_0xbbc1('0x9')]?_0x4a4754[_0xbbc1('0x9')]['where']||null:null,'attributes':_0x4a4754[_0xbbc1('0x9')]?_0x4a4754['options'][_0xbbc1('0xc')]||null:null,'include':_0x4a4754[_0xbbc1('0x9')]?_0x4a4754[_0xbbc1('0x9')][_0xbbc1('0xe')]?_[_0xbbc1('0x10')](_0x4a4754[_0xbbc1('0x9')]['include'],function(_0x3d6847){return{'model':db[_0x3d6847[_0xbbc1('0xf')]],'as':_0x3d6847['as'],'attributes':_0x3d6847[_0xbbc1('0xc')],'include':_0x3d6847[_0xbbc1('0xe')]?_[_0xbbc1('0x10')](_0x3d6847[_0xbbc1('0xe')],function(_0x5dfb08){return{'model':db[_0x5dfb08['model']],'as':_0x5dfb08['as'],'attributes':_0x5dfb08[_0xbbc1('0xc')],'include':_0x5dfb08[_0xbbc1('0xe')]?_[_0xbbc1('0x10')](_0x5dfb08[_0xbbc1('0xe')],function(_0x45d1f7){return{'model':db[_0x45d1f7[_0xbbc1('0xf')]],'as':_0x45d1f7['as'],'attributes':_0x45d1f7[_0xbbc1('0xc')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x319a3e){logger['info'](_0xbbc1('0x18'),_0x4a4754);logger[_0xbbc1('0x13')]('ShowCmHopper',_0x4a4754,JSON[_0xbbc1('0x14')](_0x319a3e));_0x5f59fc(_0x319a3e);})[_0xbbc1('0x15')](function(_0x4a9750){logger['error']('ShowCmHopper',_0x4a9750['message'],_0x4a4754);_0x5d14ee(_0x369bd8[_0xbbc1('0x17')](0x1f4,_0x4a9750['message']));});});};exports['CreateCmHopper']=function(_0x263cad){var _0x2ce5a0=this;return new Promise(function(_0x1d7321,_0x43c09e){return db['CmHopper'][_0xbbc1('0x1a')](_0x263cad[_0xbbc1('0x1b')],{'raw':_0x263cad['options']?_0x263cad[_0xbbc1('0x9')][_0xbbc1('0xa')]===undefined?!![]:![]:!![]})['then'](function(_0x15d09e){logger[_0xbbc1('0x12')]('CreateCmHopper',_0x263cad);logger[_0xbbc1('0x13')]('CreateCmHopper',_0x263cad,JSON[_0xbbc1('0x14')](_0x15d09e));_0x1d7321(_0x15d09e);})[_0xbbc1('0x15')](function(_0x13fe0e){logger[_0xbbc1('0x17')](_0xbbc1('0x1c'),_0x13fe0e[_0xbbc1('0x16')],_0x263cad);_0x43c09e(_0x2ce5a0[_0xbbc1('0x17')](0x1f4,_0x13fe0e[_0xbbc1('0x16')]));});});};exports[_0xbbc1('0x1d')]=function(_0x2bbb2b){var _0x3a4c10=this;return new Promise(function(_0x9f2c0b,_0x29f62e){return db[_0xbbc1('0x7')][_0xbbc1('0x1e')](_0x2bbb2b[_0xbbc1('0x1b')],{'raw':_0x2bbb2b[_0xbbc1('0x9')]?_0x2bbb2b[_0xbbc1('0x9')][_0xbbc1('0xa')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2bbb2b['options']?_0x2bbb2b[_0xbbc1('0x9')]['where']||null:null,'attributes':_0x2bbb2b['options']?_0x2bbb2b[_0xbbc1('0x9')][_0xbbc1('0xc')]||null:null,'limit':_0x2bbb2b[_0xbbc1('0x9')]?_0x2bbb2b['options'][_0xbbc1('0xd')]||null:null})['then'](function(_0x36f33c){logger[_0xbbc1('0x12')](_0xbbc1('0x1d'),_0x2bbb2b);logger[_0xbbc1('0x12')]('UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON['stringify'](_0x2bbb2b['options'][_0xbbc1('0xb')]),_0x2bbb2b[_0xbbc1('0x1b')][_0xbbc1('0x1f')]);logger['debug']('UpdateCmHopper',_0x2bbb2b,JSON[_0xbbc1('0x14')](_0x36f33c));_0x9f2c0b(_0x36f33c);})['catch'](function(_0x118b49){logger[_0xbbc1('0x17')](_0xbbc1('0x1d'),_0x118b49['message'],_0x2bbb2b);_0x29f62e(_0x3a4c10['error'](0x1f4,_0x118b49[_0xbbc1('0x16')]));});});};exports[_0xbbc1('0x20')]=function(_0x5f1db){var _0x61fd86=this;return new Promise(function(_0x3acc83,_0x57b149){return db[_0xbbc1('0x7')][_0xbbc1('0x21')]({'where':_0x5f1db[_0xbbc1('0x9')]?_0x5f1db[_0xbbc1('0x9')][_0xbbc1('0xb')]||null:null})['then'](function(_0x1cd257){logger[_0xbbc1('0x12')]('DestroyCmHopper',_0x5f1db);logger[_0xbbc1('0x13')](_0xbbc1('0x20'),_0x5f1db,JSON[_0xbbc1('0x14')](_0x1cd257));_0x3acc83(_0x1cd257);})[_0xbbc1('0x15')](function(_0x1c9694){logger[_0xbbc1('0x17')]('DestroyCmHopper',_0x1c9694[_0xbbc1('0x16')],_0x5f1db);_0x57b149(_0x61fd86[_0xbbc1('0x17')](0x1f4,_0x1c9694[_0xbbc1('0x16')]));});});};exports[_0xbbc1('0x22')]=function(_0x178580){var _0x3d53a9=this;return new Promise(function(_0x404895,_0x131da3){return db['CmContact'][_0xbbc1('0x23')]()['then'](function(_0x1d8428){return db['sequelize'][_0xbbc1('0x24')](function(_0x9b7c81){return db['CmHopper'][_0xbbc1('0x8')]({'where':_0x178580[_0xbbc1('0x9')]?_0x178580['options'][_0xbbc1('0xb')]||null:null,'attributes':_0x178580[_0xbbc1('0x9')]?_0x178580[_0xbbc1('0x9')]['attributes']||null:null,'limit':_0x178580['options']?_0x178580[_0xbbc1('0x9')][_0xbbc1('0xd')]||null:null,'order':_0x178580[_0xbbc1('0x9')]?_0x178580[_0xbbc1('0x9')][_0xbbc1('0x25')]||null:null,'transaction':_0x9b7c81,'lock':_0x9b7c81['LOCK'][_0xbbc1('0x26')],'include':[{'model':db[_0xbbc1('0x27')],'as':_0xbbc1('0x28'),'attributes':_['keys'](_0x1d8428)},{'model':db[_0xbbc1('0x29')],'as':_0xbbc1('0x2a'),'attributes':['id',_0xbbc1('0x2b'),_0xbbc1('0x2c')]}]})[_0xbbc1('0x11')](function(_0x47fd4c){var _0x44f45b=[];var _0x3f719f=[];for(var _0x864752=0x0;_0x864752<_0x47fd4c[_0xbbc1('0x2d')];_0x864752+=0x1){var _0x482fd1=_0x47fd4c[_0x864752]['UserId'];if(_0x482fd1===null){_0x44f45b['push'](_0x47fd4c[_0x864752][_0xbbc1('0x1e')](_0x178580[_0xbbc1('0x1b')],{'transaction':_0x9b7c81}));}else if(!_0x3f719f[_0xbbc1('0x2e')](_0x482fd1)){_0x3f719f['push'](_0x482fd1);_0x44f45b[_0xbbc1('0x2f')](_0x47fd4c[_0x864752][_0xbbc1('0x1e')](_0x178580[_0xbbc1('0x1b')],{'transaction':_0x9b7c81}));}}return BPromise[_0xbbc1('0x30')](_0x44f45b);});})[_0xbbc1('0x11')](function(_0x3220ac){logger['info'](_0xbbc1('0x22'),_0x178580);if(_0x3220ac[_0xbbc1('0x2d')]>0x0){logger['info'](_0xbbc1('0x31'),_0x3220ac[0x0]['dataValues']['id'],_0x3220ac[0x0]['dataValues'][_0xbbc1('0x32')],_0x3220ac[0x0]['dataValues'][_0xbbc1('0x1f')]);}logger['debug'](_0xbbc1('0x22'),_0x178580,JSON['stringify'](_0x3220ac));_0x404895(_0x3220ac);})[_0xbbc1('0x15')](function(_0x58e3a8){logger[_0xbbc1('0x17')](_0xbbc1('0x22'),_0x58e3a8['message'],_0x178580);_0x131da3(_0x3d53a9['error'](0x1f4,_0x58e3a8[_0xbbc1('0x16')]));});});});};exports[_0xbbc1('0x33')]=function(_0x2b0fe6){var _0x4ac138=this;return new Promise(function(_0x587cb4,_0x39678a){return db['sequelize'][_0xbbc1('0x24')](function(_0x2abd27){return db[_0xbbc1('0x34')][_0xbbc1('0x1a')](_0x2b0fe6[_0xbbc1('0x1b')],{'raw':_0x2b0fe6[_0xbbc1('0x9')]?_0x2b0fe6[_0xbbc1('0x9')]['raw']===undefined?!![]:![]:!![],'transaction':_0x2abd27})[_0xbbc1('0x11')](function(){logger['info'](_0xbbc1('0x35'),JSON['stringify'](_0x2b0fe6[_0xbbc1('0x9')][_0xbbc1('0xb')]),_0x2b0fe6[_0xbbc1('0x9')][_0xbbc1('0xb')][_0xbbc1('0x1f')]);return db[_0xbbc1('0x7')][_0xbbc1('0x21')]({'where':_0x2b0fe6[_0xbbc1('0x9')]?_0x2b0fe6[_0xbbc1('0x9')][_0xbbc1('0xb')]||null:null,'transaction':_0x2abd27});});})[_0xbbc1('0x11')](function(_0x46cde8){logger['info'](_0xbbc1('0x33'),_0x2b0fe6);logger[_0xbbc1('0x13')](_0xbbc1('0x33'),_0x2b0fe6,JSON[_0xbbc1('0x14')](_0x46cde8));_0x587cb4(_0x46cde8);})[_0xbbc1('0x15')](function(_0x1bab72){logger[_0xbbc1('0x17')](_0xbbc1('0x33'),_0x1bab72['message'],_0x2b0fe6);_0x39678a(_0x4ac138[_0xbbc1('0x17')](0x1f4,_0x1bab72[_0xbbc1('0x16')]));});});};exports[_0xbbc1('0x36')]=function(_0xa893ad){var _0x4c5594=this;return new Promise(function(_0x2e6326,_0xcfac27){return db[_0xbbc1('0x7')][_0xbbc1('0x8')]({'raw':_0xa893ad[_0xbbc1('0x9')]?_0xa893ad[_0xbbc1('0x9')][_0xbbc1('0xa')]===undefined?!![]:![]:!![],'where':_0xa893ad[_0xbbc1('0x9')]?_0xa893ad[_0xbbc1('0x9')][_0xbbc1('0xb')]||null:null,'attributes':[[db[_0xbbc1('0x37')]['fn'](_0xbbc1('0x38'),db['sequelize']['fn']('IF',db[_0xbbc1('0x37')][_0xbbc1('0x39')](_0xbbc1('0x3a')+util[_0xbbc1('0x3b')](_0xbbc1('0x3c'),moment()[_0xbbc1('0x3b')](_0xbbc1('0x3d')))+_0xbbc1('0x3e')))),_0xbbc1('0x3f')]]})['then'](function(_0x564b3b){logger['info'](_0xbbc1('0x36'),_0xa893ad);logger[_0xbbc1('0x13')](_0xbbc1('0x36'),_0xa893ad,JSON[_0xbbc1('0x14')](_0x564b3b));_0x2e6326(_0x564b3b);})[_0xbbc1('0x15')](function(_0x474e81){logger[_0xbbc1('0x17')](_0xbbc1('0x36'),_0x474e81['message'],_0xa893ad);_0xcfac27(_0x4c5594['error'](0x1f4,_0x474e81[_0xbbc1('0x16')]));});});};exports[_0xbbc1('0x40')]=function(_0x326b39){var _0x1838e7=this;return new Promise(function(_0x23bbe9,_0x4bb450){return db['CmContact'][_0xbbc1('0x23')]()[_0xbbc1('0x11')](function(){return db['sequelize'][_0xbbc1('0x24')](function(_0x35ea6c){return db[_0xbbc1('0x7')]['findAll']({'where':_0x326b39['options']?_0x326b39[_0xbbc1('0x9')][_0xbbc1('0xb')]||null:null,'attributes':_0x326b39[_0xbbc1('0x9')]?_0x326b39[_0xbbc1('0x9')][_0xbbc1('0xc')]||null:null,'limit':0x1,'order':_0x326b39['options']?_0x326b39[_0xbbc1('0x9')][_0xbbc1('0x25')]||null:null,'group':db['CmHopper'][_0xbbc1('0x41')],'transaction':_0x35ea6c,'lock':_0x35ea6c[_0xbbc1('0x42')]['UPDATE'],'include':_0x326b39[_0xbbc1('0x9')]?_0x326b39[_0xbbc1('0x9')]['include']?_['map'](_0x326b39['options'][_0xbbc1('0xe')],function(_0x27b084){return{'model':db[_0x27b084[_0xbbc1('0xf')]],'as':_0x27b084['as'],'attributes':_0x27b084[_0xbbc1('0xc')],'include':_0x27b084[_0xbbc1('0xe')]?_[_0xbbc1('0x10')](_0x27b084[_0xbbc1('0xe')],function(_0x16e668){return{'model':db[_0x16e668[_0xbbc1('0xf')]],'as':_0x16e668['as'],'attributes':_0x16e668[_0xbbc1('0xc')],'include':_0x16e668['include']?_[_0xbbc1('0x10')](_0x16e668['include'],function(_0x266839){return{'model':db[_0x266839['model']],'as':_0x266839['as'],'attributes':_0x266839[_0xbbc1('0xc')]};}):[]};}):[]};}):[]:[]})[_0xbbc1('0x11')](function(_0x339179){var _0x5a1392=[];for(var _0x355f7c=0x0;_0x355f7c<_0x339179['length'];_0x355f7c+=0x1){_0x5a1392['push'](_0x339179[_0x355f7c][_0xbbc1('0x1e')](_0x326b39['body'],{'transaction':_0x35ea6c}));}return BPromise[_0xbbc1('0x30')](_0x5a1392);});})[_0xbbc1('0x11')](function(_0x19f5ee){logger['info'](_0xbbc1('0x40'),_0x326b39);logger[_0xbbc1('0x13')](_0xbbc1('0x40'),_0x326b39,JSON[_0xbbc1('0x14')](_0x19f5ee));_0x23bbe9(_0x19f5ee);})['catch'](function(_0x4e761f){logger[_0xbbc1('0x17')](_0xbbc1('0x40'),_0x4e761f[_0xbbc1('0x16')],_0x326b39);_0x4bb450(_0x1838e7[_0xbbc1('0x17')](0x1f4,_0x4e761f[_0xbbc1('0x16')]));});});});};exports[_0xbbc1('0x43')]=function(_0x2cf518){var _0x2a63f2=this;return new Promise(function(_0x3b4496,_0x48f49d){db['CmContact'][_0xbbc1('0x23')]()[_0xbbc1('0x11')](function(_0x1b0718){return db[_0xbbc1('0x7')][_0xbbc1('0x8')]({'raw':_0x2cf518[_0xbbc1('0x9')]?_0x2cf518[_0xbbc1('0x9')]['raw']===undefined?!![]:![]:!![],'where':_0x2cf518[_0xbbc1('0x9')]?_0x2cf518[_0xbbc1('0x9')][_0xbbc1('0xb')]||null:null,'attributes':_0x2cf518[_0xbbc1('0x9')]?_0x2cf518['options']['attributes']||null:null,'limit':_0x2cf518[_0xbbc1('0x9')]?_0x2cf518[_0xbbc1('0x9')][_0xbbc1('0xd')]||null:null,'include':_0x2cf518[_0xbbc1('0x9')]?_0x2cf518['options'][_0xbbc1('0xe')]?_[_0xbbc1('0x10')](_0x2cf518[_0xbbc1('0x9')]['include'],function(_0x13a7a9){return{'model':db[_0x13a7a9[_0xbbc1('0xf')]],'as':_0x13a7a9['as'],'attributes':_0x13a7a9['as']===_0xbbc1('0x28')?_['keys'](_0x1b0718):_0x13a7a9[_0xbbc1('0xc')],'include':_0x13a7a9[_0xbbc1('0xe')]?_[_0xbbc1('0x10')](_0x13a7a9[_0xbbc1('0xe')],function(_0x182079){return{'model':db[_0x182079[_0xbbc1('0xf')]],'as':_0x182079['as'],'attributes':_0x182079[_0xbbc1('0xc')],'include':_0x182079[_0xbbc1('0xe')]?_[_0xbbc1('0x10')](_0x182079[_0xbbc1('0xe')],function(_0x5558d9){return{'model':db[_0x5558d9[_0xbbc1('0xf')]],'as':_0x5558d9['as'],'attributes':_0x5558d9[_0xbbc1('0xc')]};}):[]};}):[]};}):[]:[]})[_0xbbc1('0x11')](function(_0x24ab42){logger[_0xbbc1('0x12')](_0xbbc1('0x6'),_0x2cf518);logger[_0xbbc1('0x13')]('GetCmHopper',_0x2cf518,JSON[_0xbbc1('0x14')](_0x24ab42));_0x3b4496(_0x24ab42);})[_0xbbc1('0x15')](function(_0x357619){logger[_0xbbc1('0x17')](_0xbbc1('0x6'),_0x357619['message'],_0x2cf518);_0x48f49d(_0x2a63f2['error'](0x1f4,_0x357619[_0xbbc1('0x16')]));});});});};exports['GetContactByPhone']=function(_0x407cd4){var _0x341a86=this;return new Promise(function(_0xcdbfec,_0x191c7a){return db['CmContact'][_0xbbc1('0x44')]({'raw':!![],'where':{'phone':_0x407cd4['options'][_0xbbc1('0xb')][_0xbbc1('0x45')]},'attributes':['id',_0xbbc1('0x46')],'order':[['id','DESC']]})[_0xbbc1('0x11')](function(_0x4a2aa0){logger[_0xbbc1('0x12')]('getContactByPhone',_0x407cd4);logger[_0xbbc1('0x13')](_0xbbc1('0x47'),_0x407cd4,JSON[_0xbbc1('0x14')](_0x4a2aa0));_0xcdbfec(_0x4a2aa0);})[_0xbbc1('0x15')](function(_0x31832d){logger[_0xbbc1('0x17')]('getContactByPhone',_0x31832d[_0xbbc1('0x16')],_0x407cd4);_0x191c7a(_0x341a86['error'](0x1f4,_0x31832d[_0xbbc1('0x16')]));});});};exports[_0xbbc1('0x48')]=function(_0x2e3fa4){var _0x5bea06=this;return new Promise(function(_0x201d67,_0x68559d){return db[_0xbbc1('0x37')][_0xbbc1('0x24')](function(_0xf09044){var _0x1e4fbf=_0x2e3fa4[_0xbbc1('0x9')]&&_0x2e3fa4[_0xbbc1('0x9')][_0xbbc1('0xb')]?_0x2e3fa4[_0xbbc1('0x9')][_0xbbc1('0xb')]:{};return db[_0xbbc1('0x7')][_0xbbc1('0x1e')](_0x2e3fa4['body'],{'where':_0x1e4fbf,'transaction':_0xf09044})['then'](function(_0x8aeba2){logger['info']('ResetActiveCalls',_0x2e3fa4);logger['debug'](_0xbbc1('0x48'),_0x2e3fa4,JSON['stringify'](_0x8aeba2));_0x201d67(_0x8aeba2);})[_0xbbc1('0x15')](function(_0x4246aa){logger['error'](_0xbbc1('0x48'),_0x4246aa['message'],_0x2e3fa4);_0x68559d(_0x5bea06[_0xbbc1('0x17')](0x1f4,_0x4246aa['message']));});});});};exports['CmHopperHandlePreviewRecallNotifications']=function(_0x50fa21){var _0x135a7e=this;var _0x40dd9e=_0x50fa21[_0xbbc1('0x1b')][_0xbbc1('0xb')]['voiceQueueIds'];var _0x3007bb=_0x50fa21[_0xbbc1('0x1b')][_0xbbc1('0xb')][_0xbbc1('0x49')];var _0x4b5a1c=_0x50fa21[_0xbbc1('0x1b')][_0xbbc1('0xb')][_0xbbc1('0x4a')];return new Promise(function(_0x21ff2f,_0x6f1024){return db[_0xbbc1('0x7')][_0xbbc1('0x8')]({'where':{'voiceQueueId':{'$in':_0x40dd9e},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db['sequelize']['literal'](_0xbbc1('0x4b')+_0x3007bb+_0xbbc1('0x4c')),'$gt':db[_0xbbc1('0x37')][_0xbbc1('0x39')](_0xbbc1('0x4d'))}},'UserId':{'$in':_0x4b5a1c}},'include':[{'model':db[_0xbbc1('0x27')],'as':_0xbbc1('0x28')},{'model':db['User'],'as':_0xbbc1('0x2a'),'attributes':['id',_0xbbc1('0x2b'),_0xbbc1('0x2c')]},{'model':db[_0xbbc1('0x4e')],'as':_0xbbc1('0x4f')}]})['then'](function(_0x112f01){if(_0x112f01[_0xbbc1('0x2d')]>0x0){return db[_0xbbc1('0x37')][_0xbbc1('0x24')](function(_0x514034){return db[_0xbbc1('0x7')][_0xbbc1('0x1e')]({'recallmeNotifiedDate':db['sequelize'][_0xbbc1('0x39')](_0xbbc1('0x4d'))},{'where':{'id':{'$in':_['map'](_0x112f01,'id')}},'transaction':_0x514034})['then'](function(){_0x21ff2f(_0x112f01);})[_0xbbc1('0x15')](function(_0x1c4540){logger[_0xbbc1('0x17')](_0xbbc1('0x50'),_0x1c4540[_0xbbc1('0x16')],_0x50fa21);_0x6f1024(_0x135a7e['error'](0x1f4,_0x1c4540[_0xbbc1('0x16')]));});})[_0xbbc1('0x15')](function(_0xc89939){logger[_0xbbc1('0x17')]('CmHopperHandlePreviewRecallNotifications',_0xc89939['message'],_0x50fa21);_0x6f1024(_0x135a7e[_0xbbc1('0x17')](0x1f4,_0xc89939['message']));});}else{_0x21ff2f(_0x112f01);}});});};
\ No newline at end of file