Built motion from commit (unavailable).|2.5.22
[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 _0xac03=['stack','util','bluebird','jayson/promise','lodash','client','http','request','then','error','message','result','catch','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','push','format','iftime\x20%s','indexOf','true','[%s][INTERVAL]\x20%s','all','some','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','when','log'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0xac03,0xe1));var _0x3ac0=function(_0x463e24,_0x4029b7){_0x463e24=_0x463e24-0x0;var _0x1d3304=_0xac03[_0x463e24];return _0x1d3304;};'use strict';var util=require(_0x3ac0('0x0'));var BPromise=require(_0x3ac0('0x1'));var jayson=require(_0x3ac0('0x2'));var _=require(_0x3ac0('0x3'));var logger=require('../../../config/logger')('routing');var client=jayson[_0x3ac0('0x4')][_0x3ac0('0x5')]({'port':0x232a});function request(_0x4731a8,_0x8758b){return new BPromise(function(_0x2f50cc,_0x25ceb2){return client[_0x3ac0('0x6')](_0x4731a8,_0x8758b)[_0x3ac0('0x7')](function(_0x4fd69b){if(_0x4fd69b[_0x3ac0('0x8')]){return _0x25ceb2(_0x4fd69b[_0x3ac0('0x8')][_0x3ac0('0x9')]);}else{return _0x2f50cc(_0x4fd69b[_0x3ac0('0xa')]);}})[_0x3ac0('0xb')](function(_0x5c0167){return _0x25ceb2(_0x5c0167);});});}exports[_0x3ac0('0xc')]=function(_0x5997bd,_0x3533d7,_0xe280e8){return function(_0x20a10b){if(_0xe280e8[_0x3ac0('0xd')]&&!_0xe280e8[_0x3ac0('0xd')][_0x5997bd]){logger[_0x3ac0('0xe')](_0x3ac0('0xf'),_0x5997bd);return _0x20a10b[_0x3ac0('0x10')]();}var _0xe244e9=[];for(var _0x5b74e8=0x0;_0x5b74e8<_0x3533d7[_0x3ac0('0x11')];_0x5b74e8+=0x1){_0xe244e9[_0x3ac0('0x12')](request('Command',{'command':util[_0x3ac0('0x13')](_0x3ac0('0x14'),_0x3533d7[_0x5b74e8])})['then'](function(_0x125246){return _0x125246&&_0x125246[_0x3ac0('0x9')]&&_0x125246[_0x3ac0('0x9')][_0x3ac0('0x15')](_0x3ac0('0x16'))>=0x0?!![]:![];})[_0x3ac0('0xb')](function(_0x3ec99a){logger['error'](_0x3ac0('0x17'),_0x5997bd,_0x3533d7[_0x5b74e8]);}));}BPromise[_0x3ac0('0x18')](_0xe244e9)[_0x3ac0('0x7')](function(_0x37a256){var _0x2208bf=_[_0x3ac0('0x19')](_0x37a256);logger['info'](_0x3ac0('0x1a'),_0x5997bd,_0x3533d7[_0x3ac0('0x1b')](_0x3ac0('0x1c')),_0x2208bf);_0x20a10b[_0x3ac0('0x1d')](_0x2208bf);})['catch'](function(_0x186206){console[_0x3ac0('0x1e')](_0x186206);logger[_0x3ac0('0x8')](_0x3ac0('0x1a'),_0x5997bd,_0x3533d7[_0x3ac0('0x1b')](_0x3ac0('0x1c')),_0x186206[_0x3ac0('0x1f')]);_0x20a10b[_0x3ac0('0x10')]();});};};