1e5f712f030c02b47eb23b6f01db0585958227cb
[motion2.git] / server / services / routing / server / interval.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 _0xc1db=['jayson/promise','lodash','../../../config/logger','routing','client','http','request','then','error','message','catch','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','Command','format','iftime\x20%s','indexOf','true','[%s][INTERVAL]\x20%s','all','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','when','log','stack','util','bluebird'];(function(_0x14f2a5,_0x3b924a){var _0x36538c=function(_0x185199){while(--_0x185199){_0x14f2a5['push'](_0x14f2a5['shift']());}};_0x36538c(++_0x3b924a);}(_0xc1db,0xfe));var _0xbc1d=function(_0x1981bf,_0x3e1836){_0x1981bf=_0x1981bf-0x0;var _0x3b3287=_0xc1db[_0x1981bf];return _0x3b3287;};'use strict';var util=require(_0xbc1d('0x0'));var BPromise=require(_0xbc1d('0x1'));var jayson=require(_0xbc1d('0x2'));var _=require(_0xbc1d('0x3'));var logger=require(_0xbc1d('0x4'))(_0xbc1d('0x5'));var client=jayson[_0xbc1d('0x6')][_0xbc1d('0x7')]({'port':0x232a});function request(_0x135d31,_0xb5f752){return new BPromise(function(_0x3a0369,_0x4dc7e8){return client[_0xbc1d('0x8')](_0x135d31,_0xb5f752)[_0xbc1d('0x9')](function(_0x124866){if(_0x124866[_0xbc1d('0xa')]){return _0x4dc7e8(_0x124866[_0xbc1d('0xa')][_0xbc1d('0xb')]);}else{return _0x3a0369(_0x124866['result']);}})[_0xbc1d('0xc')](function(_0x418148){return _0x4dc7e8(_0x418148);});});}exports[_0xbc1d('0xd')]=function(_0x36be4d,_0xae8311,_0x43250b){return function(_0x4270af){if(_0x43250b[_0xbc1d('0xe')]&&!_0x43250b[_0xbc1d('0xe')][_0x36be4d]){logger[_0xbc1d('0xf')](_0xbc1d('0x10'),_0x36be4d);return _0x4270af[_0xbc1d('0x11')]();}var _0x408729=[];for(var _0x5dbaeb=0x0;_0x5dbaeb<_0xae8311[_0xbc1d('0x12')];_0x5dbaeb+=0x1){_0x408729['push'](request(_0xbc1d('0x13'),{'command':util[_0xbc1d('0x14')](_0xbc1d('0x15'),_0xae8311[_0x5dbaeb])})[_0xbc1d('0x9')](function(_0x1d6eda){return _0x1d6eda&&_0x1d6eda[_0xbc1d('0xb')]&&_0x1d6eda[_0xbc1d('0xb')][_0xbc1d('0x16')](_0xbc1d('0x17'))>=0x0?!![]:![];})['catch'](function(_0x1f33ec){logger['error'](_0xbc1d('0x18'),_0x36be4d,_0xae8311[_0x5dbaeb]);}));}BPromise[_0xbc1d('0x19')](_0x408729)[_0xbc1d('0x9')](function(_0x245ad7){var _0x327504=_['some'](_0x245ad7);logger[_0xbc1d('0xf')](_0xbc1d('0x1a'),_0x36be4d,_0xae8311[_0xbc1d('0x1b')](_0xbc1d('0x1c')),_0x327504);_0x4270af[_0xbc1d('0x1d')](_0x327504);})[_0xbc1d('0xc')](function(_0x43cf3a){console[_0xbc1d('0x1e')](_0x43cf3a);logger['error'](_0xbc1d('0x1a'),_0x36be4d,_0xae8311[_0xbc1d('0x1b')]('\x20|\x20'),_0x43cf3a[_0xbc1d('0x1f')]);_0x4270af[_0xbc1d('0x11')]();});};};