Built motion from commit 092f8824.|2.5.49
[motion2.git] / server / api / cmHopper / cmHopper.rpc.js
index 6a2b757..51c2f98 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xceb2=['ShowCmHopper','CmHopper','find','then','body','CreateCmHopper','update','UpdateCmHopper','DestroyCmHopper','GetContactDialer','sequelize','transaction','limit','order','LOCK','CmContact','Contact','keys','User','Agent','name','voicePause','length','UserId','push','includes','all','dataValues','ContactId','active','MoveContactManagedDialer','CmHopperFinal','create','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','UPDATE','GetCmHopperPreview','GetContactByPhone','findOne','phone','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueId','interval','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','List','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','twilio/lib/webhooks/webhooks','client','http','request','info','CmHopper,\x20%s,\x20%s','request\x20sent','CmHopper,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetCmHopper','findAll','raw','options','where','attributes','include','map','model','debug','catch'];(function(_0xd767ac,_0x2fac0f){var _0x5be50d=function(_0x1150f8){while(--_0x1150f8){_0xd767ac['push'](_0xd767ac['shift']());}};_0x5be50d(++_0x2fac0f);}(_0xceb2,0xf0));var _0x2ceb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xceb2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x2ceb('0x0'));var moment=require(_0x2ceb('0x1'));var BPromise=require('bluebird');var rs=require(_0x2ceb('0x2'));var fs=require('fs');var Redis=require(_0x2ceb('0x3'));var db=require(_0x2ceb('0x4'))['db'];var utils=require(_0x2ceb('0x5'));var logger=require('../../config/logger')(_0x2ceb('0x6'));var config=require(_0x2ceb('0x7'));var jayson=require(_0x2ceb('0x8'));const {validateExpressRequest}=require(_0x2ceb('0x9'));var client=jayson[_0x2ceb('0xa')][_0x2ceb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2fa72b,_0x3ba30e,_0x31e917){return new BPromise(function(_0x5daf45,_0xecf4dc){return client[_0x2ceb('0xc')](_0x2fa72b,_0x31e917)['then'](function(_0x1268d2){logger[_0x2ceb('0xd')](_0x2ceb('0xe'),_0x3ba30e,_0x2ceb('0xf'));logger['debug'](_0x2ceb('0x10'),_0x3ba30e,_0x2ceb('0xf'),JSON[_0x2ceb('0x11')](_0x1268d2));if(_0x1268d2[_0x2ceb('0x12')]){if(_0x1268d2['error'][_0x2ceb('0x13')]===0x1f4){logger['error']('CmHopper,\x20%s,\x20%s',_0x3ba30e,_0x1268d2[_0x2ceb('0x12')]['message']);return _0xecf4dc(_0x1268d2[_0x2ceb('0x12')][_0x2ceb('0x14')]);}logger[_0x2ceb('0x12')](_0x2ceb('0xe'),_0x3ba30e,_0x1268d2[_0x2ceb('0x12')][_0x2ceb('0x14')]);return _0x5daf45(_0x1268d2[_0x2ceb('0x12')][_0x2ceb('0x14')]);}else{logger[_0x2ceb('0xd')](_0x2ceb('0xe'),_0x3ba30e,_0x2ceb('0xf'));_0x5daf45(_0x1268d2[_0x2ceb('0x15')][_0x2ceb('0x14')]);}})['catch'](function(_0x4d3a37){logger[_0x2ceb('0x12')](_0x2ceb('0xe'),_0x3ba30e,_0x4d3a37);_0xecf4dc(_0x4d3a37);});});}exports[_0x2ceb('0x16')]=function(_0x21ac45){var _0x48ba53=this;return new Promise(function(_0x5085ca,_0x1f3175){return db['CmHopper'][_0x2ceb('0x17')]({'raw':_0x21ac45['options']?_0x21ac45['options'][_0x2ceb('0x18')]===undefined?!![]:![]:!![],'where':_0x21ac45[_0x2ceb('0x19')]?_0x21ac45[_0x2ceb('0x19')][_0x2ceb('0x1a')]||null:null,'attributes':_0x21ac45[_0x2ceb('0x19')]?_0x21ac45[_0x2ceb('0x19')][_0x2ceb('0x1b')]||null:null,'limit':_0x21ac45[_0x2ceb('0x19')]?_0x21ac45[_0x2ceb('0x19')]['limit']||null:null,'include':_0x21ac45['options']?_0x21ac45[_0x2ceb('0x19')][_0x2ceb('0x1c')]?_[_0x2ceb('0x1d')](_0x21ac45[_0x2ceb('0x19')]['include'],function(_0x150749){return{'model':db[_0x150749[_0x2ceb('0x1e')]],'as':_0x150749['as'],'attributes':_0x150749[_0x2ceb('0x1b')],'include':_0x150749['include']?_[_0x2ceb('0x1d')](_0x150749[_0x2ceb('0x1c')],function(_0x3436f5){return{'model':db[_0x3436f5[_0x2ceb('0x1e')]],'as':_0x3436f5['as'],'attributes':_0x3436f5[_0x2ceb('0x1b')],'include':_0x3436f5['include']?_[_0x2ceb('0x1d')](_0x3436f5[_0x2ceb('0x1c')],function(_0x48acc2){return{'model':db[_0x48acc2[_0x2ceb('0x1e')]],'as':_0x48acc2['as'],'attributes':_0x48acc2[_0x2ceb('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3bc907){logger[_0x2ceb('0xd')]('GetCmHopper',_0x21ac45);logger[_0x2ceb('0x1f')](_0x2ceb('0x16'),_0x21ac45,JSON[_0x2ceb('0x11')](_0x3bc907));_0x5085ca(_0x3bc907);})[_0x2ceb('0x20')](function(_0x463fad){logger[_0x2ceb('0x12')](_0x2ceb('0x16'),_0x463fad['message'],_0x21ac45);_0x1f3175(_0x48ba53[_0x2ceb('0x12')](0x1f4,_0x463fad['message']));});});};exports[_0x2ceb('0x21')]=function(_0x528682){var _0x2db655=this;return new Promise(function(_0x2d1579,_0x2202f5){return db[_0x2ceb('0x22')][_0x2ceb('0x23')]({'raw':_0x528682[_0x2ceb('0x19')]?_0x528682[_0x2ceb('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x528682[_0x2ceb('0x19')]?_0x528682[_0x2ceb('0x19')]['where']||null:null,'attributes':_0x528682[_0x2ceb('0x19')]?_0x528682[_0x2ceb('0x19')][_0x2ceb('0x1b')]||null:null,'include':_0x528682[_0x2ceb('0x19')]?_0x528682[_0x2ceb('0x19')][_0x2ceb('0x1c')]?_[_0x2ceb('0x1d')](_0x528682['options'][_0x2ceb('0x1c')],function(_0x45b6cb){return{'model':db[_0x45b6cb[_0x2ceb('0x1e')]],'as':_0x45b6cb['as'],'attributes':_0x45b6cb[_0x2ceb('0x1b')],'include':_0x45b6cb[_0x2ceb('0x1c')]?_[_0x2ceb('0x1d')](_0x45b6cb[_0x2ceb('0x1c')],function(_0x551c37){return{'model':db[_0x551c37[_0x2ceb('0x1e')]],'as':_0x551c37['as'],'attributes':_0x551c37[_0x2ceb('0x1b')],'include':_0x551c37[_0x2ceb('0x1c')]?_[_0x2ceb('0x1d')](_0x551c37[_0x2ceb('0x1c')],function(_0x384ced){return{'model':db[_0x384ced['model']],'as':_0x384ced['as'],'attributes':_0x384ced['attributes']};}):[]};}):[]};}):[]:[]})[_0x2ceb('0x24')](function(_0x40c3e8){logger[_0x2ceb('0xd')](_0x2ceb('0x21'),_0x528682);logger['debug']('ShowCmHopper',_0x528682,JSON[_0x2ceb('0x11')](_0x40c3e8));_0x2d1579(_0x40c3e8);})[_0x2ceb('0x20')](function(_0x4c28a3){logger['error'](_0x2ceb('0x21'),_0x4c28a3[_0x2ceb('0x14')],_0x528682);_0x2202f5(_0x2db655['error'](0x1f4,_0x4c28a3[_0x2ceb('0x14')]));});});};exports['CreateCmHopper']=function(_0x2f744a){var _0x1a44a7=this;return new Promise(function(_0x162c9a,_0x4fbb5b){return db[_0x2ceb('0x22')]['create'](_0x2f744a[_0x2ceb('0x25')],{'raw':_0x2f744a[_0x2ceb('0x19')]?_0x2f744a[_0x2ceb('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x2ceb('0x24')](function(_0x5f3c64){logger['info']('CreateCmHopper',_0x2f744a);logger[_0x2ceb('0x1f')](_0x2ceb('0x26'),_0x2f744a,JSON[_0x2ceb('0x11')](_0x5f3c64));_0x162c9a(_0x5f3c64);})[_0x2ceb('0x20')](function(_0xea7046){logger[_0x2ceb('0x12')](_0x2ceb('0x26'),_0xea7046[_0x2ceb('0x14')],_0x2f744a);_0x4fbb5b(_0x1a44a7[_0x2ceb('0x12')](0x1f4,_0xea7046['message']));});});};exports['UpdateCmHopper']=function(_0x30e4d1){var _0x748a2d=this;return new Promise(function(_0x33f7be,_0x14fe25){return db['CmHopper'][_0x2ceb('0x27')](_0x30e4d1[_0x2ceb('0x25')],{'raw':_0x30e4d1[_0x2ceb('0x19')]?_0x30e4d1['options'][_0x2ceb('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x30e4d1[_0x2ceb('0x19')]?_0x30e4d1['options'][_0x2ceb('0x1a')]||null:null,'attributes':_0x30e4d1[_0x2ceb('0x19')]?_0x30e4d1['options'][_0x2ceb('0x1b')]||null:null,'limit':_0x30e4d1[_0x2ceb('0x19')]?_0x30e4d1['options']['limit']||null:null})['then'](function(_0x3c8230){logger[_0x2ceb('0xd')](_0x2ceb('0x28'),_0x30e4d1);logger[_0x2ceb('0xd')]('UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON[_0x2ceb('0x11')](_0x30e4d1['options'][_0x2ceb('0x1a')]),_0x30e4d1[_0x2ceb('0x25')]['active']);logger[_0x2ceb('0x1f')]('UpdateCmHopper',_0x30e4d1,JSON['stringify'](_0x3c8230));_0x33f7be(_0x3c8230);})[_0x2ceb('0x20')](function(_0x5a5bbb){logger['error'](_0x2ceb('0x28'),_0x5a5bbb[_0x2ceb('0x14')],_0x30e4d1);_0x14fe25(_0x748a2d['error'](0x1f4,_0x5a5bbb['message']));});});};exports[_0x2ceb('0x29')]=function(_0x37a4b4){var _0x25b899=this;return new Promise(function(_0x253636,_0x232b11){return db[_0x2ceb('0x22')]['destroy']({'where':_0x37a4b4[_0x2ceb('0x19')]?_0x37a4b4['options'][_0x2ceb('0x1a')]||null:null})[_0x2ceb('0x24')](function(_0x35870c){logger[_0x2ceb('0xd')](_0x2ceb('0x29'),_0x37a4b4);logger[_0x2ceb('0x1f')](_0x2ceb('0x29'),_0x37a4b4,JSON[_0x2ceb('0x11')](_0x35870c));_0x253636(_0x35870c);})[_0x2ceb('0x20')](function(_0x21e3d1){logger[_0x2ceb('0x12')](_0x2ceb('0x29'),_0x21e3d1[_0x2ceb('0x14')],_0x37a4b4);_0x232b11(_0x25b899[_0x2ceb('0x12')](0x1f4,_0x21e3d1[_0x2ceb('0x14')]));});});};exports[_0x2ceb('0x2a')]=function(_0x4071d0){var _0x2040bd=this;return new Promise(function(_0x3213ee,_0xae7bb9){return db['CmContact']['describe']()[_0x2ceb('0x24')](function(_0x1a2d4f){return db[_0x2ceb('0x2b')][_0x2ceb('0x2c')](function(_0x3c22d0){return db[_0x2ceb('0x22')][_0x2ceb('0x17')]({'where':_0x4071d0[_0x2ceb('0x19')]?_0x4071d0[_0x2ceb('0x19')][_0x2ceb('0x1a')]||null:null,'attributes':_0x4071d0[_0x2ceb('0x19')]?_0x4071d0[_0x2ceb('0x19')][_0x2ceb('0x1b')]||null:null,'limit':_0x4071d0['options']?_0x4071d0['options'][_0x2ceb('0x2d')]||null:null,'order':_0x4071d0['options']?_0x4071d0[_0x2ceb('0x19')][_0x2ceb('0x2e')]||null:null,'transaction':_0x3c22d0,'lock':_0x3c22d0[_0x2ceb('0x2f')]['UPDATE'],'include':[{'model':db[_0x2ceb('0x30')],'as':_0x2ceb('0x31'),'attributes':_[_0x2ceb('0x32')](_0x1a2d4f)},{'model':db[_0x2ceb('0x33')],'as':_0x2ceb('0x34'),'attributes':['id',_0x2ceb('0x35'),_0x2ceb('0x36')]}]})[_0x2ceb('0x24')](function(_0x561491){var _0x40a813=[];var _0xc8fa07=[];for(var _0x522325=0x0;_0x522325<_0x561491[_0x2ceb('0x37')];_0x522325+=0x1){var _0x22033c=_0x561491[_0x522325][_0x2ceb('0x38')];if(_0x22033c===null){_0x40a813[_0x2ceb('0x39')](_0x561491[_0x522325][_0x2ceb('0x27')](_0x4071d0[_0x2ceb('0x25')],{'transaction':_0x3c22d0}));}else if(!_0xc8fa07[_0x2ceb('0x3a')](_0x22033c)){_0xc8fa07[_0x2ceb('0x39')](_0x22033c);_0x40a813[_0x2ceb('0x39')](_0x561491[_0x522325][_0x2ceb('0x27')](_0x4071d0['body'],{'transaction':_0x3c22d0}));}}return BPromise[_0x2ceb('0x3b')](_0x40a813);});})[_0x2ceb('0x24')](function(_0x341b77){logger[_0x2ceb('0xd')]('GetContactDialer',_0x4071d0);if(_0x341b77[_0x2ceb('0x37')]>0x0){logger[_0x2ceb('0xd')]('GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]',_0x341b77[0x0]['dataValues']['id'],_0x341b77[0x0][_0x2ceb('0x3c')][_0x2ceb('0x3d')],_0x341b77[0x0][_0x2ceb('0x3c')][_0x2ceb('0x3e')]);}logger[_0x2ceb('0x1f')](_0x2ceb('0x2a'),_0x4071d0,JSON[_0x2ceb('0x11')](_0x341b77));_0x3213ee(_0x341b77);})[_0x2ceb('0x20')](function(_0x112b9d){logger[_0x2ceb('0x12')](_0x2ceb('0x2a'),_0x112b9d[_0x2ceb('0x14')],_0x4071d0);_0xae7bb9(_0x2040bd[_0x2ceb('0x12')](0x1f4,_0x112b9d[_0x2ceb('0x14')]));});});});};exports[_0x2ceb('0x3f')]=function(_0x3f2bcf){var _0x3c1c69=this;return new Promise(function(_0x37eb3c,_0x27247b){return db['sequelize'][_0x2ceb('0x2c')](function(_0x5153b2){return db[_0x2ceb('0x40')][_0x2ceb('0x41')](_0x3f2bcf['body'],{'raw':_0x3f2bcf['options']?_0x3f2bcf['options']['raw']===undefined?!![]:![]:!![],'transaction':_0x5153b2})[_0x2ceb('0x24')](function(){logger[_0x2ceb('0xd')]('MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON['stringify'](_0x3f2bcf[_0x2ceb('0x19')][_0x2ceb('0x1a')]),_0x3f2bcf[_0x2ceb('0x19')][_0x2ceb('0x1a')][_0x2ceb('0x3e')]);return db['CmHopper']['destroy']({'where':_0x3f2bcf[_0x2ceb('0x19')]?_0x3f2bcf[_0x2ceb('0x19')][_0x2ceb('0x1a')]||null:null,'transaction':_0x5153b2});});})[_0x2ceb('0x24')](function(_0x3983fb){logger[_0x2ceb('0xd')](_0x2ceb('0x3f'),_0x3f2bcf);logger[_0x2ceb('0x1f')](_0x2ceb('0x3f'),_0x3f2bcf,JSON[_0x2ceb('0x11')](_0x3983fb));_0x37eb3c(_0x3983fb);})[_0x2ceb('0x20')](function(_0x79a51){logger[_0x2ceb('0x12')]('MoveContactManagedDialer',_0x79a51[_0x2ceb('0x14')],_0x3f2bcf);_0x27247b(_0x3c1c69[_0x2ceb('0x12')](0x1f4,_0x79a51[_0x2ceb('0x14')]));});});};exports[_0x2ceb('0x42')]=function(_0x39779f){var _0x47acbf=this;return new Promise(function(_0x4f502b,_0x48545e){return db[_0x2ceb('0x22')][_0x2ceb('0x17')]({'raw':_0x39779f[_0x2ceb('0x19')]?_0x39779f[_0x2ceb('0x19')][_0x2ceb('0x18')]===undefined?!![]:![]:!![],'where':_0x39779f['options']?_0x39779f[_0x2ceb('0x19')]['where']||null:null,'attributes':[[db[_0x2ceb('0x2b')]['fn'](_0x2ceb('0x43'),db[_0x2ceb('0x2b')]['fn']('IF',db[_0x2ceb('0x2b')][_0x2ceb('0x44')](_0x2ceb('0x45')+util[_0x2ceb('0x46')](_0x2ceb('0x47'),moment()['format'](_0x2ceb('0x48')))+_0x2ceb('0x49')))),_0x2ceb('0x4a')]]})[_0x2ceb('0x24')](function(_0x14a4e9){logger[_0x2ceb('0xd')]('CountReScheduled',_0x39779f);logger[_0x2ceb('0x1f')](_0x2ceb('0x42'),_0x39779f,JSON[_0x2ceb('0x11')](_0x14a4e9));_0x4f502b(_0x14a4e9);})[_0x2ceb('0x20')](function(_0x472b18){logger['error'](_0x2ceb('0x42'),_0x472b18['message'],_0x39779f);_0x48545e(_0x47acbf[_0x2ceb('0x12')](0x1f4,_0x472b18[_0x2ceb('0x14')]));});});};exports[_0x2ceb('0x4b')]=function(_0x124899){var _0x3b9e6d=this;return new Promise(function(_0x106acd,_0x37dce6){return db['CmContact']['describe']()[_0x2ceb('0x24')](function(_0x3f5950){return db[_0x2ceb('0x2b')]['transaction'](function(_0x325c9b){return db['CmHopper'][_0x2ceb('0x17')]({'where':_0x124899[_0x2ceb('0x19')]?_0x124899[_0x2ceb('0x19')]['where']||null:null,'attributes':_0x124899['options']?_0x124899[_0x2ceb('0x19')][_0x2ceb('0x1b')]||null:null,'limit':0x1,'order':_0x124899['options']?_0x124899[_0x2ceb('0x19')]['order']||null:null,'group':db[_0x2ceb('0x22')][_0x2ceb('0x38')],'transaction':_0x325c9b,'lock':_0x325c9b[_0x2ceb('0x2f')][_0x2ceb('0x4c')],'include':_0x124899[_0x2ceb('0x19')]?_0x124899[_0x2ceb('0x19')][_0x2ceb('0x1c')]?_[_0x2ceb('0x1d')](_0x124899['options'][_0x2ceb('0x1c')],function(_0x42300e){return{'model':db[_0x42300e[_0x2ceb('0x1e')]],'as':_0x42300e['as'],'attributes':_0x42300e['attributes'],'include':_0x42300e[_0x2ceb('0x1c')]?_[_0x2ceb('0x1d')](_0x42300e[_0x2ceb('0x1c')],function(_0x205b3c){return{'model':db[_0x205b3c[_0x2ceb('0x1e')]],'as':_0x205b3c['as'],'attributes':_0x205b3c[_0x2ceb('0x1b')],'include':_0x205b3c[_0x2ceb('0x1c')]?_['map'](_0x205b3c[_0x2ceb('0x1c')],function(_0x3e2b0a){return{'model':db[_0x3e2b0a[_0x2ceb('0x1e')]],'as':_0x3e2b0a['as'],'attributes':_0x3e2b0a[_0x2ceb('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x2ceb('0x24')](function(_0x145b72){var _0xb01254=[];for(var _0x55d3e2=0x0;_0x55d3e2<_0x145b72[_0x2ceb('0x37')];_0x55d3e2+=0x1){_0xb01254['push'](_0x145b72[_0x55d3e2][_0x2ceb('0x27')](_0x124899[_0x2ceb('0x25')],{'transaction':_0x325c9b}));}return BPromise[_0x2ceb('0x3b')](_0xb01254);});})['then'](function(_0x4bee7b){logger['info'](_0x2ceb('0x4b'),_0x124899);logger[_0x2ceb('0x1f')](_0x2ceb('0x4b'),_0x124899,JSON[_0x2ceb('0x11')](_0x4bee7b));_0x106acd(_0x4bee7b);})[_0x2ceb('0x20')](function(_0xeefce6){logger['error']('GetContactRecallMe',_0xeefce6[_0x2ceb('0x14')],_0x124899);_0x37dce6(_0x3b9e6d[_0x2ceb('0x12')](0x1f4,_0xeefce6[_0x2ceb('0x14')]));});});});};exports[_0x2ceb('0x4d')]=function(_0x3c3741){var _0x405908=this;return new Promise(function(_0x1d8d00,_0x3febe3){db[_0x2ceb('0x30')]['describe']()['then'](function(_0x4c3c49){return db[_0x2ceb('0x22')][_0x2ceb('0x17')]({'raw':_0x3c3741[_0x2ceb('0x19')]?_0x3c3741['options'][_0x2ceb('0x18')]===undefined?!![]:![]:!![],'where':_0x3c3741[_0x2ceb('0x19')]?_0x3c3741['options'][_0x2ceb('0x1a')]||null:null,'attributes':_0x3c3741[_0x2ceb('0x19')]?_0x3c3741[_0x2ceb('0x19')]['attributes']||null:null,'limit':_0x3c3741[_0x2ceb('0x19')]?_0x3c3741[_0x2ceb('0x19')][_0x2ceb('0x2d')]||null:null,'include':_0x3c3741[_0x2ceb('0x19')]?_0x3c3741['options'][_0x2ceb('0x1c')]?_[_0x2ceb('0x1d')](_0x3c3741['options'][_0x2ceb('0x1c')],function(_0x24763d){return{'model':db[_0x24763d[_0x2ceb('0x1e')]],'as':_0x24763d['as'],'attributes':_0x24763d['as']===_0x2ceb('0x31')?_[_0x2ceb('0x32')](_0x4c3c49):_0x24763d[_0x2ceb('0x1b')],'include':_0x24763d[_0x2ceb('0x1c')]?_['map'](_0x24763d[_0x2ceb('0x1c')],function(_0x5c8cbf){return{'model':db[_0x5c8cbf[_0x2ceb('0x1e')]],'as':_0x5c8cbf['as'],'attributes':_0x5c8cbf[_0x2ceb('0x1b')],'include':_0x5c8cbf['include']?_[_0x2ceb('0x1d')](_0x5c8cbf[_0x2ceb('0x1c')],function(_0x3d3aef){return{'model':db[_0x3d3aef[_0x2ceb('0x1e')]],'as':_0x3d3aef['as'],'attributes':_0x3d3aef[_0x2ceb('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x2ceb('0x24')](function(_0xa2f059){logger[_0x2ceb('0xd')](_0x2ceb('0x16'),_0x3c3741);logger[_0x2ceb('0x1f')](_0x2ceb('0x16'),_0x3c3741,JSON[_0x2ceb('0x11')](_0xa2f059));_0x1d8d00(_0xa2f059);})[_0x2ceb('0x20')](function(_0x5e4a1f){logger[_0x2ceb('0x12')]('GetCmHopper',_0x5e4a1f['message'],_0x3c3741);_0x3febe3(_0x405908['error'](0x1f4,_0x5e4a1f['message']));});});});};exports[_0x2ceb('0x4e')]=function(_0x2de0b9){var _0x138dd2=this;return new Promise(function(_0x5d2a67,_0x24f83a){return db['CmContact'][_0x2ceb('0x4f')]({'raw':!![],'where':{'phone':_0x2de0b9[_0x2ceb('0x19')][_0x2ceb('0x1a')][_0x2ceb('0x50')]},'attributes':['id',_0x2ceb('0x51')],'order':[['id',_0x2ceb('0x52')]]})[_0x2ceb('0x24')](function(_0x5ecc6d){logger[_0x2ceb('0xd')](_0x2ceb('0x53'),_0x2de0b9);logger[_0x2ceb('0x1f')](_0x2ceb('0x53'),_0x2de0b9,JSON[_0x2ceb('0x11')](_0x5ecc6d));_0x5d2a67(_0x5ecc6d);})['catch'](function(_0x30eb34){logger[_0x2ceb('0x12')](_0x2ceb('0x53'),_0x30eb34[_0x2ceb('0x14')],_0x2de0b9);_0x24f83a(_0x138dd2['error'](0x1f4,_0x30eb34[_0x2ceb('0x14')]));});});};exports[_0x2ceb('0x54')]=function(_0x1ea07a){var _0x4d37ba=this;return new Promise(function(_0x3a2782,_0x17d122){return db[_0x2ceb('0x2b')][_0x2ceb('0x2c')](function(_0x2d92f){return db['CmHopper'][_0x2ceb('0x27')]({'active':![]},{'where':{},'transaction':_0x2d92f})[_0x2ceb('0x24')](function(_0x49016e){logger[_0x2ceb('0xd')](_0x2ceb('0x54'),_0x1ea07a);logger[_0x2ceb('0x1f')](_0x2ceb('0x54'),_0x1ea07a,JSON[_0x2ceb('0x11')](_0x49016e));_0x3a2782(_0x49016e);})[_0x2ceb('0x20')](function(_0x2479d7){logger[_0x2ceb('0x12')](_0x2ceb('0x54'),_0x2479d7['message'],_0x1ea07a);_0x17d122(_0x4d37ba[_0x2ceb('0x12')](0x1f4,_0x2479d7['message']));});});});};exports[_0x2ceb('0x55')]=function(_0x4fcad6){var _0xc9bd76=this;var _0x567865=_0x4fcad6[_0x2ceb('0x25')]['where'][_0x2ceb('0x56')];var _0x578506=_0x4fcad6[_0x2ceb('0x25')][_0x2ceb('0x1a')][_0x2ceb('0x57')];return new Promise(function(_0x44328a,_0x422547){return db[_0x2ceb('0x22')]['findAll']({'where':{'voiceQueueId':_0x567865,'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$lte':db['sequelize'][_0x2ceb('0x44')](_0x2ceb('0x58')+_0x578506+_0x2ceb('0x59'))}},'include':[{'model':db[_0x2ceb('0x30')],'as':_0x2ceb('0x31')},{'model':db[_0x2ceb('0x33')],'as':'Agent','attributes':['id',_0x2ceb('0x35'),_0x2ceb('0x36')]},{'model':db['CmList'],'as':_0x2ceb('0x5a')}]})[_0x2ceb('0x24')](function(_0xae8e1d){return db['sequelize'][_0x2ceb('0x2c')](function(_0xf00da0){return db[_0x2ceb('0x22')][_0x2ceb('0x27')]({'recallmeNotifiedDate':new Date()},{'where':{'voiceQueueId':_0x567865,'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$lte':db[_0x2ceb('0x2b')][_0x2ceb('0x44')](_0x2ceb('0x58')+_0x578506+_0x2ceb('0x59'))}},'transaction':_0xf00da0})[_0x2ceb('0x24')](function(_0xccf693){_0x44328a(_0xae8e1d);})[_0x2ceb('0x20')](function(_0x4a0a48){logger[_0x2ceb('0x12')]('CmHopperHandlePreviewRecallNotifications',_0x4a0a48[_0x2ceb('0x14')],_0x4fcad6);_0x422547(validateExpressRequest);});});})[_0x2ceb('0x20')](function(_0x159492){logger['error']('CmHopperHandlePreviewRecallNotifications',_0x159492[_0x2ceb('0x14')],_0x4fcad6);_0x422547(_0xc9bd76[_0x2ceb('0x12')](0x1f4,_0x159492['message']));});});};
\ No newline at end of file
+var _0xc28a=['User','name','length','UserId','push','update','all','dataValues','ContactId','MoveContactManagedDialer','CmHopperFinal','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','order','GetCmHopperPreview','keys','GetContactByPhone','phone','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueId','interval','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','voicePause','CmList','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','twilio/lib/webhooks/webhooks','client','request','info','CmHopper,\x20%s,\x20%s','request\x20sent','debug','CmHopper,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','GetCmHopper','CmHopper','findAll','options','where','attributes','map','include','model','then','ShowCmHopper','find','raw','create','CreateCmHopper','UpdateCmHopper','limit','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','body','active','DestroyCmHopper','destroy','GetContactDialer','describe','sequelize','transaction','LOCK','UPDATE','CmContact','Contact'];(function(_0x125555,_0x52ea4c){var _0xd0f5b9=function(_0x1e0e2a){while(--_0x1e0e2a){_0x125555['push'](_0x125555['shift']());}};_0xd0f5b9(++_0x52ea4c);}(_0xc28a,0xd8));var _0xac28=function(_0x30ea35,_0x31d5bd){_0x30ea35=_0x30ea35-0x0;var _0x5935d6=_0xc28a[_0x30ea35];return _0x5935d6;};'use strict';var _=require(_0xac28('0x0'));var util=require('util');var moment=require(_0xac28('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xac28('0x2'));var db=require(_0xac28('0x3'))['db'];var utils=require(_0xac28('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xac28('0x5'));var jayson=require(_0xac28('0x6'));const {validateExpressRequest}=require(_0xac28('0x7'));var client=jayson[_0xac28('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x575d17,_0x2bbd6a,_0xb4c6f){return new BPromise(function(_0x5d56e5,_0x3ad96a){return client[_0xac28('0x9')](_0x575d17,_0xb4c6f)['then'](function(_0x4657b2){logger[_0xac28('0xa')](_0xac28('0xb'),_0x2bbd6a,_0xac28('0xc'));logger[_0xac28('0xd')](_0xac28('0xe'),_0x2bbd6a,_0xac28('0xc'),JSON[_0xac28('0xf')](_0x4657b2));if(_0x4657b2['error']){if(_0x4657b2['error'][_0xac28('0x10')]===0x1f4){logger['error'](_0xac28('0xb'),_0x2bbd6a,_0x4657b2[_0xac28('0x11')]['message']);return _0x3ad96a(_0x4657b2[_0xac28('0x11')][_0xac28('0x12')]);}logger['error'](_0xac28('0xb'),_0x2bbd6a,_0x4657b2[_0xac28('0x11')][_0xac28('0x12')]);return _0x5d56e5(_0x4657b2[_0xac28('0x11')][_0xac28('0x12')]);}else{logger['info'](_0xac28('0xb'),_0x2bbd6a,'request\x20sent');_0x5d56e5(_0x4657b2[_0xac28('0x13')][_0xac28('0x12')]);}})[_0xac28('0x14')](function(_0x373df2){logger[_0xac28('0x11')](_0xac28('0xb'),_0x2bbd6a,_0x373df2);_0x3ad96a(_0x373df2);});});}exports[_0xac28('0x15')]=function(_0x1dde13){var _0x21cc08=this;return new Promise(function(_0x44242f,_0x3e834e){return db[_0xac28('0x16')][_0xac28('0x17')]({'raw':_0x1dde13[_0xac28('0x18')]?_0x1dde13[_0xac28('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x1dde13[_0xac28('0x18')]?_0x1dde13['options'][_0xac28('0x19')]||null:null,'attributes':_0x1dde13[_0xac28('0x18')]?_0x1dde13[_0xac28('0x18')][_0xac28('0x1a')]||null:null,'limit':_0x1dde13[_0xac28('0x18')]?_0x1dde13[_0xac28('0x18')]['limit']||null:null,'include':_0x1dde13[_0xac28('0x18')]?_0x1dde13[_0xac28('0x18')]['include']?_[_0xac28('0x1b')](_0x1dde13[_0xac28('0x18')][_0xac28('0x1c')],function(_0x615533){return{'model':db[_0x615533['model']],'as':_0x615533['as'],'attributes':_0x615533[_0xac28('0x1a')],'include':_0x615533['include']?_['map'](_0x615533[_0xac28('0x1c')],function(_0x3b46e3){return{'model':db[_0x3b46e3[_0xac28('0x1d')]],'as':_0x3b46e3['as'],'attributes':_0x3b46e3[_0xac28('0x1a')],'include':_0x3b46e3['include']?_[_0xac28('0x1b')](_0x3b46e3[_0xac28('0x1c')],function(_0x267136){return{'model':db[_0x267136[_0xac28('0x1d')]],'as':_0x267136['as'],'attributes':_0x267136[_0xac28('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xac28('0x1e')](function(_0x4ab838){logger[_0xac28('0xa')](_0xac28('0x15'),_0x1dde13);logger[_0xac28('0xd')](_0xac28('0x15'),_0x1dde13,JSON[_0xac28('0xf')](_0x4ab838));_0x44242f(_0x4ab838);})['catch'](function(_0xd2c8c8){logger['error']('GetCmHopper',_0xd2c8c8[_0xac28('0x12')],_0x1dde13);_0x3e834e(_0x21cc08[_0xac28('0x11')](0x1f4,_0xd2c8c8[_0xac28('0x12')]));});});};exports[_0xac28('0x1f')]=function(_0x2b5d1f){var _0x5f4d9a=this;return new Promise(function(_0xa6a783,_0x4ff5ec){return db['CmHopper'][_0xac28('0x20')]({'raw':_0x2b5d1f[_0xac28('0x18')]?_0x2b5d1f[_0xac28('0x18')][_0xac28('0x21')]===undefined?!![]:![]:!![],'where':_0x2b5d1f[_0xac28('0x18')]?_0x2b5d1f['options'][_0xac28('0x19')]||null:null,'attributes':_0x2b5d1f[_0xac28('0x18')]?_0x2b5d1f['options']['attributes']||null:null,'include':_0x2b5d1f['options']?_0x2b5d1f[_0xac28('0x18')][_0xac28('0x1c')]?_[_0xac28('0x1b')](_0x2b5d1f[_0xac28('0x18')][_0xac28('0x1c')],function(_0x363339){return{'model':db[_0x363339[_0xac28('0x1d')]],'as':_0x363339['as'],'attributes':_0x363339[_0xac28('0x1a')],'include':_0x363339[_0xac28('0x1c')]?_[_0xac28('0x1b')](_0x363339['include'],function(_0x105306){return{'model':db[_0x105306[_0xac28('0x1d')]],'as':_0x105306['as'],'attributes':_0x105306['attributes'],'include':_0x105306[_0xac28('0x1c')]?_['map'](_0x105306[_0xac28('0x1c')],function(_0x2c7c35){return{'model':db[_0x2c7c35[_0xac28('0x1d')]],'as':_0x2c7c35['as'],'attributes':_0x2c7c35['attributes']};}):[]};}):[]};}):[]:[]})[_0xac28('0x1e')](function(_0x4b663b){logger['info']('ShowCmHopper',_0x2b5d1f);logger[_0xac28('0xd')]('ShowCmHopper',_0x2b5d1f,JSON[_0xac28('0xf')](_0x4b663b));_0xa6a783(_0x4b663b);})[_0xac28('0x14')](function(_0x378d53){logger[_0xac28('0x11')](_0xac28('0x1f'),_0x378d53[_0xac28('0x12')],_0x2b5d1f);_0x4ff5ec(_0x5f4d9a[_0xac28('0x11')](0x1f4,_0x378d53[_0xac28('0x12')]));});});};exports['CreateCmHopper']=function(_0x401f1c){var _0x2f9524=this;return new Promise(function(_0x13a72f,_0x4cb73d){return db[_0xac28('0x16')][_0xac28('0x22')](_0x401f1c['body'],{'raw':_0x401f1c[_0xac28('0x18')]?_0x401f1c[_0xac28('0x18')][_0xac28('0x21')]===undefined?!![]:![]:!![]})[_0xac28('0x1e')](function(_0x3537cb){logger['info'](_0xac28('0x23'),_0x401f1c);logger[_0xac28('0xd')]('CreateCmHopper',_0x401f1c,JSON[_0xac28('0xf')](_0x3537cb));_0x13a72f(_0x3537cb);})[_0xac28('0x14')](function(_0x958fe5){logger['error'](_0xac28('0x23'),_0x958fe5[_0xac28('0x12')],_0x401f1c);_0x4cb73d(_0x2f9524[_0xac28('0x11')](0x1f4,_0x958fe5['message']));});});};exports[_0xac28('0x24')]=function(_0x2e7b1a){var _0x627269=this;return new Promise(function(_0x2f095e,_0x2e1025){return db['CmHopper']['update'](_0x2e7b1a['body'],{'raw':_0x2e7b1a[_0xac28('0x18')]?_0x2e7b1a[_0xac28('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2e7b1a[_0xac28('0x18')]?_0x2e7b1a[_0xac28('0x18')]['where']||null:null,'attributes':_0x2e7b1a['options']?_0x2e7b1a[_0xac28('0x18')][_0xac28('0x1a')]||null:null,'limit':_0x2e7b1a[_0xac28('0x18')]?_0x2e7b1a[_0xac28('0x18')][_0xac28('0x25')]||null:null})[_0xac28('0x1e')](function(_0x2c849e){logger[_0xac28('0xa')](_0xac28('0x24'),_0x2e7b1a);logger['info'](_0xac28('0x26'),JSON[_0xac28('0xf')](_0x2e7b1a[_0xac28('0x18')][_0xac28('0x19')]),_0x2e7b1a[_0xac28('0x27')][_0xac28('0x28')]);logger[_0xac28('0xd')]('UpdateCmHopper',_0x2e7b1a,JSON['stringify'](_0x2c849e));_0x2f095e(_0x2c849e);})['catch'](function(_0x40c03c){logger[_0xac28('0x11')]('UpdateCmHopper',_0x40c03c[_0xac28('0x12')],_0x2e7b1a);_0x2e1025(_0x627269[_0xac28('0x11')](0x1f4,_0x40c03c['message']));});});};exports[_0xac28('0x29')]=function(_0x312c74){var _0x54168e=this;return new Promise(function(_0x27f4f2,_0x229ceb){return db[_0xac28('0x16')][_0xac28('0x2a')]({'where':_0x312c74[_0xac28('0x18')]?_0x312c74[_0xac28('0x18')][_0xac28('0x19')]||null:null})[_0xac28('0x1e')](function(_0x10293f){logger['info'](_0xac28('0x29'),_0x312c74);logger[_0xac28('0xd')]('DestroyCmHopper',_0x312c74,JSON[_0xac28('0xf')](_0x10293f));_0x27f4f2(_0x10293f);})[_0xac28('0x14')](function(_0x212ac2){logger[_0xac28('0x11')](_0xac28('0x29'),_0x212ac2['message'],_0x312c74);_0x229ceb(_0x54168e[_0xac28('0x11')](0x1f4,_0x212ac2[_0xac28('0x12')]));});});};exports[_0xac28('0x2b')]=function(_0x2638b9){var _0x3c6a0a=this;return new Promise(function(_0x4393b3,_0x3b4c8c){return db['CmContact'][_0xac28('0x2c')]()[_0xac28('0x1e')](function(_0x44ff81){return db[_0xac28('0x2d')][_0xac28('0x2e')](function(_0x2ae55d){return db[_0xac28('0x16')]['findAll']({'where':_0x2638b9[_0xac28('0x18')]?_0x2638b9[_0xac28('0x18')][_0xac28('0x19')]||null:null,'attributes':_0x2638b9[_0xac28('0x18')]?_0x2638b9['options'][_0xac28('0x1a')]||null:null,'limit':_0x2638b9['options']?_0x2638b9[_0xac28('0x18')][_0xac28('0x25')]||null:null,'order':_0x2638b9['options']?_0x2638b9[_0xac28('0x18')]['order']||null:null,'transaction':_0x2ae55d,'lock':_0x2ae55d[_0xac28('0x2f')][_0xac28('0x30')],'include':[{'model':db[_0xac28('0x31')],'as':_0xac28('0x32'),'attributes':_['keys'](_0x44ff81)},{'model':db[_0xac28('0x33')],'as':'Agent','attributes':['id',_0xac28('0x34'),'voicePause']}]})[_0xac28('0x1e')](function(_0x319de6){var _0x17e940=[];var _0x3cc9b4=[];for(var _0x3d8241=0x0;_0x3d8241<_0x319de6[_0xac28('0x35')];_0x3d8241+=0x1){var _0x374bb1=_0x319de6[_0x3d8241][_0xac28('0x36')];if(_0x374bb1===null){_0x17e940[_0xac28('0x37')](_0x319de6[_0x3d8241]['update'](_0x2638b9[_0xac28('0x27')],{'transaction':_0x2ae55d}));}else if(!_0x3cc9b4['includes'](_0x374bb1)){_0x3cc9b4['push'](_0x374bb1);_0x17e940[_0xac28('0x37')](_0x319de6[_0x3d8241][_0xac28('0x38')](_0x2638b9[_0xac28('0x27')],{'transaction':_0x2ae55d}));}}return BPromise[_0xac28('0x39')](_0x17e940);});})['then'](function(_0x3f90a2){logger['info']('GetContactDialer',_0x2638b9);if(_0x3f90a2[_0xac28('0x35')]>0x0){logger[_0xac28('0xa')]('GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]',_0x3f90a2[0x0][_0xac28('0x3a')]['id'],_0x3f90a2[0x0][_0xac28('0x3a')][_0xac28('0x3b')],_0x3f90a2[0x0][_0xac28('0x3a')][_0xac28('0x28')]);}logger['debug'](_0xac28('0x2b'),_0x2638b9,JSON[_0xac28('0xf')](_0x3f90a2));_0x4393b3(_0x3f90a2);})[_0xac28('0x14')](function(_0x305354){logger[_0xac28('0x11')](_0xac28('0x2b'),_0x305354[_0xac28('0x12')],_0x2638b9);_0x3b4c8c(_0x3c6a0a[_0xac28('0x11')](0x1f4,_0x305354[_0xac28('0x12')]));});});});};exports[_0xac28('0x3c')]=function(_0x1244e7){var _0xe2d246=this;return new Promise(function(_0x2ac2c2,_0x1374a0){return db['sequelize']['transaction'](function(_0x32d0f7){return db[_0xac28('0x3d')][_0xac28('0x22')](_0x1244e7[_0xac28('0x27')],{'raw':_0x1244e7[_0xac28('0x18')]?_0x1244e7[_0xac28('0x18')][_0xac28('0x21')]===undefined?!![]:![]:!![],'transaction':_0x32d0f7})[_0xac28('0x1e')](function(){logger[_0xac28('0xa')](_0xac28('0x3e'),JSON['stringify'](_0x1244e7['options'][_0xac28('0x19')]),_0x1244e7[_0xac28('0x18')]['where'][_0xac28('0x28')]);return db['CmHopper'][_0xac28('0x2a')]({'where':_0x1244e7[_0xac28('0x18')]?_0x1244e7['options']['where']||null:null,'transaction':_0x32d0f7});});})[_0xac28('0x1e')](function(_0x410fcd){logger[_0xac28('0xa')]('MoveContactManagedDialer',_0x1244e7);logger['debug'](_0xac28('0x3c'),_0x1244e7,JSON['stringify'](_0x410fcd));_0x2ac2c2(_0x410fcd);})[_0xac28('0x14')](function(_0x380162){logger[_0xac28('0x11')](_0xac28('0x3c'),_0x380162[_0xac28('0x12')],_0x1244e7);_0x1374a0(_0xe2d246[_0xac28('0x11')](0x1f4,_0x380162['message']));});});};exports[_0xac28('0x3f')]=function(_0x9009a4){var _0x40e87c=this;return new Promise(function(_0x5569db,_0x54d06a){return db['CmHopper'][_0xac28('0x17')]({'raw':_0x9009a4[_0xac28('0x18')]?_0x9009a4[_0xac28('0x18')][_0xac28('0x21')]===undefined?!![]:![]:!![],'where':_0x9009a4[_0xac28('0x18')]?_0x9009a4[_0xac28('0x18')][_0xac28('0x19')]||null:null,'attributes':[[db[_0xac28('0x2d')]['fn'](_0xac28('0x40'),db['sequelize']['fn']('IF',db[_0xac28('0x2d')][_0xac28('0x41')](_0xac28('0x42')+util[_0xac28('0x43')](_0xac28('0x44'),moment()[_0xac28('0x43')](_0xac28('0x45')))+_0xac28('0x46')))),_0xac28('0x47')]]})['then'](function(_0x3fcf71){logger[_0xac28('0xa')](_0xac28('0x3f'),_0x9009a4);logger[_0xac28('0xd')](_0xac28('0x3f'),_0x9009a4,JSON['stringify'](_0x3fcf71));_0x5569db(_0x3fcf71);})[_0xac28('0x14')](function(_0x546b7c){logger['error']('CountReScheduled',_0x546b7c['message'],_0x9009a4);_0x54d06a(_0x40e87c[_0xac28('0x11')](0x1f4,_0x546b7c['message']));});});};exports[_0xac28('0x48')]=function(_0x1e2653){var _0x26c916=this;return new Promise(function(_0x16e93e,_0x3dfd60){return db['CmContact'][_0xac28('0x2c')]()[_0xac28('0x1e')](function(_0x3d5ebd){return db['sequelize'][_0xac28('0x2e')](function(_0x497d1c){return db['CmHopper'][_0xac28('0x17')]({'where':_0x1e2653[_0xac28('0x18')]?_0x1e2653[_0xac28('0x18')][_0xac28('0x19')]||null:null,'attributes':_0x1e2653[_0xac28('0x18')]?_0x1e2653[_0xac28('0x18')][_0xac28('0x1a')]||null:null,'limit':0x1,'order':_0x1e2653[_0xac28('0x18')]?_0x1e2653['options'][_0xac28('0x49')]||null:null,'group':db[_0xac28('0x16')]['UserId'],'transaction':_0x497d1c,'lock':_0x497d1c['LOCK'][_0xac28('0x30')],'include':_0x1e2653['options']?_0x1e2653[_0xac28('0x18')][_0xac28('0x1c')]?_[_0xac28('0x1b')](_0x1e2653['options']['include'],function(_0x341b92){return{'model':db[_0x341b92[_0xac28('0x1d')]],'as':_0x341b92['as'],'attributes':_0x341b92[_0xac28('0x1a')],'include':_0x341b92[_0xac28('0x1c')]?_[_0xac28('0x1b')](_0x341b92[_0xac28('0x1c')],function(_0x38302f){return{'model':db[_0x38302f[_0xac28('0x1d')]],'as':_0x38302f['as'],'attributes':_0x38302f[_0xac28('0x1a')],'include':_0x38302f['include']?_[_0xac28('0x1b')](_0x38302f[_0xac28('0x1c')],function(_0x5e5d18){return{'model':db[_0x5e5d18['model']],'as':_0x5e5d18['as'],'attributes':_0x5e5d18[_0xac28('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xe59e49){var _0x4be6bb=[];for(var _0x2ec857=0x0;_0x2ec857<_0xe59e49['length'];_0x2ec857+=0x1){_0x4be6bb[_0xac28('0x37')](_0xe59e49[_0x2ec857]['update'](_0x1e2653[_0xac28('0x27')],{'transaction':_0x497d1c}));}return BPromise[_0xac28('0x39')](_0x4be6bb);});})[_0xac28('0x1e')](function(_0x47d475){logger[_0xac28('0xa')]('GetContactRecallMe',_0x1e2653);logger[_0xac28('0xd')](_0xac28('0x48'),_0x1e2653,JSON[_0xac28('0xf')](_0x47d475));_0x16e93e(_0x47d475);})[_0xac28('0x14')](function(_0x337509){logger[_0xac28('0x11')]('GetContactRecallMe',_0x337509[_0xac28('0x12')],_0x1e2653);_0x3dfd60(_0x26c916[_0xac28('0x11')](0x1f4,_0x337509[_0xac28('0x12')]));});});});};exports[_0xac28('0x4a')]=function(_0x309c5b){var _0x19b06f=this;return new Promise(function(_0x5f29ee,_0x270d72){db[_0xac28('0x31')][_0xac28('0x2c')]()[_0xac28('0x1e')](function(_0x163bf2){return db[_0xac28('0x16')]['findAll']({'raw':_0x309c5b[_0xac28('0x18')]?_0x309c5b['options'][_0xac28('0x21')]===undefined?!![]:![]:!![],'where':_0x309c5b[_0xac28('0x18')]?_0x309c5b[_0xac28('0x18')][_0xac28('0x19')]||null:null,'attributes':_0x309c5b[_0xac28('0x18')]?_0x309c5b[_0xac28('0x18')]['attributes']||null:null,'limit':_0x309c5b[_0xac28('0x18')]?_0x309c5b['options'][_0xac28('0x25')]||null:null,'include':_0x309c5b[_0xac28('0x18')]?_0x309c5b[_0xac28('0x18')][_0xac28('0x1c')]?_['map'](_0x309c5b[_0xac28('0x18')][_0xac28('0x1c')],function(_0x53d078){return{'model':db[_0x53d078[_0xac28('0x1d')]],'as':_0x53d078['as'],'attributes':_0x53d078['as']===_0xac28('0x32')?_[_0xac28('0x4b')](_0x163bf2):_0x53d078['attributes'],'include':_0x53d078[_0xac28('0x1c')]?_['map'](_0x53d078[_0xac28('0x1c')],function(_0x59116a){return{'model':db[_0x59116a[_0xac28('0x1d')]],'as':_0x59116a['as'],'attributes':_0x59116a[_0xac28('0x1a')],'include':_0x59116a[_0xac28('0x1c')]?_[_0xac28('0x1b')](_0x59116a[_0xac28('0x1c')],function(_0x3f14ed){return{'model':db[_0x3f14ed[_0xac28('0x1d')]],'as':_0x3f14ed['as'],'attributes':_0x3f14ed[_0xac28('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xac28('0x1e')](function(_0x478f19){logger[_0xac28('0xa')]('GetCmHopper',_0x309c5b);logger[_0xac28('0xd')](_0xac28('0x15'),_0x309c5b,JSON['stringify'](_0x478f19));_0x5f29ee(_0x478f19);})['catch'](function(_0x47946c){logger['error'](_0xac28('0x15'),_0x47946c['message'],_0x309c5b);_0x270d72(_0x19b06f[_0xac28('0x11')](0x1f4,_0x47946c[_0xac28('0x12')]));});});});};exports[_0xac28('0x4c')]=function(_0x2d31b1){var _0x4644e2=this;return new Promise(function(_0xd2d134,_0x4c508f){return db[_0xac28('0x31')]['findOne']({'raw':!![],'where':{'phone':_0x2d31b1['options'][_0xac28('0x19')][_0xac28('0x4d')]},'attributes':['id',_0xac28('0x4e')],'order':[['id',_0xac28('0x4f')]]})[_0xac28('0x1e')](function(_0x100fa1){logger[_0xac28('0xa')]('getContactByPhone',_0x2d31b1);logger[_0xac28('0xd')](_0xac28('0x50'),_0x2d31b1,JSON[_0xac28('0xf')](_0x100fa1));_0xd2d134(_0x100fa1);})[_0xac28('0x14')](function(_0x3ba179){logger[_0xac28('0x11')](_0xac28('0x50'),_0x3ba179[_0xac28('0x12')],_0x2d31b1);_0x4c508f(_0x4644e2[_0xac28('0x11')](0x1f4,_0x3ba179[_0xac28('0x12')]));});});};exports[_0xac28('0x51')]=function(_0x10894c){var _0x5e91dd=this;return new Promise(function(_0x576e95,_0x15aa2d){return db[_0xac28('0x2d')]['transaction'](function(_0x1d1792){return db[_0xac28('0x16')][_0xac28('0x38')]({'active':![]},{'where':{},'transaction':_0x1d1792})[_0xac28('0x1e')](function(_0x10b0e5){logger[_0xac28('0xa')](_0xac28('0x51'),_0x10894c);logger[_0xac28('0xd')](_0xac28('0x51'),_0x10894c,JSON[_0xac28('0xf')](_0x10b0e5));_0x576e95(_0x10b0e5);})[_0xac28('0x14')](function(_0x1c099c){logger['error'](_0xac28('0x51'),_0x1c099c[_0xac28('0x12')],_0x10894c);_0x15aa2d(_0x5e91dd[_0xac28('0x11')](0x1f4,_0x1c099c[_0xac28('0x12')]));});});});};exports[_0xac28('0x52')]=function(_0x4dfdaf){var _0x1f4131=this;var _0x5f20ba=_0x4dfdaf[_0xac28('0x27')][_0xac28('0x19')][_0xac28('0x53')];var _0x30c2d1=_0x4dfdaf[_0xac28('0x27')]['where'][_0xac28('0x54')];return new Promise(function(_0x395a62,_0x4d613c){return db[_0xac28('0x16')]['findAll']({'where':{'voiceQueueId':_0x5f20ba,'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$lte':db[_0xac28('0x2d')][_0xac28('0x41')](_0xac28('0x55')+_0x30c2d1+_0xac28('0x56'))}},'include':[{'model':db[_0xac28('0x31')],'as':'Contact'},{'model':db[_0xac28('0x33')],'as':'Agent','attributes':['id',_0xac28('0x34'),_0xac28('0x57')]},{'model':db[_0xac28('0x58')],'as':'List'}]})[_0xac28('0x1e')](function(_0x242fff){return db[_0xac28('0x2d')]['transaction'](function(_0x7d3058){return db[_0xac28('0x16')][_0xac28('0x38')]({'recallmeNotifiedDate':new Date()},{'where':{'voiceQueueId':_0x5f20ba,'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$lte':db[_0xac28('0x2d')]['literal'](_0xac28('0x55')+_0x30c2d1+_0xac28('0x56'))}},'transaction':_0x7d3058})[_0xac28('0x1e')](function(_0x3182f4){_0x395a62(_0x242fff);})[_0xac28('0x14')](function(_0xf18f1){logger[_0xac28('0x11')](_0xac28('0x52'),_0xf18f1[_0xac28('0x12')],_0x4dfdaf);_0x4d613c(validateExpressRequest);});});})[_0xac28('0x14')](function(_0x42aac0){logger[_0xac28('0x11')](_0xac28('0x52'),_0x42aac0[_0xac28('0x12')],_0x4dfdaf);_0x4d613c(_0x1f4131[_0xac28('0x11')](0x1f4,_0x42aac0['message']));});});};
\ No newline at end of file