Built motion from commit bab6f49e.|2.6.17
[motion2.git] / server / api / cmHopper / cmHopper.rpc.js
index fe27e75..515736c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb10b=['order','LOCK','UPDATE','Contact','keys','User','Agent','name','voicePause','length','push','CmHopperFinal','MoveContactManagedDialer','CountReScheduled','COUNT','`scheduledat`\x20>=\x20','format','\x22%s\x22','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','all','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopper,\x20%s,\x20%s','CmHopper,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','GetCmHopper','CmHopper','findAll','options','raw','where','attributes','include','map','model','debug','catch','ShowCmHopper','CreateCmHopper','create','body','update','limit','UpdateCmHopper','destroy','DestroyCmHopper','GetContactDialer','CmContact','describe','sequelize','transaction'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xb10b,0x12a));var _0xbb10=function(_0x24fe48,_0x10e97e){_0x24fe48=_0x24fe48-0x0;var _0x51e7d5=_0xb10b[_0x24fe48];return _0x51e7d5;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')]({'raw':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8[_0xbb10('0x18')]?_0x378da8['options'][_0xbb10('0x1b')]||null:null,'limit':_0x378da8[_0xbb10('0x18')]?_0x378da8['options']['limit']||null:null,'include':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1c')]?_[_0xbb10('0x1d')](_0x378da8[_0xbb10('0x18')][_0xbb10('0x1c')],function(_0x407cb4){return{'model':db[_0x407cb4[_0xbb10('0x1e')]],'as':_0x407cb4['as'],'attributes':_0x407cb4[_0xbb10('0x1b')],'include':_0x407cb4[_0xbb10('0x1c')]?_[_0xbb10('0x1d')](_0x407cb4[_0xbb10('0x1c')],function(_0x537898){return{'model':db[_0x537898['model']],'as':_0x537898['as'],'attributes':_0x537898['attributes'],'include':_0x537898[_0xbb10('0x1c')]?_[_0xbb10('0x1d')](_0x537898[_0xbb10('0x1c')],function(_0x4e25ff){return{'model':db[_0x4e25ff[_0xbb10('0x1e')]],'as':_0x4e25ff['as'],'attributes':_0x4e25ff[_0xbb10('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xbb10('0xc')](function(_0x1d5e95){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1f')]('GetCmHopper',_0x378da8,JSON[_0xbb10('0x11')](_0x1d5e95));_0x575cca(_0x1d5e95);})[_0xbb10('0x20')](function(_0xfc3595){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0xfc3595[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4['error'](0x1f4,_0xfc3595[_0xbb10('0x13')]));});});};exports['ShowCmHopper']=function(_0x448d5c){var _0x56f2da=this;return new Promise(function(_0x16ad2a,_0x1dcc9c){return db[_0xbb10('0x16')]['find']({'raw':_0x448d5c['options']?_0x448d5c[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x448d5c['options']?_0x448d5c[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x448d5c[_0xbb10('0x18')]?_0x448d5c[_0xbb10('0x18')][_0xbb10('0x1b')]||null:null,'include':_0x448d5c[_0xbb10('0x18')]?_0x448d5c[_0xbb10('0x18')]['include']?_[_0xbb10('0x1d')](_0x448d5c[_0xbb10('0x18')][_0xbb10('0x1c')],function(_0x8c1ce6){return{'model':db[_0x8c1ce6[_0xbb10('0x1e')]],'as':_0x8c1ce6['as'],'attributes':_0x8c1ce6[_0xbb10('0x1b')],'include':_0x8c1ce6[_0xbb10('0x1c')]?_[_0xbb10('0x1d')](_0x8c1ce6[_0xbb10('0x1c')],function(_0x56943c){return{'model':db[_0x56943c[_0xbb10('0x1e')]],'as':_0x56943c['as'],'attributes':_0x56943c[_0xbb10('0x1b')],'include':_0x56943c[_0xbb10('0x1c')]?_[_0xbb10('0x1d')](_0x56943c['include'],function(_0x111762){return{'model':db[_0x111762['model']],'as':_0x111762['as'],'attributes':_0x111762['attributes']};}):[]};}):[]};}):[]:[]})[_0xbb10('0xc')](function(_0x40c164){logger[_0xbb10('0xd')](_0xbb10('0x21'),_0x448d5c);logger[_0xbb10('0x1f')](_0xbb10('0x21'),_0x448d5c,JSON['stringify'](_0x40c164));_0x16ad2a(_0x40c164);})[_0xbb10('0x20')](function(_0x25d72f){logger['error']('ShowCmHopper',_0x25d72f['message'],_0x448d5c);_0x1dcc9c(_0x56f2da[_0xbb10('0x12')](0x1f4,_0x25d72f[_0xbb10('0x13')]));});});};exports[_0xbb10('0x22')]=function(_0x4d5a9b){var _0x3c0cd7=this;return new Promise(function(_0x3e8538,_0x4345f3){return db['CmHopper'][_0xbb10('0x23')](_0x4d5a9b[_0xbb10('0x24')],{'raw':_0x4d5a9b[_0xbb10('0x18')]?_0x4d5a9b[_0xbb10('0x18')]['raw']===undefined?!![]:![]:!![]})[_0xbb10('0xc')](function(_0x110eb5){logger['info'](_0xbb10('0x22'),_0x4d5a9b);logger[_0xbb10('0x1f')](_0xbb10('0x22'),_0x4d5a9b,JSON[_0xbb10('0x11')](_0x110eb5));_0x3e8538(_0x110eb5);})[_0xbb10('0x20')](function(_0x185a52){logger['error'](_0xbb10('0x22'),_0x185a52[_0xbb10('0x13')],_0x4d5a9b);_0x4345f3(_0x3c0cd7[_0xbb10('0x12')](0x1f4,_0x185a52[_0xbb10('0x13')]));});});};exports['UpdateCmHopper']=function(_0x3fff6c){var _0x331751=this;return new Promise(function(_0x23dc18,_0x403beb){return db['CmHopper'][_0xbb10('0x25')](_0x3fff6c[_0xbb10('0x24')],{'raw':_0x3fff6c['options']?_0x3fff6c['options'][_0xbb10('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3fff6c['options']?_0x3fff6c[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x3fff6c['options']?_0x3fff6c[_0xbb10('0x18')][_0xbb10('0x1b')]||null:null,'limit':_0x3fff6c[_0xbb10('0x18')]?_0x3fff6c['options'][_0xbb10('0x26')]||null:null})[_0xbb10('0xc')](function(_0x3b9fdf){logger[_0xbb10('0xd')](_0xbb10('0x27'),_0x3fff6c);logger[_0xbb10('0x1f')](_0xbb10('0x27'),_0x3fff6c,JSON[_0xbb10('0x11')](_0x3b9fdf));_0x23dc18(_0x3b9fdf);})[_0xbb10('0x20')](function(_0x43b948){logger[_0xbb10('0x12')](_0xbb10('0x27'),_0x43b948['message'],_0x3fff6c);_0x403beb(_0x331751[_0xbb10('0x12')](0x1f4,_0x43b948[_0xbb10('0x13')]));});});};exports['DestroyCmHopper']=function(_0x14e1cb){var _0x2f5027=this;return new Promise(function(_0x1a7df6,_0x5a5226){return db[_0xbb10('0x16')][_0xbb10('0x28')]({'where':_0x14e1cb[_0xbb10('0x18')]?_0x14e1cb['options']['where']||null:null})[_0xbb10('0xc')](function(_0x76a208){logger[_0xbb10('0xd')]('DestroyCmHopper',_0x14e1cb);logger['debug'](_0xbb10('0x29'),_0x14e1cb,JSON[_0xbb10('0x11')](_0x76a208));_0x1a7df6(_0x76a208);})[_0xbb10('0x20')](function(_0xf820fe){logger[_0xbb10('0x12')](_0xbb10('0x29'),_0xf820fe[_0xbb10('0x13')],_0x14e1cb);_0x5a5226(_0x2f5027[_0xbb10('0x12')](0x1f4,_0xf820fe[_0xbb10('0x13')]));});});};exports[_0xbb10('0x2a')]=function(_0x550111){var _0x5eafac=this;return new Promise(function(_0x412e13,_0x467dba){return db[_0xbb10('0x2b')][_0xbb10('0x2c')]()[_0xbb10('0xc')](function(_0x440f9e){return db[_0xbb10('0x2d')][_0xbb10('0x2e')](function(_0x1c0d8f){return db[_0xbb10('0x16')][_0xbb10('0x17')]({'where':_0x550111[_0xbb10('0x18')]?_0x550111[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x550111[_0xbb10('0x18')]?_0x550111['options'][_0xbb10('0x1b')]||null:null,'limit':_0x550111['options']?_0x550111[_0xbb10('0x18')][_0xbb10('0x26')]||null:null,'order':_0x550111[_0xbb10('0x18')]?_0x550111[_0xbb10('0x18')][_0xbb10('0x2f')]||null:null,'transaction':_0x1c0d8f,'lock':_0x1c0d8f[_0xbb10('0x30')][_0xbb10('0x31')],'include':[{'model':db[_0xbb10('0x2b')],'as':_0xbb10('0x32'),'attributes':_[_0xbb10('0x33')](_0x440f9e)},{'model':db[_0xbb10('0x34')],'as':_0xbb10('0x35'),'attributes':['id',_0xbb10('0x36'),_0xbb10('0x37')]}]})[_0xbb10('0xc')](function(_0x5de0cc){var _0x4571b6=[];for(var _0x466eb7=0x0;_0x466eb7<_0x5de0cc[_0xbb10('0x38')];_0x466eb7+=0x1){_0x4571b6[_0xbb10('0x39')](_0x5de0cc[_0x466eb7][_0xbb10('0x25')](_0x550111[_0xbb10('0x24')],{'transaction':_0x1c0d8f}));}return BPromise['all'](_0x4571b6);});})[_0xbb10('0xc')](function(_0x4731ce){logger[_0xbb10('0xd')](_0xbb10('0x2a'),_0x550111);logger[_0xbb10('0x1f')](_0xbb10('0x2a'),_0x550111,JSON[_0xbb10('0x11')](_0x4731ce));_0x412e13(_0x4731ce);})[_0xbb10('0x20')](function(_0x205e01){logger[_0xbb10('0x12')](_0xbb10('0x2a'),_0x205e01[_0xbb10('0x13')],_0x550111);_0x467dba(_0x5eafac[_0xbb10('0x12')](0x1f4,_0x205e01['message']));});});});};exports['MoveContactManagedDialer']=function(_0x16272d){var _0x3e6338=this;return new Promise(function(_0x3d0cb7,_0x8b0a7d){return db['sequelize']['transaction'](function(_0x79411e){return db[_0xbb10('0x3a')][_0xbb10('0x23')](_0x16272d[_0xbb10('0x24')],{'raw':_0x16272d[_0xbb10('0x18')]?_0x16272d[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'transaction':_0x79411e})['then'](function(){return db[_0xbb10('0x16')][_0xbb10('0x28')]({'where':_0x16272d['options']?_0x16272d['options']['where']||null:null,'transaction':_0x79411e});});})[_0xbb10('0xc')](function(_0x31c727){logger[_0xbb10('0xd')]('MoveContactManagedDialer',_0x16272d);logger['debug']('MoveContactManagedDialer',_0x16272d,JSON[_0xbb10('0x11')](_0x31c727));_0x3d0cb7(_0x31c727);})[_0xbb10('0x20')](function(_0x45167a){logger['error'](_0xbb10('0x3b'),_0x45167a[_0xbb10('0x13')],_0x16272d);_0x8b0a7d(_0x3e6338['error'](0x1f4,_0x45167a['message']));});});};exports[_0xbb10('0x3c')]=function(_0x308896){var _0xd77753=this;return new Promise(function(_0x237246,_0x54b7c5){return db[_0xbb10('0x16')][_0xbb10('0x17')]({'raw':_0x308896[_0xbb10('0x18')]?_0x308896['options'][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x308896[_0xbb10('0x18')]?_0x308896[_0xbb10('0x18')]['where']||null:null,'attributes':[[db[_0xbb10('0x2d')]['fn'](_0xbb10('0x3d'),db[_0xbb10('0x2d')]['fn']('IF',db[_0xbb10('0x2d')]['literal'](_0xbb10('0x3e')+util[_0xbb10('0x3f')](_0xbb10('0x40'),moment()[_0xbb10('0x3f')]('YYYY-MM-DD\x20HH:mm:ss'))+_0xbb10('0x41')))),_0xbb10('0x42')]]})[_0xbb10('0xc')](function(_0x2ceb3e){logger[_0xbb10('0xd')](_0xbb10('0x3c'),_0x308896);logger[_0xbb10('0x1f')]('CountReScheduled',_0x308896,JSON['stringify'](_0x2ceb3e));_0x237246(_0x2ceb3e);})['catch'](function(_0xdfbc0b){logger[_0xbb10('0x12')](_0xbb10('0x3c'),_0xdfbc0b['message'],_0x308896);_0x54b7c5(_0xd77753['error'](0x1f4,_0xdfbc0b[_0xbb10('0x13')]));});});};exports[_0xbb10('0x43')]=function(_0xd9e743){var _0x3a9677=this;return new Promise(function(_0x260e06,_0x1ad2ed){return db['CmContact'][_0xbb10('0x2c')]()[_0xbb10('0xc')](function(_0x270fdb){return db[_0xbb10('0x2d')][_0xbb10('0x2e')](function(_0x5bfc68){return db['CmHopper']['findAll']({'where':_0xd9e743[_0xbb10('0x18')]?_0xd9e743[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0xd9e743[_0xbb10('0x18')]?_0xd9e743[_0xbb10('0x18')][_0xbb10('0x1b')]||null:null,'limit':0x1,'order':_0xd9e743['options']?_0xd9e743[_0xbb10('0x18')]['order']||null:null,'group':db['CmHopper']['UserId'],'transaction':_0x5bfc68,'lock':_0x5bfc68[_0xbb10('0x30')][_0xbb10('0x31')],'include':_0xd9e743[_0xbb10('0x18')]?_0xd9e743[_0xbb10('0x18')]['include']?_[_0xbb10('0x1d')](_0xd9e743['options']['include'],function(_0x165fe9){return{'model':db[_0x165fe9[_0xbb10('0x1e')]],'as':_0x165fe9['as'],'attributes':_0x165fe9[_0xbb10('0x1b')],'include':_0x165fe9[_0xbb10('0x1c')]?_[_0xbb10('0x1d')](_0x165fe9['include'],function(_0x2d52ea){return{'model':db[_0x2d52ea[_0xbb10('0x1e')]],'as':_0x2d52ea['as'],'attributes':_0x2d52ea[_0xbb10('0x1b')],'include':_0x2d52ea[_0xbb10('0x1c')]?_[_0xbb10('0x1d')](_0x2d52ea[_0xbb10('0x1c')],function(_0x174395){return{'model':db[_0x174395['model']],'as':_0x174395['as'],'attributes':_0x174395[_0xbb10('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xbb10('0xc')](function(_0x30f3ea){var _0x322b41=[];for(var _0x37b20e=0x0;_0x37b20e<_0x30f3ea[_0xbb10('0x38')];_0x37b20e+=0x1){_0x322b41[_0xbb10('0x39')](_0x30f3ea[_0x37b20e][_0xbb10('0x25')](_0xd9e743['body'],{'transaction':_0x5bfc68}));}return BPromise[_0xbb10('0x44')](_0x322b41);});})[_0xbb10('0xc')](function(_0x145baf){logger['info']('GetContactRecallMe',_0xd9e743);logger['debug'](_0xbb10('0x43'),_0xd9e743,JSON['stringify'](_0x145baf));_0x260e06(_0x145baf);})['catch'](function(_0x1701c5){logger[_0xbb10('0x12')](_0xbb10('0x43'),_0x1701c5[_0xbb10('0x13')],_0xd9e743);_0x1ad2ed(_0x3a9677[_0xbb10('0x12')](0x1f4,_0x1701c5[_0xbb10('0x13')]));});});});};
\ No newline at end of file
+var _0xfbd4=['name','UserId','push','includes','all','length','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','CmHopperFinal','destroy','MoveContactManagedDialer','COUNT','literal','`scheduledat`\x20>=\x20','format','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','CountReScheduled','GetContactRecallMe','GetCmHopperPreview','describe','GetContactByPhone','findOne','phone','dialTimezone','DESC','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueIds','interval','availableAgentsIds','NOW()\x20+\x20INTERVAL\x20','NOW()','CmList','List','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','GetCmHopper','findAll','options','raw','where','attributes','limit','include','model','map','then','info','stringify','catch','error','message','CmHopper','find','debug','ShowCmHopper','CreateCmHopper','create','body','UpdateCmHopper','update','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','DestroyCmHopper','GetContactDialer','CmContact','sequelize','transaction','order','LOCK','UPDATE','Contact','keys','User'];(function(_0x1e3797,_0x208a48){var _0x52b963=function(_0x307231){while(--_0x307231){_0x1e3797['push'](_0x1e3797['shift']());}};_0x52b963(++_0x208a48);}(_0xfbd4,0x11b));var _0x4fbd=function(_0x34c70e,_0x101047){_0x34c70e=_0x34c70e-0x0;var _0x2f14fc=_0xfbd4[_0x34c70e];return _0x2f14fc;};'use strict';var _=require(_0x4fbd('0x0'));var util=require(_0x4fbd('0x1'));var moment=require(_0x4fbd('0x2'));var BPromise=require(_0x4fbd('0x3'));var db=require(_0x4fbd('0x4'))['db'];var logger=require(_0x4fbd('0x5'))(_0x4fbd('0x6'));exports[_0x4fbd('0x7')]=function(_0x336a66){var _0xf8a255=this;return new Promise(function(_0x501c0d,_0x341dca){return db['CmHopper'][_0x4fbd('0x8')]({'raw':_0x336a66[_0x4fbd('0x9')]?_0x336a66[_0x4fbd('0x9')][_0x4fbd('0xa')]===undefined?!![]:![]:!![],'where':_0x336a66['options']?_0x336a66['options'][_0x4fbd('0xb')]||null:null,'attributes':_0x336a66[_0x4fbd('0x9')]?_0x336a66[_0x4fbd('0x9')][_0x4fbd('0xc')]||null:null,'limit':_0x336a66[_0x4fbd('0x9')]?_0x336a66[_0x4fbd('0x9')][_0x4fbd('0xd')]||null:null,'include':_0x336a66['options']?_0x336a66['options'][_0x4fbd('0xe')]?_['map'](_0x336a66[_0x4fbd('0x9')]['include'],function(_0x16816f){return{'model':db[_0x16816f[_0x4fbd('0xf')]],'as':_0x16816f['as'],'attributes':_0x16816f[_0x4fbd('0xc')],'include':_0x16816f[_0x4fbd('0xe')]?_[_0x4fbd('0x10')](_0x16816f['include'],function(_0x5efbaa){return{'model':db[_0x5efbaa[_0x4fbd('0xf')]],'as':_0x5efbaa['as'],'attributes':_0x5efbaa['attributes'],'include':_0x5efbaa[_0x4fbd('0xe')]?_['map'](_0x5efbaa[_0x4fbd('0xe')],function(_0x194b4a){return{'model':db[_0x194b4a[_0x4fbd('0xf')]],'as':_0x194b4a['as'],'attributes':_0x194b4a[_0x4fbd('0xc')]};}):[]};}):[]};}):[]:[]})[_0x4fbd('0x11')](function(_0x47f553){logger[_0x4fbd('0x12')](_0x4fbd('0x7'),_0x336a66);logger['debug'](_0x4fbd('0x7'),_0x336a66,JSON[_0x4fbd('0x13')](_0x47f553));_0x501c0d(_0x47f553);})[_0x4fbd('0x14')](function(_0x441b1e){logger[_0x4fbd('0x15')](_0x4fbd('0x7'),_0x441b1e[_0x4fbd('0x16')],_0x336a66);_0x341dca(_0xf8a255['error'](0x1f4,_0x441b1e[_0x4fbd('0x16')]));});});};exports['ShowCmHopper']=function(_0x202adf){var _0x4385e2=this;return new Promise(function(_0x3b6aaf,_0x15fe07){return db[_0x4fbd('0x17')][_0x4fbd('0x18')]({'raw':_0x202adf['options']?_0x202adf['options'][_0x4fbd('0xa')]===undefined?!![]:![]:!![],'where':_0x202adf[_0x4fbd('0x9')]?_0x202adf[_0x4fbd('0x9')][_0x4fbd('0xb')]||null:null,'attributes':_0x202adf[_0x4fbd('0x9')]?_0x202adf[_0x4fbd('0x9')]['attributes']||null:null,'include':_0x202adf[_0x4fbd('0x9')]?_0x202adf[_0x4fbd('0x9')][_0x4fbd('0xe')]?_[_0x4fbd('0x10')](_0x202adf[_0x4fbd('0x9')][_0x4fbd('0xe')],function(_0xef5731){return{'model':db[_0xef5731[_0x4fbd('0xf')]],'as':_0xef5731['as'],'attributes':_0xef5731[_0x4fbd('0xc')],'include':_0xef5731[_0x4fbd('0xe')]?_[_0x4fbd('0x10')](_0xef5731[_0x4fbd('0xe')],function(_0x24711f){return{'model':db[_0x24711f['model']],'as':_0x24711f['as'],'attributes':_0x24711f[_0x4fbd('0xc')],'include':_0x24711f[_0x4fbd('0xe')]?_[_0x4fbd('0x10')](_0x24711f['include'],function(_0x4bb6a6){return{'model':db[_0x4bb6a6[_0x4fbd('0xf')]],'as':_0x4bb6a6['as'],'attributes':_0x4bb6a6[_0x4fbd('0xc')]};}):[]};}):[]};}):[]:[]})[_0x4fbd('0x11')](function(_0x5bad8b){logger[_0x4fbd('0x12')]('ShowCmHopper',_0x202adf);logger[_0x4fbd('0x19')](_0x4fbd('0x1a'),_0x202adf,JSON['stringify'](_0x5bad8b));_0x3b6aaf(_0x5bad8b);})['catch'](function(_0xa61863){logger[_0x4fbd('0x15')](_0x4fbd('0x1a'),_0xa61863[_0x4fbd('0x16')],_0x202adf);_0x15fe07(_0x4385e2[_0x4fbd('0x15')](0x1f4,_0xa61863[_0x4fbd('0x16')]));});});};exports[_0x4fbd('0x1b')]=function(_0x4c1d11){var _0x2ebbea=this;return new Promise(function(_0x32f424,_0x52583b){return db[_0x4fbd('0x17')][_0x4fbd('0x1c')](_0x4c1d11[_0x4fbd('0x1d')],{'raw':_0x4c1d11[_0x4fbd('0x9')]?_0x4c1d11[_0x4fbd('0x9')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x18ed3f){logger[_0x4fbd('0x12')]('CreateCmHopper',_0x4c1d11);logger[_0x4fbd('0x19')](_0x4fbd('0x1b'),_0x4c1d11,JSON[_0x4fbd('0x13')](_0x18ed3f));_0x32f424(_0x18ed3f);})[_0x4fbd('0x14')](function(_0x9ffccc){logger[_0x4fbd('0x15')](_0x4fbd('0x1b'),_0x9ffccc[_0x4fbd('0x16')],_0x4c1d11);_0x52583b(_0x2ebbea[_0x4fbd('0x15')](0x1f4,_0x9ffccc[_0x4fbd('0x16')]));});});};exports[_0x4fbd('0x1e')]=function(_0x4a88ac){var _0x29c62b=this;return new Promise(function(_0x4dc84a,_0x59a353){return db['CmHopper'][_0x4fbd('0x1f')](_0x4a88ac[_0x4fbd('0x1d')],{'raw':_0x4a88ac['options']?_0x4a88ac[_0x4fbd('0x9')][_0x4fbd('0xa')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4a88ac[_0x4fbd('0x9')]?_0x4a88ac[_0x4fbd('0x9')][_0x4fbd('0xb')]||null:null,'attributes':_0x4a88ac[_0x4fbd('0x9')]?_0x4a88ac['options']['attributes']||null:null,'limit':_0x4a88ac[_0x4fbd('0x9')]?_0x4a88ac[_0x4fbd('0x9')][_0x4fbd('0xd')]||null:null})['then'](function(_0xcdaf5d){logger[_0x4fbd('0x12')](_0x4fbd('0x1e'),_0x4a88ac);logger[_0x4fbd('0x12')](_0x4fbd('0x20'),JSON[_0x4fbd('0x13')](_0x4a88ac[_0x4fbd('0x9')][_0x4fbd('0xb')]),_0x4a88ac[_0x4fbd('0x1d')][_0x4fbd('0x21')]);logger[_0x4fbd('0x19')](_0x4fbd('0x1e'),_0x4a88ac,JSON[_0x4fbd('0x13')](_0xcdaf5d));_0x4dc84a(_0xcdaf5d);})[_0x4fbd('0x14')](function(_0x4afc53){logger[_0x4fbd('0x15')](_0x4fbd('0x1e'),_0x4afc53[_0x4fbd('0x16')],_0x4a88ac);_0x59a353(_0x29c62b[_0x4fbd('0x15')](0x1f4,_0x4afc53[_0x4fbd('0x16')]));});});};exports['DestroyCmHopper']=function(_0x5f4351){var _0x766bbc=this;return new Promise(function(_0x5aa072,_0x23ad64){return db[_0x4fbd('0x17')]['destroy']({'where':_0x5f4351['options']?_0x5f4351['options'][_0x4fbd('0xb')]||null:null})[_0x4fbd('0x11')](function(_0x3ee48a){logger[_0x4fbd('0x12')]('DestroyCmHopper',_0x5f4351);logger['debug'](_0x4fbd('0x22'),_0x5f4351,JSON['stringify'](_0x3ee48a));_0x5aa072(_0x3ee48a);})[_0x4fbd('0x14')](function(_0xd55e8e){logger[_0x4fbd('0x15')](_0x4fbd('0x22'),_0xd55e8e['message'],_0x5f4351);_0x23ad64(_0x766bbc[_0x4fbd('0x15')](0x1f4,_0xd55e8e[_0x4fbd('0x16')]));});});};exports[_0x4fbd('0x23')]=function(_0x2c555c){var _0x9ee884=this;return new Promise(function(_0x21323b,_0x725a52){return db[_0x4fbd('0x24')]['describe']()[_0x4fbd('0x11')](function(_0x45807e){return db[_0x4fbd('0x25')][_0x4fbd('0x26')](function(_0xe94397){return db[_0x4fbd('0x17')][_0x4fbd('0x8')]({'where':_0x2c555c['options']?_0x2c555c[_0x4fbd('0x9')]['where']||null:null,'attributes':_0x2c555c[_0x4fbd('0x9')]?_0x2c555c[_0x4fbd('0x9')][_0x4fbd('0xc')]||null:null,'limit':_0x2c555c[_0x4fbd('0x9')]?_0x2c555c['options'][_0x4fbd('0xd')]||null:null,'order':_0x2c555c['options']?_0x2c555c[_0x4fbd('0x9')][_0x4fbd('0x27')]||null:null,'transaction':_0xe94397,'lock':_0xe94397[_0x4fbd('0x28')][_0x4fbd('0x29')],'include':[{'model':db[_0x4fbd('0x24')],'as':_0x4fbd('0x2a'),'attributes':_[_0x4fbd('0x2b')](_0x45807e)},{'model':db[_0x4fbd('0x2c')],'as':'Agent','attributes':['id',_0x4fbd('0x2d'),'voicePause']}]})['then'](function(_0x424c3a){var _0x891f4a=[];var _0x3ff454=[];for(var _0x4f7abd=0x0;_0x4f7abd<_0x424c3a['length'];_0x4f7abd+=0x1){var _0x1e677c=_0x424c3a[_0x4f7abd][_0x4fbd('0x2e')];if(_0x1e677c===null){_0x891f4a[_0x4fbd('0x2f')](_0x424c3a[_0x4f7abd][_0x4fbd('0x1f')](_0x2c555c[_0x4fbd('0x1d')],{'transaction':_0xe94397}));}else if(!_0x3ff454[_0x4fbd('0x30')](_0x1e677c)){_0x3ff454[_0x4fbd('0x2f')](_0x1e677c);_0x891f4a['push'](_0x424c3a[_0x4f7abd][_0x4fbd('0x1f')](_0x2c555c[_0x4fbd('0x1d')],{'transaction':_0xe94397}));}}return BPromise[_0x4fbd('0x31')](_0x891f4a);});})[_0x4fbd('0x11')](function(_0x21046f){logger[_0x4fbd('0x12')](_0x4fbd('0x23'),_0x2c555c);if(_0x21046f[_0x4fbd('0x32')]>0x0){logger[_0x4fbd('0x12')](_0x4fbd('0x33'),_0x21046f[0x0][_0x4fbd('0x34')]['id'],_0x21046f[0x0][_0x4fbd('0x34')][_0x4fbd('0x35')],_0x21046f[0x0][_0x4fbd('0x34')][_0x4fbd('0x21')]);}logger[_0x4fbd('0x19')](_0x4fbd('0x23'),_0x2c555c,JSON[_0x4fbd('0x13')](_0x21046f));_0x21323b(_0x21046f);})[_0x4fbd('0x14')](function(_0x8a04ee){logger[_0x4fbd('0x15')]('GetContactDialer',_0x8a04ee[_0x4fbd('0x16')],_0x2c555c);_0x725a52(_0x9ee884[_0x4fbd('0x15')](0x1f4,_0x8a04ee[_0x4fbd('0x16')]));});});});};exports['MoveContactManagedDialer']=function(_0x2ac54e){var _0x2217ca=this;return new Promise(function(_0x38eca8,_0x1fa14d){return db['sequelize'][_0x4fbd('0x26')](function(_0x2a2797){return db[_0x4fbd('0x36')][_0x4fbd('0x1c')](_0x2ac54e[_0x4fbd('0x1d')],{'raw':_0x2ac54e[_0x4fbd('0x9')]?_0x2ac54e['options'][_0x4fbd('0xa')]===undefined?!![]:![]:!![],'transaction':_0x2a2797})[_0x4fbd('0x11')](function(){logger[_0x4fbd('0x12')]('MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON['stringify'](_0x2ac54e['options'][_0x4fbd('0xb')]),_0x2ac54e[_0x4fbd('0x9')][_0x4fbd('0xb')]['active']);return db['CmHopper'][_0x4fbd('0x37')]({'where':_0x2ac54e['options']?_0x2ac54e['options'][_0x4fbd('0xb')]||null:null,'transaction':_0x2a2797});});})[_0x4fbd('0x11')](function(_0x7203b8){logger[_0x4fbd('0x12')](_0x4fbd('0x38'),_0x2ac54e);logger[_0x4fbd('0x19')](_0x4fbd('0x38'),_0x2ac54e,JSON[_0x4fbd('0x13')](_0x7203b8));_0x38eca8(_0x7203b8);})[_0x4fbd('0x14')](function(_0x12944e){logger[_0x4fbd('0x15')](_0x4fbd('0x38'),_0x12944e[_0x4fbd('0x16')],_0x2ac54e);_0x1fa14d(_0x2217ca[_0x4fbd('0x15')](0x1f4,_0x12944e['message']));});});};exports['CountReScheduled']=function(_0x14fa13){var _0x184d7a=this;return new Promise(function(_0x2c04a0,_0x264419){return db[_0x4fbd('0x17')]['findAll']({'raw':_0x14fa13[_0x4fbd('0x9')]?_0x14fa13['options'][_0x4fbd('0xa')]===undefined?!![]:![]:!![],'where':_0x14fa13[_0x4fbd('0x9')]?_0x14fa13[_0x4fbd('0x9')][_0x4fbd('0xb')]||null:null,'attributes':[[db[_0x4fbd('0x25')]['fn'](_0x4fbd('0x39'),db['sequelize']['fn']('IF',db[_0x4fbd('0x25')][_0x4fbd('0x3a')](_0x4fbd('0x3b')+util[_0x4fbd('0x3c')]('\x22%s\x22',moment()['format'](_0x4fbd('0x3d')))+_0x4fbd('0x3e')))),_0x4fbd('0x3f')]]})['then'](function(_0x520898){logger['info'](_0x4fbd('0x40'),_0x14fa13);logger[_0x4fbd('0x19')]('CountReScheduled',_0x14fa13,JSON[_0x4fbd('0x13')](_0x520898));_0x2c04a0(_0x520898);})[_0x4fbd('0x14')](function(_0x4f113a){logger[_0x4fbd('0x15')](_0x4fbd('0x40'),_0x4f113a['message'],_0x14fa13);_0x264419(_0x184d7a['error'](0x1f4,_0x4f113a['message']));});});};exports[_0x4fbd('0x41')]=function(_0x6ff2b8){var _0x193125=this;return new Promise(function(_0x23ad3c,_0x3eab96){return db[_0x4fbd('0x24')]['describe']()[_0x4fbd('0x11')](function(){return db['sequelize'][_0x4fbd('0x26')](function(_0x3255de){return db[_0x4fbd('0x17')][_0x4fbd('0x8')]({'where':_0x6ff2b8['options']?_0x6ff2b8[_0x4fbd('0x9')][_0x4fbd('0xb')]||null:null,'attributes':_0x6ff2b8[_0x4fbd('0x9')]?_0x6ff2b8['options']['attributes']||null:null,'limit':0x1,'order':_0x6ff2b8[_0x4fbd('0x9')]?_0x6ff2b8['options']['order']||null:null,'group':db[_0x4fbd('0x17')][_0x4fbd('0x2e')],'transaction':_0x3255de,'lock':_0x3255de[_0x4fbd('0x28')]['UPDATE'],'include':_0x6ff2b8[_0x4fbd('0x9')]?_0x6ff2b8[_0x4fbd('0x9')][_0x4fbd('0xe')]?_['map'](_0x6ff2b8[_0x4fbd('0x9')][_0x4fbd('0xe')],function(_0xd78fe7){return{'model':db[_0xd78fe7[_0x4fbd('0xf')]],'as':_0xd78fe7['as'],'attributes':_0xd78fe7[_0x4fbd('0xc')],'include':_0xd78fe7[_0x4fbd('0xe')]?_[_0x4fbd('0x10')](_0xd78fe7[_0x4fbd('0xe')],function(_0x393b55){return{'model':db[_0x393b55['model']],'as':_0x393b55['as'],'attributes':_0x393b55['attributes'],'include':_0x393b55[_0x4fbd('0xe')]?_[_0x4fbd('0x10')](_0x393b55[_0x4fbd('0xe')],function(_0x259810){return{'model':db[_0x259810[_0x4fbd('0xf')]],'as':_0x259810['as'],'attributes':_0x259810[_0x4fbd('0xc')]};}):[]};}):[]};}):[]:[]})[_0x4fbd('0x11')](function(_0x3ce030){var _0x13d88b=[];for(var _0x271f5a=0x0;_0x271f5a<_0x3ce030[_0x4fbd('0x32')];_0x271f5a+=0x1){_0x13d88b[_0x4fbd('0x2f')](_0x3ce030[_0x271f5a][_0x4fbd('0x1f')](_0x6ff2b8[_0x4fbd('0x1d')],{'transaction':_0x3255de}));}return BPromise[_0x4fbd('0x31')](_0x13d88b);});})[_0x4fbd('0x11')](function(_0x360ea5){logger[_0x4fbd('0x12')](_0x4fbd('0x41'),_0x6ff2b8);logger['debug'](_0x4fbd('0x41'),_0x6ff2b8,JSON[_0x4fbd('0x13')](_0x360ea5));_0x23ad3c(_0x360ea5);})['catch'](function(_0xddf3f7){logger[_0x4fbd('0x15')]('GetContactRecallMe',_0xddf3f7[_0x4fbd('0x16')],_0x6ff2b8);_0x3eab96(_0x193125[_0x4fbd('0x15')](0x1f4,_0xddf3f7[_0x4fbd('0x16')]));});});});};exports[_0x4fbd('0x42')]=function(_0x40a99e){var _0x54c065=this;return new Promise(function(_0x52af6d,_0x1ec126){db[_0x4fbd('0x24')][_0x4fbd('0x43')]()[_0x4fbd('0x11')](function(_0x4f46fc){return db[_0x4fbd('0x17')][_0x4fbd('0x8')]({'raw':_0x40a99e['options']?_0x40a99e[_0x4fbd('0x9')][_0x4fbd('0xa')]===undefined?!![]:![]:!![],'where':_0x40a99e[_0x4fbd('0x9')]?_0x40a99e[_0x4fbd('0x9')][_0x4fbd('0xb')]||null:null,'attributes':_0x40a99e[_0x4fbd('0x9')]?_0x40a99e['options'][_0x4fbd('0xc')]||null:null,'limit':_0x40a99e[_0x4fbd('0x9')]?_0x40a99e[_0x4fbd('0x9')][_0x4fbd('0xd')]||null:null,'include':_0x40a99e[_0x4fbd('0x9')]?_0x40a99e['options'][_0x4fbd('0xe')]?_['map'](_0x40a99e['options'][_0x4fbd('0xe')],function(_0x5be849){return{'model':db[_0x5be849[_0x4fbd('0xf')]],'as':_0x5be849['as'],'attributes':_0x5be849['as']===_0x4fbd('0x2a')?_['keys'](_0x4f46fc):_0x5be849[_0x4fbd('0xc')],'include':_0x5be849[_0x4fbd('0xe')]?_['map'](_0x5be849[_0x4fbd('0xe')],function(_0x44079b){return{'model':db[_0x44079b['model']],'as':_0x44079b['as'],'attributes':_0x44079b[_0x4fbd('0xc')],'include':_0x44079b[_0x4fbd('0xe')]?_[_0x4fbd('0x10')](_0x44079b[_0x4fbd('0xe')],function(_0x22413c){return{'model':db[_0x22413c[_0x4fbd('0xf')]],'as':_0x22413c['as'],'attributes':_0x22413c[_0x4fbd('0xc')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x14f1a7){logger[_0x4fbd('0x12')](_0x4fbd('0x7'),_0x40a99e);logger[_0x4fbd('0x19')](_0x4fbd('0x7'),_0x40a99e,JSON['stringify'](_0x14f1a7));_0x52af6d(_0x14f1a7);})[_0x4fbd('0x14')](function(_0x26f512){logger[_0x4fbd('0x15')]('GetCmHopper',_0x26f512[_0x4fbd('0x16')],_0x40a99e);_0x1ec126(_0x54c065[_0x4fbd('0x15')](0x1f4,_0x26f512[_0x4fbd('0x16')]));});});});};exports[_0x4fbd('0x44')]=function(_0x253953){var _0x2285ce=this;return new Promise(function(_0x193c83,_0x476f69){return db[_0x4fbd('0x24')][_0x4fbd('0x45')]({'raw':!![],'where':{'phone':_0x253953[_0x4fbd('0x9')][_0x4fbd('0xb')][_0x4fbd('0x46')]},'attributes':['id',_0x4fbd('0x47')],'order':[['id',_0x4fbd('0x48')]]})['then'](function(_0x47d86b){logger[_0x4fbd('0x12')]('getContactByPhone',_0x253953);logger[_0x4fbd('0x19')]('getContactByPhone',_0x253953,JSON['stringify'](_0x47d86b));_0x193c83(_0x47d86b);})[_0x4fbd('0x14')](function(_0x57353f){logger[_0x4fbd('0x15')]('getContactByPhone',_0x57353f[_0x4fbd('0x16')],_0x253953);_0x476f69(_0x2285ce[_0x4fbd('0x15')](0x1f4,_0x57353f[_0x4fbd('0x16')]));});});};exports[_0x4fbd('0x49')]=function(_0x19fc34){var _0x4a9a82=this;return new Promise(function(_0x5b59d9,_0x44fcbf){return db['sequelize'][_0x4fbd('0x26')](function(_0x5c7b2d){var _0x2b41a2=_0x19fc34['options']&&_0x19fc34[_0x4fbd('0x9')][_0x4fbd('0xb')]?_0x19fc34[_0x4fbd('0x9')][_0x4fbd('0xb')]:{};return db[_0x4fbd('0x17')][_0x4fbd('0x1f')](_0x19fc34[_0x4fbd('0x1d')],{'where':_0x2b41a2,'transaction':_0x5c7b2d})[_0x4fbd('0x11')](function(_0x1235be){logger[_0x4fbd('0x12')](_0x4fbd('0x49'),_0x19fc34);logger[_0x4fbd('0x19')](_0x4fbd('0x49'),_0x19fc34,JSON[_0x4fbd('0x13')](_0x1235be));_0x5b59d9(_0x1235be);})[_0x4fbd('0x14')](function(_0x3e22de){logger['error'](_0x4fbd('0x49'),_0x3e22de['message'],_0x19fc34);_0x44fcbf(_0x4a9a82[_0x4fbd('0x15')](0x1f4,_0x3e22de[_0x4fbd('0x16')]));});});});};exports[_0x4fbd('0x4a')]=function(_0x27bec2){var _0xc66df0=this;var _0x5435df=_0x27bec2[_0x4fbd('0x1d')]['where'][_0x4fbd('0x4b')];var _0x5343e1=_0x27bec2['body'][_0x4fbd('0xb')][_0x4fbd('0x4c')];var _0x4f8550=_0x27bec2[_0x4fbd('0x1d')][_0x4fbd('0xb')][_0x4fbd('0x4d')];return new Promise(function(_0x11c5dd,_0x4eb91a){return db[_0x4fbd('0x17')][_0x4fbd('0x8')]({'where':{'voiceQueueId':{'$in':_0x5435df},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0x4fbd('0x25')][_0x4fbd('0x3a')](_0x4fbd('0x4e')+_0x5343e1+'\x20MINUTE'),'$gt':db[_0x4fbd('0x25')]['literal'](_0x4fbd('0x4f'))}},'UserId':{'$in':_0x4f8550}},'include':[{'model':db['CmContact'],'as':_0x4fbd('0x2a')},{'model':db[_0x4fbd('0x2c')],'as':'Agent','attributes':['id',_0x4fbd('0x2d'),'voicePause']},{'model':db[_0x4fbd('0x50')],'as':_0x4fbd('0x51')}]})[_0x4fbd('0x11')](function(_0x355910){if(_0x355910[_0x4fbd('0x32')]>0x0){return db[_0x4fbd('0x25')][_0x4fbd('0x26')](function(_0x13e8b4){return db[_0x4fbd('0x17')][_0x4fbd('0x1f')]({'recallmeNotifiedDate':db[_0x4fbd('0x25')][_0x4fbd('0x3a')](_0x4fbd('0x4f'))},{'where':{'id':{'$in':_[_0x4fbd('0x10')](_0x355910,'id')}},'transaction':_0x13e8b4})[_0x4fbd('0x11')](function(){_0x11c5dd(_0x355910);})[_0x4fbd('0x14')](function(_0x3095a7){logger[_0x4fbd('0x15')](_0x4fbd('0x4a'),_0x3095a7['message'],_0x27bec2);_0x4eb91a(_0xc66df0[_0x4fbd('0x15')](0x1f4,_0x3095a7[_0x4fbd('0x16')]));});})['catch'](function(_0x2babdd){logger[_0x4fbd('0x15')]('CmHopperHandlePreviewRecallNotifications',_0x2babdd[_0x4fbd('0x16')],_0x27bec2);_0x4eb91a(_0xc66df0['error'](0x1f4,_0x2babdd[_0x4fbd('0x16')]));});}else{_0x11c5dd(_0x355910);}});});};
\ No newline at end of file