Built motion from commit ba71417a.|2.6.28
[motion2.git] / server / api / cmHopper / cmHopper.rpc.js
1 // *************************************************************************
2 // *                                                                       *
3 // * xCALLY Motion -  The Omnichannel Contact Center                       *
4 // * Copyright (c) Xenialab s.r.l. All Rights Reserved                     *
5 // *                                                                       *
6 // *************************************************************************
7 // *                                                                       *
8 // * Email: info@xcally.com                                                *
9 // * Website: https://www.xcally.com                                       *
10 // *                                                                       *
11 // *************************************************************************
12 // *                                                                       *
13 // * The SOFTWARE PRODUCT is protected by copyright laws and international *
14 // * copyright treaties, as well as other intellectual property laws and   *
15 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                         *
16 // *                                                                       *
17 // *************************************************************************
18 var _0xfaf3=['attributes','limit','include','model','map','then','info','debug','stringify','catch','error','message','find','ShowCmHopper','body','CreateCmHopper','UpdateCmHopper','update','active','DestroyCmHopper','destroy','GetContactDialer','describe','sequelize','transaction','findAll','order','LOCK','UPDATE','keys','User','Agent','name','voicePause','length','UserId','push','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','`scheduledat`\x20>=\x20','format','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','CmContact','Contact','GetContactByPhone','findOne','phone','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','voiceQueueIds','interval','availableAgentsIds','NOW()\x20+\x20INTERVAL\x20','CmList','List','NOW()','CmHopperHandlePreviewRecallNotifications','util','bluebird','../../mysqldb','rpc','GetCmHopper','CmHopper','options','raw','where'];(function(_0x225d8b,_0x3e2f19){var _0x29c7bf=function(_0x796947){while(--_0x796947){_0x225d8b['push'](_0x225d8b['shift']());}};_0x29c7bf(++_0x3e2f19);}(_0xfaf3,0x137));var _0x3faf=function(_0x547382,_0x5b134f){_0x547382=_0x547382-0x0;var _0x5d174d=_0xfaf3[_0x547382];return _0x5d174d;};'use strict';var _=require('lodash');var util=require(_0x3faf('0x0'));var moment=require('moment');var BPromise=require(_0x3faf('0x1'));var db=require(_0x3faf('0x2'))['db'];var logger=require('../../config/logger')(_0x3faf('0x3'));exports[_0x3faf('0x4')]=function(_0x4e177b){var _0x4e2fc6=this;return new Promise(function(_0x552ffb,_0x587b5e){return db[_0x3faf('0x5')]['findAll']({'raw':_0x4e177b[_0x3faf('0x6')]?_0x4e177b[_0x3faf('0x6')][_0x3faf('0x7')]===undefined?!![]:![]:!![],'where':_0x4e177b[_0x3faf('0x6')]?_0x4e177b['options'][_0x3faf('0x8')]||null:null,'attributes':_0x4e177b[_0x3faf('0x6')]?_0x4e177b[_0x3faf('0x6')][_0x3faf('0x9')]||null:null,'limit':_0x4e177b[_0x3faf('0x6')]?_0x4e177b[_0x3faf('0x6')][_0x3faf('0xa')]||null:null,'include':_0x4e177b['options']?_0x4e177b[_0x3faf('0x6')][_0x3faf('0xb')]?_['map'](_0x4e177b[_0x3faf('0x6')]['include'],function(_0x20e99b){return{'model':db[_0x20e99b[_0x3faf('0xc')]],'as':_0x20e99b['as'],'attributes':_0x20e99b[_0x3faf('0x9')],'include':_0x20e99b[_0x3faf('0xb')]?_[_0x3faf('0xd')](_0x20e99b[_0x3faf('0xb')],function(_0x11cdb1){return{'model':db[_0x11cdb1[_0x3faf('0xc')]],'as':_0x11cdb1['as'],'attributes':_0x11cdb1[_0x3faf('0x9')],'include':_0x11cdb1['include']?_[_0x3faf('0xd')](_0x11cdb1[_0x3faf('0xb')],function(_0x48c866){return{'model':db[_0x48c866[_0x3faf('0xc')]],'as':_0x48c866['as'],'attributes':_0x48c866[_0x3faf('0x9')]};}):[]};}):[]};}):[]:[]})[_0x3faf('0xe')](function(_0x1c4908){logger[_0x3faf('0xf')](_0x3faf('0x4'),_0x4e177b);logger[_0x3faf('0x10')]('GetCmHopper',_0x4e177b,JSON[_0x3faf('0x11')](_0x1c4908));_0x552ffb(_0x1c4908);})[_0x3faf('0x12')](function(_0x4e0af3){logger[_0x3faf('0x13')]('GetCmHopper',_0x4e0af3['message'],_0x4e177b);_0x587b5e(_0x4e2fc6[_0x3faf('0x13')](0x1f4,_0x4e0af3[_0x3faf('0x14')]));});});};exports['ShowCmHopper']=function(_0x7f4320){var _0x1fd9e2=this;return new Promise(function(_0x57b23f,_0x4e768e){return db[_0x3faf('0x5')][_0x3faf('0x15')]({'raw':_0x7f4320[_0x3faf('0x6')]?_0x7f4320[_0x3faf('0x6')][_0x3faf('0x7')]===undefined?!![]:![]:!![],'where':_0x7f4320['options']?_0x7f4320[_0x3faf('0x6')][_0x3faf('0x8')]||null:null,'attributes':_0x7f4320[_0x3faf('0x6')]?_0x7f4320[_0x3faf('0x6')][_0x3faf('0x9')]||null:null,'include':_0x7f4320[_0x3faf('0x6')]?_0x7f4320[_0x3faf('0x6')][_0x3faf('0xb')]?_['map'](_0x7f4320[_0x3faf('0x6')]['include'],function(_0x20bf16){return{'model':db[_0x20bf16[_0x3faf('0xc')]],'as':_0x20bf16['as'],'attributes':_0x20bf16[_0x3faf('0x9')],'include':_0x20bf16['include']?_[_0x3faf('0xd')](_0x20bf16['include'],function(_0xf0c9a4){return{'model':db[_0xf0c9a4[_0x3faf('0xc')]],'as':_0xf0c9a4['as'],'attributes':_0xf0c9a4[_0x3faf('0x9')],'include':_0xf0c9a4[_0x3faf('0xb')]?_['map'](_0xf0c9a4[_0x3faf('0xb')],function(_0x1a2acf){return{'model':db[_0x1a2acf[_0x3faf('0xc')]],'as':_0x1a2acf['as'],'attributes':_0x1a2acf[_0x3faf('0x9')]};}):[]};}):[]};}):[]:[]})[_0x3faf('0xe')](function(_0x161d71){logger[_0x3faf('0xf')]('ShowCmHopper',_0x7f4320);logger[_0x3faf('0x10')](_0x3faf('0x16'),_0x7f4320,JSON[_0x3faf('0x11')](_0x161d71));_0x57b23f(_0x161d71);})[_0x3faf('0x12')](function(_0x50edc8){logger['error']('ShowCmHopper',_0x50edc8['message'],_0x7f4320);_0x4e768e(_0x1fd9e2['error'](0x1f4,_0x50edc8[_0x3faf('0x14')]));});});};exports['CreateCmHopper']=function(_0x336bee){var _0x4886f0=this;return new Promise(function(_0x3819ae,_0x211def){return db[_0x3faf('0x5')]['create'](_0x336bee[_0x3faf('0x17')],{'raw':_0x336bee[_0x3faf('0x6')]?_0x336bee[_0x3faf('0x6')][_0x3faf('0x7')]===undefined?!![]:![]:!![]})[_0x3faf('0xe')](function(_0x8deb7c){logger['info'](_0x3faf('0x18'),_0x336bee);logger[_0x3faf('0x10')](_0x3faf('0x18'),_0x336bee,JSON[_0x3faf('0x11')](_0x8deb7c));_0x3819ae(_0x8deb7c);})['catch'](function(_0x1bc56b){logger[_0x3faf('0x13')](_0x3faf('0x18'),_0x1bc56b[_0x3faf('0x14')],_0x336bee);_0x211def(_0x4886f0[_0x3faf('0x13')](0x1f4,_0x1bc56b[_0x3faf('0x14')]));});});};exports[_0x3faf('0x19')]=function(_0x395341){var _0x250aa2=this;return new Promise(function(_0x212703,_0x1d89dc){return db[_0x3faf('0x5')][_0x3faf('0x1a')](_0x395341[_0x3faf('0x17')],{'raw':_0x395341[_0x3faf('0x6')]?_0x395341[_0x3faf('0x6')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x395341[_0x3faf('0x6')]?_0x395341[_0x3faf('0x6')][_0x3faf('0x8')]||null:null,'attributes':_0x395341['options']?_0x395341['options'][_0x3faf('0x9')]||null:null,'limit':_0x395341[_0x3faf('0x6')]?_0x395341[_0x3faf('0x6')][_0x3faf('0xa')]||null:null})['then'](function(_0x29ef23){logger[_0x3faf('0xf')](_0x3faf('0x19'),_0x395341);logger['info']('UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON[_0x3faf('0x11')](_0x395341[_0x3faf('0x6')][_0x3faf('0x8')]),_0x395341[_0x3faf('0x17')][_0x3faf('0x1b')]);logger['debug'](_0x3faf('0x19'),_0x395341,JSON[_0x3faf('0x11')](_0x29ef23));_0x212703(_0x29ef23);})['catch'](function(_0x38d1e1){logger['error'](_0x3faf('0x19'),_0x38d1e1['message'],_0x395341);_0x1d89dc(_0x250aa2[_0x3faf('0x13')](0x1f4,_0x38d1e1[_0x3faf('0x14')]));});});};exports[_0x3faf('0x1c')]=function(_0x15ef3f){var _0x199cdb=this;return new Promise(function(_0x17afeb,_0x2a4a8d){return db['CmHopper'][_0x3faf('0x1d')]({'where':_0x15ef3f[_0x3faf('0x6')]?_0x15ef3f[_0x3faf('0x6')][_0x3faf('0x8')]||null:null})[_0x3faf('0xe')](function(_0x2f3fd2){logger['info'](_0x3faf('0x1c'),_0x15ef3f);logger[_0x3faf('0x10')]('DestroyCmHopper',_0x15ef3f,JSON[_0x3faf('0x11')](_0x2f3fd2));_0x17afeb(_0x2f3fd2);})[_0x3faf('0x12')](function(_0x307be3){logger[_0x3faf('0x13')](_0x3faf('0x1c'),_0x307be3[_0x3faf('0x14')],_0x15ef3f);_0x2a4a8d(_0x199cdb['error'](0x1f4,_0x307be3[_0x3faf('0x14')]));});});};exports[_0x3faf('0x1e')]=function(_0x2ee9ab){var _0x21d1a9=this;return new Promise(function(_0x604079,_0x1634aa){return db['CmContact'][_0x3faf('0x1f')]()[_0x3faf('0xe')](function(_0x1630c3){return db[_0x3faf('0x20')][_0x3faf('0x21')](function(_0x46a976){return db['CmHopper'][_0x3faf('0x22')]({'where':_0x2ee9ab[_0x3faf('0x6')]?_0x2ee9ab[_0x3faf('0x6')][_0x3faf('0x8')]||null:null,'attributes':_0x2ee9ab[_0x3faf('0x6')]?_0x2ee9ab['options'][_0x3faf('0x9')]||null:null,'limit':_0x2ee9ab[_0x3faf('0x6')]?_0x2ee9ab['options'][_0x3faf('0xa')]||null:null,'order':_0x2ee9ab[_0x3faf('0x6')]?_0x2ee9ab[_0x3faf('0x6')][_0x3faf('0x23')]||null:null,'transaction':_0x46a976,'lock':_0x46a976[_0x3faf('0x24')][_0x3faf('0x25')],'include':[{'model':db['CmContact'],'as':'Contact','attributes':_[_0x3faf('0x26')](_0x1630c3)},{'model':db[_0x3faf('0x27')],'as':_0x3faf('0x28'),'attributes':['id',_0x3faf('0x29'),_0x3faf('0x2a')]}]})[_0x3faf('0xe')](function(_0x288dc1){var _0x3882cc=[];var _0x106e11=[];for(var _0x14b0aa=0x0;_0x14b0aa<_0x288dc1[_0x3faf('0x2b')];_0x14b0aa+=0x1){var _0x2948b7=_0x288dc1[_0x14b0aa][_0x3faf('0x2c')];if(_0x2948b7===null){_0x3882cc[_0x3faf('0x2d')](_0x288dc1[_0x14b0aa][_0x3faf('0x1a')](_0x2ee9ab[_0x3faf('0x17')],{'transaction':_0x46a976}));}else if(!_0x106e11['includes'](_0x2948b7)){_0x106e11[_0x3faf('0x2d')](_0x2948b7);_0x3882cc[_0x3faf('0x2d')](_0x288dc1[_0x14b0aa][_0x3faf('0x1a')](_0x2ee9ab[_0x3faf('0x17')],{'transaction':_0x46a976}));}}return BPromise[_0x3faf('0x2e')](_0x3882cc);});})[_0x3faf('0xe')](function(_0x5d1d94){logger['info'](_0x3faf('0x1e'),_0x2ee9ab);if(_0x5d1d94[_0x3faf('0x2b')]>0x0){logger[_0x3faf('0xf')](_0x3faf('0x2f'),_0x5d1d94[0x0][_0x3faf('0x30')]['id'],_0x5d1d94[0x0]['dataValues'][_0x3faf('0x31')],_0x5d1d94[0x0][_0x3faf('0x30')][_0x3faf('0x1b')]);}logger[_0x3faf('0x10')](_0x3faf('0x1e'),_0x2ee9ab,JSON[_0x3faf('0x11')](_0x5d1d94));_0x604079(_0x5d1d94);})[_0x3faf('0x12')](function(_0x10b463){logger[_0x3faf('0x13')]('GetContactDialer',_0x10b463[_0x3faf('0x14')],_0x2ee9ab);_0x1634aa(_0x21d1a9['error'](0x1f4,_0x10b463[_0x3faf('0x14')]));});});});};exports[_0x3faf('0x32')]=function(_0x5c7db0){var _0x535837=this;return new Promise(function(_0x2512c1,_0x320932){return db[_0x3faf('0x20')][_0x3faf('0x21')](function(_0x4b3631){return db[_0x3faf('0x33')][_0x3faf('0x34')](_0x5c7db0[_0x3faf('0x17')],{'raw':_0x5c7db0[_0x3faf('0x6')]?_0x5c7db0['options']['raw']===undefined?!![]:![]:!![],'transaction':_0x4b3631})[_0x3faf('0xe')](function(){logger['info'](_0x3faf('0x35'),JSON[_0x3faf('0x11')](_0x5c7db0['options'][_0x3faf('0x8')]),_0x5c7db0[_0x3faf('0x6')][_0x3faf('0x8')][_0x3faf('0x1b')]);return db[_0x3faf('0x5')]['destroy']({'where':_0x5c7db0['options']?_0x5c7db0['options']['where']||null:null,'transaction':_0x4b3631});});})[_0x3faf('0xe')](function(_0x2d6c42){logger[_0x3faf('0xf')](_0x3faf('0x32'),_0x5c7db0);logger['debug'](_0x3faf('0x32'),_0x5c7db0,JSON[_0x3faf('0x11')](_0x2d6c42));_0x2512c1(_0x2d6c42);})[_0x3faf('0x12')](function(_0x4759f0){logger['error']('MoveContactManagedDialer',_0x4759f0['message'],_0x5c7db0);_0x320932(_0x535837['error'](0x1f4,_0x4759f0[_0x3faf('0x14')]));});});};exports[_0x3faf('0x36')]=function(_0x2b00ba){var _0x5aacde=this;return new Promise(function(_0x2b6d36,_0x555ede){return db[_0x3faf('0x5')][_0x3faf('0x22')]({'raw':_0x2b00ba[_0x3faf('0x6')]?_0x2b00ba[_0x3faf('0x6')]['raw']===undefined?!![]:![]:!![],'where':_0x2b00ba['options']?_0x2b00ba['options'][_0x3faf('0x8')]||null:null,'attributes':[[db[_0x3faf('0x20')]['fn'](_0x3faf('0x37'),db['sequelize']['fn']('IF',db[_0x3faf('0x20')][_0x3faf('0x38')](_0x3faf('0x39')+util[_0x3faf('0x3a')]('\x22%s\x22',moment()[_0x3faf('0x3a')](_0x3faf('0x3b')))+_0x3faf('0x3c')))),_0x3faf('0x3d')]]})['then'](function(_0xa943e1){logger[_0x3faf('0xf')](_0x3faf('0x36'),_0x2b00ba);logger['debug']('CountReScheduled',_0x2b00ba,JSON[_0x3faf('0x11')](_0xa943e1));_0x2b6d36(_0xa943e1);})['catch'](function(_0x4678d9){logger[_0x3faf('0x13')](_0x3faf('0x36'),_0x4678d9[_0x3faf('0x14')],_0x2b00ba);_0x555ede(_0x5aacde['error'](0x1f4,_0x4678d9[_0x3faf('0x14')]));});});};exports[_0x3faf('0x3e')]=function(_0x7749de){var _0x129d5f=this;return new Promise(function(_0x22c845,_0x1b6f97){return db['CmContact'][_0x3faf('0x1f')]()[_0x3faf('0xe')](function(){return db[_0x3faf('0x20')][_0x3faf('0x21')](function(_0x5e2d10){return db[_0x3faf('0x5')][_0x3faf('0x22')]({'where':_0x7749de[_0x3faf('0x6')]?_0x7749de[_0x3faf('0x6')][_0x3faf('0x8')]||null:null,'attributes':_0x7749de[_0x3faf('0x6')]?_0x7749de[_0x3faf('0x6')][_0x3faf('0x9')]||null:null,'limit':0x1,'order':_0x7749de[_0x3faf('0x6')]?_0x7749de['options']['order']||null:null,'group':db[_0x3faf('0x5')][_0x3faf('0x2c')],'transaction':_0x5e2d10,'lock':_0x5e2d10[_0x3faf('0x24')][_0x3faf('0x25')],'include':_0x7749de['options']?_0x7749de['options'][_0x3faf('0xb')]?_[_0x3faf('0xd')](_0x7749de['options'][_0x3faf('0xb')],function(_0x2b8cdf){return{'model':db[_0x2b8cdf['model']],'as':_0x2b8cdf['as'],'attributes':_0x2b8cdf['attributes'],'include':_0x2b8cdf[_0x3faf('0xb')]?_['map'](_0x2b8cdf[_0x3faf('0xb')],function(_0x39f23e){return{'model':db[_0x39f23e['model']],'as':_0x39f23e['as'],'attributes':_0x39f23e[_0x3faf('0x9')],'include':_0x39f23e[_0x3faf('0xb')]?_['map'](_0x39f23e[_0x3faf('0xb')],function(_0x15e7be){return{'model':db[_0x15e7be[_0x3faf('0xc')]],'as':_0x15e7be['as'],'attributes':_0x15e7be['attributes']};}):[]};}):[]};}):[]:[]})[_0x3faf('0xe')](function(_0x10448d){var _0x41b45f=[];for(var _0x41c587=0x0;_0x41c587<_0x10448d[_0x3faf('0x2b')];_0x41c587+=0x1){_0x41b45f[_0x3faf('0x2d')](_0x10448d[_0x41c587]['update'](_0x7749de[_0x3faf('0x17')],{'transaction':_0x5e2d10}));}return BPromise['all'](_0x41b45f);});})[_0x3faf('0xe')](function(_0x106f8b){logger['info'](_0x3faf('0x3e'),_0x7749de);logger[_0x3faf('0x10')]('GetContactRecallMe',_0x7749de,JSON['stringify'](_0x106f8b));_0x22c845(_0x106f8b);})[_0x3faf('0x12')](function(_0x11c05d){logger[_0x3faf('0x13')](_0x3faf('0x3e'),_0x11c05d['message'],_0x7749de);_0x1b6f97(_0x129d5f['error'](0x1f4,_0x11c05d['message']));});});});};exports['GetCmHopperPreview']=function(_0x55686f){var _0x4579bf=this;return new Promise(function(_0x785ee2,_0x2e37ff){db[_0x3faf('0x3f')][_0x3faf('0x1f')]()[_0x3faf('0xe')](function(_0x1b6123){return db['CmHopper']['findAll']({'raw':_0x55686f[_0x3faf('0x6')]?_0x55686f[_0x3faf('0x6')]['raw']===undefined?!![]:![]:!![],'where':_0x55686f['options']?_0x55686f[_0x3faf('0x6')][_0x3faf('0x8')]||null:null,'attributes':_0x55686f[_0x3faf('0x6')]?_0x55686f['options']['attributes']||null:null,'limit':_0x55686f['options']?_0x55686f['options']['limit']||null:null,'include':_0x55686f[_0x3faf('0x6')]?_0x55686f[_0x3faf('0x6')][_0x3faf('0xb')]?_[_0x3faf('0xd')](_0x55686f[_0x3faf('0x6')][_0x3faf('0xb')],function(_0x345873){return{'model':db[_0x345873[_0x3faf('0xc')]],'as':_0x345873['as'],'attributes':_0x345873['as']===_0x3faf('0x40')?_[_0x3faf('0x26')](_0x1b6123):_0x345873[_0x3faf('0x9')],'include':_0x345873[_0x3faf('0xb')]?_['map'](_0x345873[_0x3faf('0xb')],function(_0x31f4e0){return{'model':db[_0x31f4e0[_0x3faf('0xc')]],'as':_0x31f4e0['as'],'attributes':_0x31f4e0[_0x3faf('0x9')],'include':_0x31f4e0[_0x3faf('0xb')]?_['map'](_0x31f4e0[_0x3faf('0xb')],function(_0x28d459){return{'model':db[_0x28d459[_0x3faf('0xc')]],'as':_0x28d459['as'],'attributes':_0x28d459['attributes']};}):[]};}):[]};}):[]:[]})[_0x3faf('0xe')](function(_0x457cf5){logger[_0x3faf('0xf')]('GetCmHopper',_0x55686f);logger[_0x3faf('0x10')](_0x3faf('0x4'),_0x55686f,JSON[_0x3faf('0x11')](_0x457cf5));_0x785ee2(_0x457cf5);})[_0x3faf('0x12')](function(_0x585e83){logger[_0x3faf('0x13')]('GetCmHopper',_0x585e83[_0x3faf('0x14')],_0x55686f);_0x2e37ff(_0x4579bf['error'](0x1f4,_0x585e83[_0x3faf('0x14')]));});});});};exports[_0x3faf('0x41')]=function(_0x200a55){var _0x3f9f1e=this;return new Promise(function(_0x82353f,_0x19f48c){return db[_0x3faf('0x3f')][_0x3faf('0x42')]({'raw':!![],'where':{'phone':_0x200a55[_0x3faf('0x6')]['where'][_0x3faf('0x43')]},'attributes':['id',_0x3faf('0x44')],'order':[['id',_0x3faf('0x45')]]})[_0x3faf('0xe')](function(_0x565e1b){logger[_0x3faf('0xf')](_0x3faf('0x46'),_0x200a55);logger[_0x3faf('0x10')](_0x3faf('0x46'),_0x200a55,JSON[_0x3faf('0x11')](_0x565e1b));_0x82353f(_0x565e1b);})['catch'](function(_0x27493c){logger[_0x3faf('0x13')](_0x3faf('0x46'),_0x27493c['message'],_0x200a55);_0x19f48c(_0x3f9f1e['error'](0x1f4,_0x27493c[_0x3faf('0x14')]));});});};exports[_0x3faf('0x47')]=function(_0x52f9bc){var _0x1fa9fa=this;return new Promise(function(_0x2018be,_0x13191f){return db[_0x3faf('0x20')][_0x3faf('0x21')](function(_0x4f9fbe){var _0x2bc881=_0x52f9bc['options']&&_0x52f9bc['options']['where']?_0x52f9bc[_0x3faf('0x6')][_0x3faf('0x8')]:{};return db[_0x3faf('0x5')][_0x3faf('0x1a')](_0x52f9bc['body'],{'where':_0x2bc881,'transaction':_0x4f9fbe})[_0x3faf('0xe')](function(_0x1d0c33){logger[_0x3faf('0xf')](_0x3faf('0x47'),_0x52f9bc);logger['debug'](_0x3faf('0x47'),_0x52f9bc,JSON[_0x3faf('0x11')](_0x1d0c33));_0x2018be(_0x1d0c33);})[_0x3faf('0x12')](function(_0x59e639){logger['error'](_0x3faf('0x47'),_0x59e639['message'],_0x52f9bc);_0x13191f(_0x1fa9fa[_0x3faf('0x13')](0x1f4,_0x59e639[_0x3faf('0x14')]));});});});};exports['CmHopperHandlePreviewRecallNotifications']=function(_0x102e47){var _0x4b9b8c=this;var _0x27e392=_0x102e47[_0x3faf('0x17')]['where'][_0x3faf('0x48')];var _0x4f4e03=_0x102e47[_0x3faf('0x17')][_0x3faf('0x8')][_0x3faf('0x49')];var _0x363ebd=_0x102e47[_0x3faf('0x17')][_0x3faf('0x8')][_0x3faf('0x4a')];return new Promise(function(_0x2542d4,_0x430726){return db[_0x3faf('0x5')][_0x3faf('0x22')]({'where':{'voiceQueueId':{'$in':_0x27e392},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db['sequelize']['literal'](_0x3faf('0x4b')+_0x4f4e03+'\x20MINUTE'),'$gt':db[_0x3faf('0x20')]['literal']('NOW()')}},'UserId':{'$in':_0x363ebd}},'include':[{'model':db[_0x3faf('0x3f')],'as':'Contact'},{'model':db[_0x3faf('0x27')],'as':_0x3faf('0x28'),'attributes':['id',_0x3faf('0x29'),_0x3faf('0x2a')]},{'model':db[_0x3faf('0x4c')],'as':_0x3faf('0x4d')}]})[_0x3faf('0xe')](function(_0x366861){if(_0x366861[_0x3faf('0x2b')]>0x0){return db[_0x3faf('0x20')][_0x3faf('0x21')](function(_0x9505ee){return db['CmHopper'][_0x3faf('0x1a')]({'recallmeNotifiedDate':db[_0x3faf('0x20')]['literal'](_0x3faf('0x4e'))},{'where':{'id':{'$in':_['map'](_0x366861,'id')}},'transaction':_0x9505ee})[_0x3faf('0xe')](function(){_0x2542d4(_0x366861);})[_0x3faf('0x12')](function(_0x299edd){logger[_0x3faf('0x13')]('CmHopperHandlePreviewRecallNotifications',_0x299edd[_0x3faf('0x14')],_0x102e47);_0x430726(_0x4b9b8c[_0x3faf('0x13')](0x1f4,_0x299edd[_0x3faf('0x14')]));});})['catch'](function(_0x40a7cd){logger['error'](_0x3faf('0x4f'),_0x40a7cd[_0x3faf('0x14')],_0x102e47);_0x430726(_0x4b9b8c[_0x3faf('0x13')](0x1f4,_0x40a7cd[_0x3faf('0x14')]));});}else{_0x2542d4(_0x366861);}});});};