Built motion from commit 3c2ce842.|2.6.31
[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 _0xc4cc=['catch','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','push','format','then','indexOf','true','[%s][INTERVAL]\x20%s','all','some','join','\x20|\x20','when','[%s][INTERVAL]\x20%s\x20%s','stack','util','bluebird','jayson/promise','lodash','../../../config/logger','routing','client','http','request','error','message'];(function(_0x32d83d,_0x1aaa1f){var _0xacc348=function(_0xd5609d){while(--_0xd5609d){_0x32d83d['push'](_0x32d83d['shift']());}};_0xacc348(++_0x1aaa1f);}(_0xc4cc,0x86));var _0xcc4c=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xc4cc[_0x14add3];return _0x4a174f;};'use strict';var util=require(_0xcc4c('0x0'));var BPromise=require(_0xcc4c('0x1'));var jayson=require(_0xcc4c('0x2'));var _=require(_0xcc4c('0x3'));var logger=require(_0xcc4c('0x4'))(_0xcc4c('0x5'));var client=jayson[_0xcc4c('0x6')][_0xcc4c('0x7')]({'port':0x232a});function request(_0x2af69d,_0xe862cd){return new BPromise(function(_0x38e9f5,_0x538d7b){return client[_0xcc4c('0x8')](_0x2af69d,_0xe862cd)['then'](function(_0x2669b7){if(_0x2669b7['error']){return _0x538d7b(_0x2669b7[_0xcc4c('0x9')][_0xcc4c('0xa')]);}else{return _0x38e9f5(_0x2669b7['result']);}})[_0xcc4c('0xb')](function(_0x213c4d){return _0x538d7b(_0x213c4d);});});}exports['condition']=function(_0x39562e,_0x18fc99,_0x25642a){return function(_0x321bae){if(_0x25642a[_0xcc4c('0xc')]&&!_0x25642a[_0xcc4c('0xc')][_0x39562e]){logger[_0xcc4c('0xd')](_0xcc4c('0xe'),_0x39562e);return _0x321bae[_0xcc4c('0xf')]();}var _0x495d82=[];for(var _0x595e21=0x0;_0x595e21<_0x18fc99['length'];_0x595e21+=0x1){_0x495d82[_0xcc4c('0x10')](request('Command',{'command':util[_0xcc4c('0x11')]('iftime\x20%s',_0x18fc99[_0x595e21])})[_0xcc4c('0x12')](function(_0xea2b2a){return _0xea2b2a&&_0xea2b2a[_0xcc4c('0xa')]&&_0xea2b2a[_0xcc4c('0xa')][_0xcc4c('0x13')](_0xcc4c('0x14'))>=0x0?!![]:![];})[_0xcc4c('0xb')](function(){logger[_0xcc4c('0x9')](_0xcc4c('0x15'),_0x39562e,_0x18fc99[_0x595e21]);}));}BPromise[_0xcc4c('0x16')](_0x495d82)['then'](function(_0x6450a0){var _0x4dd8e3=_[_0xcc4c('0x17')](_0x6450a0);logger[_0xcc4c('0xd')]('[%s][INTERVAL]\x20%s\x20%s',_0x39562e,_0x18fc99[_0xcc4c('0x18')](_0xcc4c('0x19')),_0x4dd8e3);_0x321bae[_0xcc4c('0x1a')](_0x4dd8e3);})['catch'](function(_0x1de4c3){logger[_0xcc4c('0x9')](_0xcc4c('0x1b'),_0x39562e,_0x18fc99[_0xcc4c('0x18')](_0xcc4c('0x19')),_0x1de4c3[_0xcc4c('0x1c')]);_0x321bae['stop']();});};};