Built motion from commit bbec7235.|2.6.20
[motion2.git] / server / api / cmHopper / cmHopper.rpc.js
index ef870c2..182f6d8 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8ae9=['raw','attributes','limit','include','model','map','then','debug','stringify','message','error','find','info','ShowCmHopper','CreateCmHopper','body','UpdateCmHopper','update','where','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','catch','DestroyCmHopper','GetContactDialer','CmContact','describe','sequelize','transaction','UPDATE','keys','User','Agent','name','voicePause','length','UserId','push','includes','all','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','MoveContactManagedDialer','CmHopperFinal','create','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','CountReScheduled','COUNT','literal','\x22%s\x22','format','YYYY-MM-DD\x20HH:mm:ss','GetContactRecallMe','order','LOCK','GetCmHopperPreview','Contact','GetContactByPhone','phone','dialTimezone','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueIds','interval','availableAgentsIds','NOW()\x20+\x20INTERVAL\x20','CmList','List','lodash','util','../../config/logger','rpc','GetCmHopper','CmHopper','findAll','options'];(function(_0xa052d4,_0x88006f){var _0x3f56b9=function(_0x5554d7){while(--_0x5554d7){_0xa052d4['push'](_0xa052d4['shift']());}};_0x3f56b9(++_0x88006f);}(_0x8ae9,0x179));var _0x98ae=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x8ae9[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x98ae('0x0'));var util=require(_0x98ae('0x1'));var moment=require('moment');var BPromise=require('bluebird');var db=require('../../mysqldb')['db'];var logger=require(_0x98ae('0x2'))(_0x98ae('0x3'));exports[_0x98ae('0x4')]=function(_0x5a6b34){var _0x4eea43=this;return new Promise(function(_0x1423b7,_0x45d5ad){return db[_0x98ae('0x5')][_0x98ae('0x6')]({'raw':_0x5a6b34['options']?_0x5a6b34[_0x98ae('0x7')][_0x98ae('0x8')]===undefined?!![]:![]:!![],'where':_0x5a6b34[_0x98ae('0x7')]?_0x5a6b34[_0x98ae('0x7')]['where']||null:null,'attributes':_0x5a6b34[_0x98ae('0x7')]?_0x5a6b34[_0x98ae('0x7')][_0x98ae('0x9')]||null:null,'limit':_0x5a6b34[_0x98ae('0x7')]?_0x5a6b34[_0x98ae('0x7')][_0x98ae('0xa')]||null:null,'include':_0x5a6b34[_0x98ae('0x7')]?_0x5a6b34[_0x98ae('0x7')][_0x98ae('0xb')]?_['map'](_0x5a6b34[_0x98ae('0x7')][_0x98ae('0xb')],function(_0x51918e){return{'model':db[_0x51918e[_0x98ae('0xc')]],'as':_0x51918e['as'],'attributes':_0x51918e[_0x98ae('0x9')],'include':_0x51918e[_0x98ae('0xb')]?_[_0x98ae('0xd')](_0x51918e['include'],function(_0x3bb1e9){return{'model':db[_0x3bb1e9[_0x98ae('0xc')]],'as':_0x3bb1e9['as'],'attributes':_0x3bb1e9['attributes'],'include':_0x3bb1e9[_0x98ae('0xb')]?_[_0x98ae('0xd')](_0x3bb1e9[_0x98ae('0xb')],function(_0x5e7578){return{'model':db[_0x5e7578[_0x98ae('0xc')]],'as':_0x5e7578['as'],'attributes':_0x5e7578['attributes']};}):[]};}):[]};}):[]:[]})[_0x98ae('0xe')](function(_0x530b86){logger['info'](_0x98ae('0x4'),_0x5a6b34);logger[_0x98ae('0xf')](_0x98ae('0x4'),_0x5a6b34,JSON[_0x98ae('0x10')](_0x530b86));_0x1423b7(_0x530b86);})['catch'](function(_0xb45dff){logger['error'](_0x98ae('0x4'),_0xb45dff[_0x98ae('0x11')],_0x5a6b34);_0x45d5ad(_0x4eea43[_0x98ae('0x12')](0x1f4,_0xb45dff['message']));});});};exports['ShowCmHopper']=function(_0x1f90c2){var _0x328382=this;return new Promise(function(_0x445ad0,_0x521314){return db[_0x98ae('0x5')][_0x98ae('0x13')]({'raw':_0x1f90c2[_0x98ae('0x7')]?_0x1f90c2['options'][_0x98ae('0x8')]===undefined?!![]:![]:!![],'where':_0x1f90c2[_0x98ae('0x7')]?_0x1f90c2[_0x98ae('0x7')]['where']||null:null,'attributes':_0x1f90c2['options']?_0x1f90c2[_0x98ae('0x7')][_0x98ae('0x9')]||null:null,'include':_0x1f90c2[_0x98ae('0x7')]?_0x1f90c2['options'][_0x98ae('0xb')]?_[_0x98ae('0xd')](_0x1f90c2[_0x98ae('0x7')]['include'],function(_0xe43740){return{'model':db[_0xe43740[_0x98ae('0xc')]],'as':_0xe43740['as'],'attributes':_0xe43740['attributes'],'include':_0xe43740['include']?_['map'](_0xe43740['include'],function(_0x3f308e){return{'model':db[_0x3f308e[_0x98ae('0xc')]],'as':_0x3f308e['as'],'attributes':_0x3f308e[_0x98ae('0x9')],'include':_0x3f308e[_0x98ae('0xb')]?_['map'](_0x3f308e['include'],function(_0x43b883){return{'model':db[_0x43b883[_0x98ae('0xc')]],'as':_0x43b883['as'],'attributes':_0x43b883[_0x98ae('0x9')]};}):[]};}):[]};}):[]:[]})[_0x98ae('0xe')](function(_0xd42fa){logger[_0x98ae('0x14')](_0x98ae('0x15'),_0x1f90c2);logger[_0x98ae('0xf')](_0x98ae('0x15'),_0x1f90c2,JSON[_0x98ae('0x10')](_0xd42fa));_0x445ad0(_0xd42fa);})['catch'](function(_0xbb54e){logger[_0x98ae('0x12')]('ShowCmHopper',_0xbb54e['message'],_0x1f90c2);_0x521314(_0x328382[_0x98ae('0x12')](0x1f4,_0xbb54e[_0x98ae('0x11')]));});});};exports[_0x98ae('0x16')]=function(_0x2a3950){var _0x3202b1=this;return new Promise(function(_0x3fa925,_0x2e8d6c){return db[_0x98ae('0x5')]['create'](_0x2a3950[_0x98ae('0x17')],{'raw':_0x2a3950[_0x98ae('0x7')]?_0x2a3950[_0x98ae('0x7')][_0x98ae('0x8')]===undefined?!![]:![]:!![]})[_0x98ae('0xe')](function(_0x278bdd){logger['info'](_0x98ae('0x16'),_0x2a3950);logger[_0x98ae('0xf')](_0x98ae('0x16'),_0x2a3950,JSON[_0x98ae('0x10')](_0x278bdd));_0x3fa925(_0x278bdd);})['catch'](function(_0x10cfcd){logger['error'](_0x98ae('0x16'),_0x10cfcd[_0x98ae('0x11')],_0x2a3950);_0x2e8d6c(_0x3202b1['error'](0x1f4,_0x10cfcd[_0x98ae('0x11')]));});});};exports[_0x98ae('0x18')]=function(_0x522c66){var _0x276d02=this;return new Promise(function(_0x2d7008,_0x5f290f){return db[_0x98ae('0x5')][_0x98ae('0x19')](_0x522c66[_0x98ae('0x17')],{'raw':_0x522c66[_0x98ae('0x7')]?_0x522c66[_0x98ae('0x7')][_0x98ae('0x8')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x522c66[_0x98ae('0x7')]?_0x522c66['options'][_0x98ae('0x1a')]||null:null,'attributes':_0x522c66[_0x98ae('0x7')]?_0x522c66['options'][_0x98ae('0x9')]||null:null,'limit':_0x522c66['options']?_0x522c66[_0x98ae('0x7')][_0x98ae('0xa')]||null:null})[_0x98ae('0xe')](function(_0xe0e73e){logger[_0x98ae('0x14')](_0x98ae('0x18'),_0x522c66);logger[_0x98ae('0x14')](_0x98ae('0x1b'),JSON[_0x98ae('0x10')](_0x522c66[_0x98ae('0x7')]['where']),_0x522c66[_0x98ae('0x17')][_0x98ae('0x1c')]);logger['debug'](_0x98ae('0x18'),_0x522c66,JSON['stringify'](_0xe0e73e));_0x2d7008(_0xe0e73e);})[_0x98ae('0x1d')](function(_0x597d8f){logger[_0x98ae('0x12')]('UpdateCmHopper',_0x597d8f[_0x98ae('0x11')],_0x522c66);_0x5f290f(_0x276d02[_0x98ae('0x12')](0x1f4,_0x597d8f[_0x98ae('0x11')]));});});};exports[_0x98ae('0x1e')]=function(_0x541730){var _0x3ddf84=this;return new Promise(function(_0x3f7d52,_0x5288fe){return db['CmHopper']['destroy']({'where':_0x541730['options']?_0x541730[_0x98ae('0x7')][_0x98ae('0x1a')]||null:null})[_0x98ae('0xe')](function(_0x481504){logger[_0x98ae('0x14')]('DestroyCmHopper',_0x541730);logger[_0x98ae('0xf')](_0x98ae('0x1e'),_0x541730,JSON[_0x98ae('0x10')](_0x481504));_0x3f7d52(_0x481504);})[_0x98ae('0x1d')](function(_0xeecc14){logger[_0x98ae('0x12')]('DestroyCmHopper',_0xeecc14[_0x98ae('0x11')],_0x541730);_0x5288fe(_0x3ddf84['error'](0x1f4,_0xeecc14[_0x98ae('0x11')]));});});};exports[_0x98ae('0x1f')]=function(_0x47c8ad){var _0x236a01=this;return new Promise(function(_0x11edaf,_0x9dbceb){return db[_0x98ae('0x20')][_0x98ae('0x21')]()[_0x98ae('0xe')](function(_0x105be9){return db[_0x98ae('0x22')][_0x98ae('0x23')](function(_0x37f9b1){return db[_0x98ae('0x5')]['findAll']({'where':_0x47c8ad[_0x98ae('0x7')]?_0x47c8ad['options'][_0x98ae('0x1a')]||null:null,'attributes':_0x47c8ad[_0x98ae('0x7')]?_0x47c8ad[_0x98ae('0x7')][_0x98ae('0x9')]||null:null,'limit':_0x47c8ad[_0x98ae('0x7')]?_0x47c8ad[_0x98ae('0x7')][_0x98ae('0xa')]||null:null,'order':_0x47c8ad['options']?_0x47c8ad[_0x98ae('0x7')]['order']||null:null,'transaction':_0x37f9b1,'lock':_0x37f9b1['LOCK'][_0x98ae('0x24')],'include':[{'model':db[_0x98ae('0x20')],'as':'Contact','attributes':_[_0x98ae('0x25')](_0x105be9)},{'model':db[_0x98ae('0x26')],'as':_0x98ae('0x27'),'attributes':['id',_0x98ae('0x28'),_0x98ae('0x29')]}]})['then'](function(_0x5166e1){var _0x565627=[];var _0x40ea49=[];for(var _0x285394=0x0;_0x285394<_0x5166e1[_0x98ae('0x2a')];_0x285394+=0x1){var _0x1408c6=_0x5166e1[_0x285394][_0x98ae('0x2b')];if(_0x1408c6===null){_0x565627[_0x98ae('0x2c')](_0x5166e1[_0x285394][_0x98ae('0x19')](_0x47c8ad[_0x98ae('0x17')],{'transaction':_0x37f9b1}));}else if(!_0x40ea49[_0x98ae('0x2d')](_0x1408c6)){_0x40ea49[_0x98ae('0x2c')](_0x1408c6);_0x565627[_0x98ae('0x2c')](_0x5166e1[_0x285394][_0x98ae('0x19')](_0x47c8ad['body'],{'transaction':_0x37f9b1}));}}return BPromise[_0x98ae('0x2e')](_0x565627);});})['then'](function(_0x3b8cda){logger[_0x98ae('0x14')](_0x98ae('0x1f'),_0x47c8ad);if(_0x3b8cda[_0x98ae('0x2a')]>0x0){logger[_0x98ae('0x14')](_0x98ae('0x2f'),_0x3b8cda[0x0][_0x98ae('0x30')]['id'],_0x3b8cda[0x0][_0x98ae('0x30')][_0x98ae('0x31')],_0x3b8cda[0x0][_0x98ae('0x30')][_0x98ae('0x1c')]);}logger[_0x98ae('0xf')](_0x98ae('0x1f'),_0x47c8ad,JSON[_0x98ae('0x10')](_0x3b8cda));_0x11edaf(_0x3b8cda);})['catch'](function(_0x4a8c41){logger[_0x98ae('0x12')](_0x98ae('0x1f'),_0x4a8c41[_0x98ae('0x11')],_0x47c8ad);_0x9dbceb(_0x236a01[_0x98ae('0x12')](0x1f4,_0x4a8c41[_0x98ae('0x11')]));});});});};exports[_0x98ae('0x32')]=function(_0x1ea1de){var _0x400477=this;return new Promise(function(_0x370072,_0x18b1cc){return db[_0x98ae('0x22')][_0x98ae('0x23')](function(_0x204b9c){return db[_0x98ae('0x33')][_0x98ae('0x34')](_0x1ea1de[_0x98ae('0x17')],{'raw':_0x1ea1de[_0x98ae('0x7')]?_0x1ea1de[_0x98ae('0x7')][_0x98ae('0x8')]===undefined?!![]:![]:!![],'transaction':_0x204b9c})[_0x98ae('0xe')](function(){logger[_0x98ae('0x14')](_0x98ae('0x35'),JSON[_0x98ae('0x10')](_0x1ea1de[_0x98ae('0x7')][_0x98ae('0x1a')]),_0x1ea1de[_0x98ae('0x7')]['where'][_0x98ae('0x1c')]);return db['CmHopper']['destroy']({'where':_0x1ea1de[_0x98ae('0x7')]?_0x1ea1de[_0x98ae('0x7')][_0x98ae('0x1a')]||null:null,'transaction':_0x204b9c});});})['then'](function(_0x59656a){logger[_0x98ae('0x14')]('MoveContactManagedDialer',_0x1ea1de);logger[_0x98ae('0xf')](_0x98ae('0x32'),_0x1ea1de,JSON[_0x98ae('0x10')](_0x59656a));_0x370072(_0x59656a);})[_0x98ae('0x1d')](function(_0x40eacb){logger[_0x98ae('0x12')](_0x98ae('0x32'),_0x40eacb[_0x98ae('0x11')],_0x1ea1de);_0x18b1cc(_0x400477['error'](0x1f4,_0x40eacb[_0x98ae('0x11')]));});});};exports[_0x98ae('0x36')]=function(_0x3a723a){var _0x4f007d=this;return new Promise(function(_0xb58176,_0xab8d04){return db[_0x98ae('0x5')][_0x98ae('0x6')]({'raw':_0x3a723a[_0x98ae('0x7')]?_0x3a723a[_0x98ae('0x7')][_0x98ae('0x8')]===undefined?!![]:![]:!![],'where':_0x3a723a['options']?_0x3a723a['options'][_0x98ae('0x1a')]||null:null,'attributes':[[db[_0x98ae('0x22')]['fn'](_0x98ae('0x37'),db[_0x98ae('0x22')]['fn']('IF',db[_0x98ae('0x22')][_0x98ae('0x38')]('`scheduledat`\x20>=\x20'+util['format'](_0x98ae('0x39'),moment()[_0x98ae('0x3a')](_0x98ae('0x3b')))+'\x20,\x201,\x20null'))),'contactsRescheduled']]})[_0x98ae('0xe')](function(_0x57e0ab){logger['info'](_0x98ae('0x36'),_0x3a723a);logger[_0x98ae('0xf')]('CountReScheduled',_0x3a723a,JSON['stringify'](_0x57e0ab));_0xb58176(_0x57e0ab);})[_0x98ae('0x1d')](function(_0xc04a27){logger[_0x98ae('0x12')](_0x98ae('0x36'),_0xc04a27['message'],_0x3a723a);_0xab8d04(_0x4f007d[_0x98ae('0x12')](0x1f4,_0xc04a27[_0x98ae('0x11')]));});});};exports[_0x98ae('0x3c')]=function(_0x18041a){var _0xe088f5=this;return new Promise(function(_0x24b5f7,_0x5cb7eb){return db['CmContact'][_0x98ae('0x21')]()[_0x98ae('0xe')](function(){return db['sequelize']['transaction'](function(_0xe9a5f1){return db[_0x98ae('0x5')][_0x98ae('0x6')]({'where':_0x18041a[_0x98ae('0x7')]?_0x18041a['options'][_0x98ae('0x1a')]||null:null,'attributes':_0x18041a['options']?_0x18041a[_0x98ae('0x7')][_0x98ae('0x9')]||null:null,'limit':0x1,'order':_0x18041a[_0x98ae('0x7')]?_0x18041a['options'][_0x98ae('0x3d')]||null:null,'group':db[_0x98ae('0x5')][_0x98ae('0x2b')],'transaction':_0xe9a5f1,'lock':_0xe9a5f1[_0x98ae('0x3e')][_0x98ae('0x24')],'include':_0x18041a[_0x98ae('0x7')]?_0x18041a[_0x98ae('0x7')][_0x98ae('0xb')]?_[_0x98ae('0xd')](_0x18041a[_0x98ae('0x7')][_0x98ae('0xb')],function(_0x5e1dc8){return{'model':db[_0x5e1dc8[_0x98ae('0xc')]],'as':_0x5e1dc8['as'],'attributes':_0x5e1dc8[_0x98ae('0x9')],'include':_0x5e1dc8['include']?_[_0x98ae('0xd')](_0x5e1dc8[_0x98ae('0xb')],function(_0xe6929e){return{'model':db[_0xe6929e[_0x98ae('0xc')]],'as':_0xe6929e['as'],'attributes':_0xe6929e[_0x98ae('0x9')],'include':_0xe6929e['include']?_[_0x98ae('0xd')](_0xe6929e['include'],function(_0x1eeed6){return{'model':db[_0x1eeed6[_0x98ae('0xc')]],'as':_0x1eeed6['as'],'attributes':_0x1eeed6['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x533e8a){var _0x3649e7=[];for(var _0x28cd72=0x0;_0x28cd72<_0x533e8a[_0x98ae('0x2a')];_0x28cd72+=0x1){_0x3649e7[_0x98ae('0x2c')](_0x533e8a[_0x28cd72][_0x98ae('0x19')](_0x18041a[_0x98ae('0x17')],{'transaction':_0xe9a5f1}));}return BPromise['all'](_0x3649e7);});})[_0x98ae('0xe')](function(_0x5be3c5){logger[_0x98ae('0x14')](_0x98ae('0x3c'),_0x18041a);logger[_0x98ae('0xf')](_0x98ae('0x3c'),_0x18041a,JSON[_0x98ae('0x10')](_0x5be3c5));_0x24b5f7(_0x5be3c5);})[_0x98ae('0x1d')](function(_0xa35669){logger[_0x98ae('0x12')](_0x98ae('0x3c'),_0xa35669[_0x98ae('0x11')],_0x18041a);_0x5cb7eb(_0xe088f5[_0x98ae('0x12')](0x1f4,_0xa35669[_0x98ae('0x11')]));});});});};exports[_0x98ae('0x3f')]=function(_0x4400a8){var _0x3e950e=this;return new Promise(function(_0x3befa4,_0x4ba27d){db[_0x98ae('0x20')][_0x98ae('0x21')]()['then'](function(_0x5edef4){return db[_0x98ae('0x5')][_0x98ae('0x6')]({'raw':_0x4400a8[_0x98ae('0x7')]?_0x4400a8['options'][_0x98ae('0x8')]===undefined?!![]:![]:!![],'where':_0x4400a8[_0x98ae('0x7')]?_0x4400a8['options'][_0x98ae('0x1a')]||null:null,'attributes':_0x4400a8[_0x98ae('0x7')]?_0x4400a8[_0x98ae('0x7')][_0x98ae('0x9')]||null:null,'limit':_0x4400a8[_0x98ae('0x7')]?_0x4400a8['options'][_0x98ae('0xa')]||null:null,'include':_0x4400a8[_0x98ae('0x7')]?_0x4400a8[_0x98ae('0x7')]['include']?_[_0x98ae('0xd')](_0x4400a8['options'][_0x98ae('0xb')],function(_0x3cf593){return{'model':db[_0x3cf593['model']],'as':_0x3cf593['as'],'attributes':_0x3cf593['as']===_0x98ae('0x40')?_[_0x98ae('0x25')](_0x5edef4):_0x3cf593[_0x98ae('0x9')],'include':_0x3cf593[_0x98ae('0xb')]?_[_0x98ae('0xd')](_0x3cf593[_0x98ae('0xb')],function(_0x532386){return{'model':db[_0x532386[_0x98ae('0xc')]],'as':_0x532386['as'],'attributes':_0x532386[_0x98ae('0x9')],'include':_0x532386['include']?_[_0x98ae('0xd')](_0x532386[_0x98ae('0xb')],function(_0x5f789){return{'model':db[_0x5f789[_0x98ae('0xc')]],'as':_0x5f789['as'],'attributes':_0x5f789[_0x98ae('0x9')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x596930){logger['info'](_0x98ae('0x4'),_0x4400a8);logger['debug'](_0x98ae('0x4'),_0x4400a8,JSON[_0x98ae('0x10')](_0x596930));_0x3befa4(_0x596930);})[_0x98ae('0x1d')](function(_0x2ca8c5){logger[_0x98ae('0x12')](_0x98ae('0x4'),_0x2ca8c5['message'],_0x4400a8);_0x4ba27d(_0x3e950e[_0x98ae('0x12')](0x1f4,_0x2ca8c5[_0x98ae('0x11')]));});});});};exports[_0x98ae('0x41')]=function(_0x76aade){var _0x33d14f=this;return new Promise(function(_0x3502e2,_0x5de92d){return db['CmContact']['findOne']({'raw':!![],'where':{'phone':_0x76aade[_0x98ae('0x7')][_0x98ae('0x1a')][_0x98ae('0x42')]},'attributes':['id',_0x98ae('0x43')],'order':[['id','DESC']]})['then'](function(_0x20e1dd){logger[_0x98ae('0x14')]('getContactByPhone',_0x76aade);logger[_0x98ae('0xf')](_0x98ae('0x44'),_0x76aade,JSON[_0x98ae('0x10')](_0x20e1dd));_0x3502e2(_0x20e1dd);})[_0x98ae('0x1d')](function(_0x5b0f80){logger[_0x98ae('0x12')](_0x98ae('0x44'),_0x5b0f80[_0x98ae('0x11')],_0x76aade);_0x5de92d(_0x33d14f[_0x98ae('0x12')](0x1f4,_0x5b0f80[_0x98ae('0x11')]));});});};exports[_0x98ae('0x45')]=function(_0x53ad1b){var _0x2d5c84=this;return new Promise(function(_0x4e8699,_0x1fb64d){return db[_0x98ae('0x22')]['transaction'](function(_0x350256){var _0x503e42=_0x53ad1b[_0x98ae('0x7')]&&_0x53ad1b[_0x98ae('0x7')][_0x98ae('0x1a')]?_0x53ad1b[_0x98ae('0x7')][_0x98ae('0x1a')]:{};return db[_0x98ae('0x5')][_0x98ae('0x19')](_0x53ad1b[_0x98ae('0x17')],{'where':_0x503e42,'transaction':_0x350256})[_0x98ae('0xe')](function(_0x4c168a){logger[_0x98ae('0x14')]('ResetActiveCalls',_0x53ad1b);logger[_0x98ae('0xf')](_0x98ae('0x45'),_0x53ad1b,JSON[_0x98ae('0x10')](_0x4c168a));_0x4e8699(_0x4c168a);})[_0x98ae('0x1d')](function(_0x12de87){logger[_0x98ae('0x12')]('ResetActiveCalls',_0x12de87['message'],_0x53ad1b);_0x1fb64d(_0x2d5c84[_0x98ae('0x12')](0x1f4,_0x12de87[_0x98ae('0x11')]));});});});};exports[_0x98ae('0x46')]=function(_0xca7086){var _0x534e8d=this;var _0x4e35fc=_0xca7086[_0x98ae('0x17')][_0x98ae('0x1a')][_0x98ae('0x47')];var _0x42d13f=_0xca7086[_0x98ae('0x17')][_0x98ae('0x1a')][_0x98ae('0x48')];var _0x1e0269=_0xca7086[_0x98ae('0x17')][_0x98ae('0x1a')][_0x98ae('0x49')];return new Promise(function(_0x35f7c3,_0xb1ad0d){return db[_0x98ae('0x5')][_0x98ae('0x6')]({'where':{'voiceQueueId':{'$in':_0x4e35fc},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0x98ae('0x22')][_0x98ae('0x38')](_0x98ae('0x4a')+_0x42d13f+'\x20MINUTE'),'$gt':db[_0x98ae('0x22')]['literal']('NOW()')}},'UserId':{'$in':_0x1e0269}},'include':[{'model':db['CmContact'],'as':_0x98ae('0x40')},{'model':db[_0x98ae('0x26')],'as':_0x98ae('0x27'),'attributes':['id',_0x98ae('0x28'),_0x98ae('0x29')]},{'model':db[_0x98ae('0x4b')],'as':_0x98ae('0x4c')}]})[_0x98ae('0xe')](function(_0x53dc96){if(_0x53dc96[_0x98ae('0x2a')]>0x0){return db[_0x98ae('0x22')]['transaction'](function(_0x55dcac){return db[_0x98ae('0x5')][_0x98ae('0x19')]({'recallmeNotifiedDate':db[_0x98ae('0x22')][_0x98ae('0x38')]('NOW()')},{'where':{'id':{'$in':_[_0x98ae('0xd')](_0x53dc96,'id')}},'transaction':_0x55dcac})[_0x98ae('0xe')](function(){_0x35f7c3(_0x53dc96);})['catch'](function(_0x5be4bc){logger[_0x98ae('0x12')](_0x98ae('0x46'),_0x5be4bc[_0x98ae('0x11')],_0xca7086);_0xb1ad0d(_0x534e8d[_0x98ae('0x12')](0x1f4,_0x5be4bc[_0x98ae('0x11')]));});})[_0x98ae('0x1d')](function(_0x350f22){logger['error'](_0x98ae('0x46'),_0x350f22['message'],_0xca7086);_0xb1ad0d(_0x534e8d[_0x98ae('0x12')](0x1f4,_0x350f22['message']));});}else{_0x35f7c3(_0x53dc96);}});});};
\ No newline at end of file
+var _0x9f37=['`scheduledat`\x20>=\x20','format','\x22%s\x22','contactsRescheduled','CountReScheduled','findAll','all','GetContactRecallMe','GetCmHopperPreview','Contact','keys','GetContactByPhone','findOne','phone','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueIds','interval','literal','\x20MINUTE','NOW()','CmList','List','lodash','util','moment','../../mysqldb','rpc','CmHopper','options','raw','where','attributes','limit','model','include','map','info','GetCmHopper','debug','stringify','error','message','ShowCmHopper','catch','CreateCmHopper','create','body','then','UpdateCmHopper','update','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','DestroyCmHopper','destroy','GetContactDialer','describe','sequelize','order','UPDATE','CmContact','User','name','voicePause','length','UserId','push','includes','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','MoveContactManagedDialer','transaction','CmHopperFinal','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]'];(function(_0x768165,_0x1e7660){var _0x5874ee=function(_0x56e35c){while(--_0x56e35c){_0x768165['push'](_0x768165['shift']());}};_0x5874ee(++_0x1e7660);}(_0x9f37,0xb6));var _0x79f3=function(_0x7e2eb0,_0x17cd58){_0x7e2eb0=_0x7e2eb0-0x0;var _0xd92de4=_0x9f37[_0x7e2eb0];return _0xd92de4;};'use strict';var _=require(_0x79f3('0x0'));var util=require(_0x79f3('0x1'));var moment=require(_0x79f3('0x2'));var BPromise=require('bluebird');var db=require(_0x79f3('0x3'))['db'];var logger=require('../../config/logger')(_0x79f3('0x4'));exports['GetCmHopper']=function(_0x47de24){var _0x49ef78=this;return new Promise(function(_0x3284f9,_0x8b3eba){return db[_0x79f3('0x5')]['findAll']({'raw':_0x47de24[_0x79f3('0x6')]?_0x47de24[_0x79f3('0x6')][_0x79f3('0x7')]===undefined?!![]:![]:!![],'where':_0x47de24[_0x79f3('0x6')]?_0x47de24['options'][_0x79f3('0x8')]||null:null,'attributes':_0x47de24[_0x79f3('0x6')]?_0x47de24[_0x79f3('0x6')][_0x79f3('0x9')]||null:null,'limit':_0x47de24[_0x79f3('0x6')]?_0x47de24[_0x79f3('0x6')][_0x79f3('0xa')]||null:null,'include':_0x47de24[_0x79f3('0x6')]?_0x47de24[_0x79f3('0x6')]['include']?_['map'](_0x47de24[_0x79f3('0x6')]['include'],function(_0xf8b67c){return{'model':db[_0xf8b67c[_0x79f3('0xb')]],'as':_0xf8b67c['as'],'attributes':_0xf8b67c[_0x79f3('0x9')],'include':_0xf8b67c[_0x79f3('0xc')]?_[_0x79f3('0xd')](_0xf8b67c[_0x79f3('0xc')],function(_0x20513b){return{'model':db[_0x20513b[_0x79f3('0xb')]],'as':_0x20513b['as'],'attributes':_0x20513b[_0x79f3('0x9')],'include':_0x20513b[_0x79f3('0xc')]?_[_0x79f3('0xd')](_0x20513b[_0x79f3('0xc')],function(_0x42a04a){return{'model':db[_0x42a04a[_0x79f3('0xb')]],'as':_0x42a04a['as'],'attributes':_0x42a04a[_0x79f3('0x9')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x26941b){logger[_0x79f3('0xe')](_0x79f3('0xf'),_0x47de24);logger[_0x79f3('0x10')](_0x79f3('0xf'),_0x47de24,JSON[_0x79f3('0x11')](_0x26941b));_0x3284f9(_0x26941b);})['catch'](function(_0x3490dc){logger['error'](_0x79f3('0xf'),_0x3490dc['message'],_0x47de24);_0x8b3eba(_0x49ef78[_0x79f3('0x12')](0x1f4,_0x3490dc[_0x79f3('0x13')]));});});};exports[_0x79f3('0x14')]=function(_0xaf5bf8){var _0x2f0ec7=this;return new Promise(function(_0x3c3009,_0x515800){return db['CmHopper']['find']({'raw':_0xaf5bf8[_0x79f3('0x6')]?_0xaf5bf8[_0x79f3('0x6')][_0x79f3('0x7')]===undefined?!![]:![]:!![],'where':_0xaf5bf8[_0x79f3('0x6')]?_0xaf5bf8[_0x79f3('0x6')]['where']||null:null,'attributes':_0xaf5bf8[_0x79f3('0x6')]?_0xaf5bf8[_0x79f3('0x6')][_0x79f3('0x9')]||null:null,'include':_0xaf5bf8['options']?_0xaf5bf8[_0x79f3('0x6')][_0x79f3('0xc')]?_[_0x79f3('0xd')](_0xaf5bf8[_0x79f3('0x6')][_0x79f3('0xc')],function(_0x360845){return{'model':db[_0x360845[_0x79f3('0xb')]],'as':_0x360845['as'],'attributes':_0x360845[_0x79f3('0x9')],'include':_0x360845[_0x79f3('0xc')]?_[_0x79f3('0xd')](_0x360845[_0x79f3('0xc')],function(_0x1ae10b){return{'model':db[_0x1ae10b['model']],'as':_0x1ae10b['as'],'attributes':_0x1ae10b[_0x79f3('0x9')],'include':_0x1ae10b[_0x79f3('0xc')]?_[_0x79f3('0xd')](_0x1ae10b[_0x79f3('0xc')],function(_0x23510b){return{'model':db[_0x23510b[_0x79f3('0xb')]],'as':_0x23510b['as'],'attributes':_0x23510b['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4b9140){logger['info'](_0x79f3('0x14'),_0xaf5bf8);logger[_0x79f3('0x10')](_0x79f3('0x14'),_0xaf5bf8,JSON[_0x79f3('0x11')](_0x4b9140));_0x3c3009(_0x4b9140);})[_0x79f3('0x15')](function(_0x3635b0){logger[_0x79f3('0x12')](_0x79f3('0x14'),_0x3635b0[_0x79f3('0x13')],_0xaf5bf8);_0x515800(_0x2f0ec7[_0x79f3('0x12')](0x1f4,_0x3635b0[_0x79f3('0x13')]));});});};exports[_0x79f3('0x16')]=function(_0x11e047){var _0x4895bd=this;return new Promise(function(_0x3c0527,_0x5f573e){return db[_0x79f3('0x5')][_0x79f3('0x17')](_0x11e047[_0x79f3('0x18')],{'raw':_0x11e047[_0x79f3('0x6')]?_0x11e047[_0x79f3('0x6')][_0x79f3('0x7')]===undefined?!![]:![]:!![]})[_0x79f3('0x19')](function(_0x2e1c61){logger['info'](_0x79f3('0x16'),_0x11e047);logger[_0x79f3('0x10')](_0x79f3('0x16'),_0x11e047,JSON[_0x79f3('0x11')](_0x2e1c61));_0x3c0527(_0x2e1c61);})[_0x79f3('0x15')](function(_0x1893e1){logger['error'](_0x79f3('0x16'),_0x1893e1[_0x79f3('0x13')],_0x11e047);_0x5f573e(_0x4895bd[_0x79f3('0x12')](0x1f4,_0x1893e1[_0x79f3('0x13')]));});});};exports[_0x79f3('0x1a')]=function(_0x42c786){var _0x8018ef=this;return new Promise(function(_0xa5168f,_0x58571d){return db[_0x79f3('0x5')][_0x79f3('0x1b')](_0x42c786[_0x79f3('0x18')],{'raw':_0x42c786[_0x79f3('0x6')]?_0x42c786[_0x79f3('0x6')][_0x79f3('0x7')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x42c786[_0x79f3('0x6')]?_0x42c786[_0x79f3('0x6')]['where']||null:null,'attributes':_0x42c786['options']?_0x42c786[_0x79f3('0x6')][_0x79f3('0x9')]||null:null,'limit':_0x42c786['options']?_0x42c786[_0x79f3('0x6')]['limit']||null:null})[_0x79f3('0x19')](function(_0x30cdd1){logger['info']('UpdateCmHopper',_0x42c786);logger[_0x79f3('0xe')](_0x79f3('0x1c'),JSON[_0x79f3('0x11')](_0x42c786[_0x79f3('0x6')][_0x79f3('0x8')]),_0x42c786[_0x79f3('0x18')][_0x79f3('0x1d')]);logger[_0x79f3('0x10')](_0x79f3('0x1a'),_0x42c786,JSON[_0x79f3('0x11')](_0x30cdd1));_0xa5168f(_0x30cdd1);})[_0x79f3('0x15')](function(_0xe2ddbc){logger[_0x79f3('0x12')](_0x79f3('0x1a'),_0xe2ddbc['message'],_0x42c786);_0x58571d(_0x8018ef['error'](0x1f4,_0xe2ddbc[_0x79f3('0x13')]));});});};exports[_0x79f3('0x1e')]=function(_0x4929f2){var _0xdac768=this;return new Promise(function(_0x519e1d,_0x68782){return db[_0x79f3('0x5')][_0x79f3('0x1f')]({'where':_0x4929f2[_0x79f3('0x6')]?_0x4929f2[_0x79f3('0x6')]['where']||null:null})[_0x79f3('0x19')](function(_0x392a68){logger[_0x79f3('0xe')](_0x79f3('0x1e'),_0x4929f2);logger[_0x79f3('0x10')](_0x79f3('0x1e'),_0x4929f2,JSON[_0x79f3('0x11')](_0x392a68));_0x519e1d(_0x392a68);})[_0x79f3('0x15')](function(_0x54b27f){logger[_0x79f3('0x12')]('DestroyCmHopper',_0x54b27f[_0x79f3('0x13')],_0x4929f2);_0x68782(_0xdac768[_0x79f3('0x12')](0x1f4,_0x54b27f[_0x79f3('0x13')]));});});};exports[_0x79f3('0x20')]=function(_0x12dffc){var _0x25d9df=this;return new Promise(function(_0x50ff70,_0x40bf65){return db['CmContact'][_0x79f3('0x21')]()[_0x79f3('0x19')](function(_0x4c3d08){return db[_0x79f3('0x22')]['transaction'](function(_0x33ac22){return db['CmHopper']['findAll']({'where':_0x12dffc[_0x79f3('0x6')]?_0x12dffc[_0x79f3('0x6')][_0x79f3('0x8')]||null:null,'attributes':_0x12dffc[_0x79f3('0x6')]?_0x12dffc['options'][_0x79f3('0x9')]||null:null,'limit':_0x12dffc['options']?_0x12dffc['options']['limit']||null:null,'order':_0x12dffc[_0x79f3('0x6')]?_0x12dffc[_0x79f3('0x6')][_0x79f3('0x23')]||null:null,'transaction':_0x33ac22,'lock':_0x33ac22['LOCK'][_0x79f3('0x24')],'include':[{'model':db[_0x79f3('0x25')],'as':'Contact','attributes':_['keys'](_0x4c3d08)},{'model':db[_0x79f3('0x26')],'as':'Agent','attributes':['id',_0x79f3('0x27'),_0x79f3('0x28')]}]})[_0x79f3('0x19')](function(_0x4dd7f3){var _0x54c6e0=[];var _0x1a005b=[];for(var _0x2460dc=0x0;_0x2460dc<_0x4dd7f3[_0x79f3('0x29')];_0x2460dc+=0x1){var _0x49d4c6=_0x4dd7f3[_0x2460dc][_0x79f3('0x2a')];if(_0x49d4c6===null){_0x54c6e0[_0x79f3('0x2b')](_0x4dd7f3[_0x2460dc][_0x79f3('0x1b')](_0x12dffc[_0x79f3('0x18')],{'transaction':_0x33ac22}));}else if(!_0x1a005b[_0x79f3('0x2c')](_0x49d4c6)){_0x1a005b[_0x79f3('0x2b')](_0x49d4c6);_0x54c6e0[_0x79f3('0x2b')](_0x4dd7f3[_0x2460dc]['update'](_0x12dffc[_0x79f3('0x18')],{'transaction':_0x33ac22}));}}return BPromise['all'](_0x54c6e0);});})[_0x79f3('0x19')](function(_0x2e8fcf){logger[_0x79f3('0xe')]('GetContactDialer',_0x12dffc);if(_0x2e8fcf[_0x79f3('0x29')]>0x0){logger['info'](_0x79f3('0x2d'),_0x2e8fcf[0x0][_0x79f3('0x2e')]['id'],_0x2e8fcf[0x0][_0x79f3('0x2e')][_0x79f3('0x2f')],_0x2e8fcf[0x0][_0x79f3('0x2e')][_0x79f3('0x1d')]);}logger['debug']('GetContactDialer',_0x12dffc,JSON[_0x79f3('0x11')](_0x2e8fcf));_0x50ff70(_0x2e8fcf);})[_0x79f3('0x15')](function(_0x12d16d){logger['error'](_0x79f3('0x20'),_0x12d16d[_0x79f3('0x13')],_0x12dffc);_0x40bf65(_0x25d9df[_0x79f3('0x12')](0x1f4,_0x12d16d[_0x79f3('0x13')]));});});});};exports[_0x79f3('0x30')]=function(_0x66c47b){var _0x547bd6=this;return new Promise(function(_0x12ecca,_0x504392){return db[_0x79f3('0x22')][_0x79f3('0x31')](function(_0x2fa3a7){return db[_0x79f3('0x32')]['create'](_0x66c47b['body'],{'raw':_0x66c47b['options']?_0x66c47b[_0x79f3('0x6')][_0x79f3('0x7')]===undefined?!![]:![]:!![],'transaction':_0x2fa3a7})[_0x79f3('0x19')](function(){logger['info'](_0x79f3('0x33'),JSON[_0x79f3('0x11')](_0x66c47b[_0x79f3('0x6')]['where']),_0x66c47b[_0x79f3('0x6')]['where'][_0x79f3('0x1d')]);return db[_0x79f3('0x5')]['destroy']({'where':_0x66c47b[_0x79f3('0x6')]?_0x66c47b['options']['where']||null:null,'transaction':_0x2fa3a7});});})[_0x79f3('0x19')](function(_0x54bdd0){logger[_0x79f3('0xe')](_0x79f3('0x30'),_0x66c47b);logger[_0x79f3('0x10')](_0x79f3('0x30'),_0x66c47b,JSON[_0x79f3('0x11')](_0x54bdd0));_0x12ecca(_0x54bdd0);})[_0x79f3('0x15')](function(_0x6135ff){logger[_0x79f3('0x12')](_0x79f3('0x30'),_0x6135ff['message'],_0x66c47b);_0x504392(_0x547bd6[_0x79f3('0x12')](0x1f4,_0x6135ff[_0x79f3('0x13')]));});});};exports['CountReScheduled']=function(_0x331b9a){var _0x4b3f72=this;return new Promise(function(_0x55e59e,_0x5bb9bf){return db[_0x79f3('0x5')]['findAll']({'raw':_0x331b9a[_0x79f3('0x6')]?_0x331b9a[_0x79f3('0x6')][_0x79f3('0x7')]===undefined?!![]:![]:!![],'where':_0x331b9a[_0x79f3('0x6')]?_0x331b9a[_0x79f3('0x6')][_0x79f3('0x8')]||null:null,'attributes':[[db['sequelize']['fn']('COUNT',db[_0x79f3('0x22')]['fn']('IF',db[_0x79f3('0x22')]['literal'](_0x79f3('0x34')+util[_0x79f3('0x35')](_0x79f3('0x36'),moment()[_0x79f3('0x35')]('YYYY-MM-DD\x20HH:mm:ss'))+'\x20,\x201,\x20null'))),_0x79f3('0x37')]]})[_0x79f3('0x19')](function(_0x4e4dfc){logger['info'](_0x79f3('0x38'),_0x331b9a);logger[_0x79f3('0x10')](_0x79f3('0x38'),_0x331b9a,JSON['stringify'](_0x4e4dfc));_0x55e59e(_0x4e4dfc);})[_0x79f3('0x15')](function(_0x4bbc2c){logger[_0x79f3('0x12')](_0x79f3('0x38'),_0x4bbc2c[_0x79f3('0x13')],_0x331b9a);_0x5bb9bf(_0x4b3f72[_0x79f3('0x12')](0x1f4,_0x4bbc2c[_0x79f3('0x13')]));});});};exports['GetContactRecallMe']=function(_0x161f6c){var _0x3431c2=this;return new Promise(function(_0x2fb212,_0x2e3ceb){return db[_0x79f3('0x25')][_0x79f3('0x21')]()[_0x79f3('0x19')](function(){return db[_0x79f3('0x22')][_0x79f3('0x31')](function(_0xa298af){return db['CmHopper'][_0x79f3('0x39')]({'where':_0x161f6c[_0x79f3('0x6')]?_0x161f6c[_0x79f3('0x6')]['where']||null:null,'attributes':_0x161f6c[_0x79f3('0x6')]?_0x161f6c[_0x79f3('0x6')][_0x79f3('0x9')]||null:null,'limit':0x1,'order':_0x161f6c[_0x79f3('0x6')]?_0x161f6c[_0x79f3('0x6')][_0x79f3('0x23')]||null:null,'group':db[_0x79f3('0x5')][_0x79f3('0x2a')],'transaction':_0xa298af,'lock':_0xa298af['LOCK'][_0x79f3('0x24')],'include':_0x161f6c['options']?_0x161f6c[_0x79f3('0x6')]['include']?_['map'](_0x161f6c[_0x79f3('0x6')]['include'],function(_0x5270b8){return{'model':db[_0x5270b8[_0x79f3('0xb')]],'as':_0x5270b8['as'],'attributes':_0x5270b8['attributes'],'include':_0x5270b8[_0x79f3('0xc')]?_[_0x79f3('0xd')](_0x5270b8['include'],function(_0x4e9e92){return{'model':db[_0x4e9e92[_0x79f3('0xb')]],'as':_0x4e9e92['as'],'attributes':_0x4e9e92['attributes'],'include':_0x4e9e92[_0x79f3('0xc')]?_[_0x79f3('0xd')](_0x4e9e92[_0x79f3('0xc')],function(_0x1a05e7){return{'model':db[_0x1a05e7['model']],'as':_0x1a05e7['as'],'attributes':_0x1a05e7[_0x79f3('0x9')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2a3ce9){var _0x13c5b5=[];for(var _0x188bd8=0x0;_0x188bd8<_0x2a3ce9[_0x79f3('0x29')];_0x188bd8+=0x1){_0x13c5b5[_0x79f3('0x2b')](_0x2a3ce9[_0x188bd8][_0x79f3('0x1b')](_0x161f6c['body'],{'transaction':_0xa298af}));}return BPromise[_0x79f3('0x3a')](_0x13c5b5);});})['then'](function(_0x555986){logger[_0x79f3('0xe')](_0x79f3('0x3b'),_0x161f6c);logger[_0x79f3('0x10')](_0x79f3('0x3b'),_0x161f6c,JSON[_0x79f3('0x11')](_0x555986));_0x2fb212(_0x555986);})[_0x79f3('0x15')](function(_0x2e325e){logger[_0x79f3('0x12')](_0x79f3('0x3b'),_0x2e325e['message'],_0x161f6c);_0x2e3ceb(_0x3431c2[_0x79f3('0x12')](0x1f4,_0x2e325e[_0x79f3('0x13')]));});});});};exports[_0x79f3('0x3c')]=function(_0x5c3f5e){var _0x348a6e=this;return new Promise(function(_0x31ed84,_0x1f139d){db[_0x79f3('0x25')][_0x79f3('0x21')]()[_0x79f3('0x19')](function(_0x803ad3){return db['CmHopper'][_0x79f3('0x39')]({'raw':_0x5c3f5e['options']?_0x5c3f5e[_0x79f3('0x6')][_0x79f3('0x7')]===undefined?!![]:![]:!![],'where':_0x5c3f5e[_0x79f3('0x6')]?_0x5c3f5e[_0x79f3('0x6')][_0x79f3('0x8')]||null:null,'attributes':_0x5c3f5e[_0x79f3('0x6')]?_0x5c3f5e[_0x79f3('0x6')][_0x79f3('0x9')]||null:null,'limit':_0x5c3f5e['options']?_0x5c3f5e['options'][_0x79f3('0xa')]||null:null,'include':_0x5c3f5e['options']?_0x5c3f5e['options'][_0x79f3('0xc')]?_[_0x79f3('0xd')](_0x5c3f5e[_0x79f3('0x6')][_0x79f3('0xc')],function(_0x65bc64){return{'model':db[_0x65bc64[_0x79f3('0xb')]],'as':_0x65bc64['as'],'attributes':_0x65bc64['as']===_0x79f3('0x3d')?_[_0x79f3('0x3e')](_0x803ad3):_0x65bc64[_0x79f3('0x9')],'include':_0x65bc64[_0x79f3('0xc')]?_[_0x79f3('0xd')](_0x65bc64['include'],function(_0x485b04){return{'model':db[_0x485b04[_0x79f3('0xb')]],'as':_0x485b04['as'],'attributes':_0x485b04[_0x79f3('0x9')],'include':_0x485b04[_0x79f3('0xc')]?_[_0x79f3('0xd')](_0x485b04[_0x79f3('0xc')],function(_0x5ea979){return{'model':db[_0x5ea979[_0x79f3('0xb')]],'as':_0x5ea979['as'],'attributes':_0x5ea979[_0x79f3('0x9')]};}):[]};}):[]};}):[]:[]})[_0x79f3('0x19')](function(_0x1a9033){logger[_0x79f3('0xe')](_0x79f3('0xf'),_0x5c3f5e);logger['debug']('GetCmHopper',_0x5c3f5e,JSON[_0x79f3('0x11')](_0x1a9033));_0x31ed84(_0x1a9033);})[_0x79f3('0x15')](function(_0x41110e){logger['error'](_0x79f3('0xf'),_0x41110e[_0x79f3('0x13')],_0x5c3f5e);_0x1f139d(_0x348a6e[_0x79f3('0x12')](0x1f4,_0x41110e[_0x79f3('0x13')]));});});});};exports[_0x79f3('0x3f')]=function(_0x2ad24d){var _0x333ea2=this;return new Promise(function(_0x364b7c,_0x10f6b4){return db['CmContact'][_0x79f3('0x40')]({'raw':!![],'where':{'phone':_0x2ad24d[_0x79f3('0x6')][_0x79f3('0x8')][_0x79f3('0x41')]},'attributes':['id',_0x79f3('0x42')],'order':[['id',_0x79f3('0x43')]]})['then'](function(_0x3cfb8d){logger[_0x79f3('0xe')](_0x79f3('0x44'),_0x2ad24d);logger[_0x79f3('0x10')](_0x79f3('0x44'),_0x2ad24d,JSON[_0x79f3('0x11')](_0x3cfb8d));_0x364b7c(_0x3cfb8d);})['catch'](function(_0x275823){logger[_0x79f3('0x12')](_0x79f3('0x44'),_0x275823[_0x79f3('0x13')],_0x2ad24d);_0x10f6b4(_0x333ea2[_0x79f3('0x12')](0x1f4,_0x275823[_0x79f3('0x13')]));});});};exports['ResetActiveCalls']=function(_0x39ebe5){var _0x18e10b=this;return new Promise(function(_0x4c9c90,_0x4df05f){return db['sequelize'][_0x79f3('0x31')](function(_0xdd26ca){var _0x1804d2=_0x39ebe5['options']&&_0x39ebe5[_0x79f3('0x6')]['where']?_0x39ebe5[_0x79f3('0x6')][_0x79f3('0x8')]:{};return db['CmHopper'][_0x79f3('0x1b')](_0x39ebe5[_0x79f3('0x18')],{'where':_0x1804d2,'transaction':_0xdd26ca})[_0x79f3('0x19')](function(_0x3ecefd){logger[_0x79f3('0xe')](_0x79f3('0x45'),_0x39ebe5);logger[_0x79f3('0x10')](_0x79f3('0x45'),_0x39ebe5,JSON[_0x79f3('0x11')](_0x3ecefd));_0x4c9c90(_0x3ecefd);})[_0x79f3('0x15')](function(_0x90b3fa){logger[_0x79f3('0x12')](_0x79f3('0x45'),_0x90b3fa[_0x79f3('0x13')],_0x39ebe5);_0x4df05f(_0x18e10b[_0x79f3('0x12')](0x1f4,_0x90b3fa[_0x79f3('0x13')]));});});});};exports[_0x79f3('0x46')]=function(_0x5f4095){var _0x8e40bb=this;var _0x540faf=_0x5f4095[_0x79f3('0x18')][_0x79f3('0x8')][_0x79f3('0x47')];var _0x21cca6=_0x5f4095[_0x79f3('0x18')]['where'][_0x79f3('0x48')];var _0x53db90=_0x5f4095['body']['where']['availableAgentsIds'];return new Promise(function(_0x75fa54,_0x2c8900){return db[_0x79f3('0x5')][_0x79f3('0x39')]({'where':{'voiceQueueId':{'$in':_0x540faf},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0x79f3('0x22')][_0x79f3('0x49')]('NOW()\x20+\x20INTERVAL\x20'+_0x21cca6+_0x79f3('0x4a')),'$gt':db[_0x79f3('0x22')][_0x79f3('0x49')](_0x79f3('0x4b'))}},'UserId':{'$in':_0x53db90}},'include':[{'model':db[_0x79f3('0x25')],'as':_0x79f3('0x3d')},{'model':db['User'],'as':'Agent','attributes':['id',_0x79f3('0x27'),_0x79f3('0x28')]},{'model':db[_0x79f3('0x4c')],'as':_0x79f3('0x4d')}]})[_0x79f3('0x19')](function(_0x308043){if(_0x308043[_0x79f3('0x29')]>0x0){return db['sequelize'][_0x79f3('0x31')](function(_0x1dd2a7){return db[_0x79f3('0x5')][_0x79f3('0x1b')]({'recallmeNotifiedDate':db[_0x79f3('0x22')][_0x79f3('0x49')](_0x79f3('0x4b'))},{'where':{'id':{'$in':_[_0x79f3('0xd')](_0x308043,'id')}},'transaction':_0x1dd2a7})[_0x79f3('0x19')](function(){_0x75fa54(_0x308043);})[_0x79f3('0x15')](function(_0x54b266){logger[_0x79f3('0x12')](_0x79f3('0x46'),_0x54b266['message'],_0x5f4095);_0x2c8900(_0x8e40bb[_0x79f3('0x12')](0x1f4,_0x54b266[_0x79f3('0x13')]));});})[_0x79f3('0x15')](function(_0x4f55bc){logger[_0x79f3('0x12')](_0x79f3('0x46'),_0x4f55bc[_0x79f3('0x13')],_0x5f4095);_0x2c8900(_0x8e40bb['error'](0x1f4,_0x4f55bc[_0x79f3('0x13')]));});}else{_0x75fa54(_0x308043);}});});};
\ No newline at end of file