a7d5005bfbc25e1b8f8f96ed12089d6ff9b18358
[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 _0x27ce=['join','\x20|\x20','stack','util','bluebird','jayson/promise','lodash','../../../config/logger','client','http','request','then','error','message','result','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','push','Command','format','indexOf','true','catch','[%s][INTERVAL]\x20%s','all','some','[%s][INTERVAL]\x20%s\x20%s'];(function(_0x5959c9,_0x2ed153){var _0x4ffcbc=function(_0x459b7a){while(--_0x459b7a){_0x5959c9['push'](_0x5959c9['shift']());}};_0x4ffcbc(++_0x2ed153);}(_0x27ce,0x1d4));var _0xe27c=function(_0x31ecaf,_0x341af0){_0x31ecaf=_0x31ecaf-0x0;var _0x554883=_0x27ce[_0x31ecaf];return _0x554883;};'use strict';var util=require(_0xe27c('0x0'));var BPromise=require(_0xe27c('0x1'));var jayson=require(_0xe27c('0x2'));var _=require(_0xe27c('0x3'));var logger=require(_0xe27c('0x4'))('routing');var client=jayson[_0xe27c('0x5')][_0xe27c('0x6')]({'port':0x232a});function request(_0x58b8f5,_0x1c68d1){return new BPromise(function(_0x1ff02d,_0x2eb01e){return client[_0xe27c('0x7')](_0x58b8f5,_0x1c68d1)[_0xe27c('0x8')](function(_0x2cbac4){if(_0x2cbac4[_0xe27c('0x9')]){return _0x2eb01e(_0x2cbac4[_0xe27c('0x9')][_0xe27c('0xa')]);}else{return _0x1ff02d(_0x2cbac4[_0xe27c('0xb')]);}})['catch'](function(_0x3c5a24){return _0x2eb01e(_0x3c5a24);});});}exports[_0xe27c('0xc')]=function(_0x272921,_0x2908a5,_0x50fd5c){return function(_0x495603){if(_0x50fd5c[_0xe27c('0xd')]&&!_0x50fd5c[_0xe27c('0xd')][_0x272921]){logger[_0xe27c('0xe')](_0xe27c('0xf'),_0x272921);return _0x495603[_0xe27c('0x10')]();}var _0x2d01b1=[];for(var _0x240470=0x0;_0x240470<_0x2908a5[_0xe27c('0x11')];_0x240470+=0x1){_0x2d01b1[_0xe27c('0x12')](request(_0xe27c('0x13'),{'command':util[_0xe27c('0x14')]('iftime\x20%s',_0x2908a5[_0x240470])})[_0xe27c('0x8')](function(_0x51ad00){return _0x51ad00&&_0x51ad00[_0xe27c('0xa')]&&_0x51ad00[_0xe27c('0xa')][_0xe27c('0x15')](_0xe27c('0x16'))>=0x0?!![]:![];})[_0xe27c('0x17')](function(){logger[_0xe27c('0x9')](_0xe27c('0x18'),_0x272921,_0x2908a5[_0x240470]);}));}BPromise[_0xe27c('0x19')](_0x2d01b1)[_0xe27c('0x8')](function(_0x3bf29c){var _0x54c9dd=_[_0xe27c('0x1a')](_0x3bf29c);logger[_0xe27c('0xe')](_0xe27c('0x1b'),_0x272921,_0x2908a5[_0xe27c('0x1c')](_0xe27c('0x1d')),_0x54c9dd);_0x495603['when'](_0x54c9dd);})[_0xe27c('0x17')](function(_0x469851){logger[_0xe27c('0x9')](_0xe27c('0x1b'),_0x272921,_0x2908a5[_0xe27c('0x1c')](_0xe27c('0x1d')),_0x469851[_0xe27c('0x1e')]);_0x495603[_0xe27c('0x10')]();});};};