Built motion from commit (unavailable).|2.5.5
[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 _0x8e6f=['jayson/promise','lodash','routing','client','http','request','then','error','message','result','condition','rules','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','format','iftime\x20%s','indexOf','true','catch','[%s][INTERVAL]\x20%s','some','info','join','\x20|\x20','log','[%s][INTERVAL]\x20%s\x20%s','stack','util','bluebird'];(function(_0x4d40dd,_0x39592b){var _0x1c51f2=function(_0x53e502){while(--_0x53e502){_0x4d40dd['push'](_0x4d40dd['shift']());}};_0x1c51f2(++_0x39592b);}(_0x8e6f,0xd0));var _0xf8e6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8e6f[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0xf8e6('0x0'));var BPromise=require(_0xf8e6('0x1'));var jayson=require(_0xf8e6('0x2'));var _=require(_0xf8e6('0x3'));var logger=require('../../../config/logger')(_0xf8e6('0x4'));var client=jayson[_0xf8e6('0x5')][_0xf8e6('0x6')]({'port':0x232a});function request(_0x5dff3b,_0x584800){return new BPromise(function(_0x4cedc8,_0x434ebf){return client[_0xf8e6('0x7')](_0x5dff3b,_0x584800)[_0xf8e6('0x8')](function(_0x2ecb0d){if(_0x2ecb0d['error']){return _0x434ebf(_0x2ecb0d[_0xf8e6('0x9')][_0xf8e6('0xa')]);}else{return _0x4cedc8(_0x2ecb0d[_0xf8e6('0xb')]);}})['catch'](function(_0x203536){return _0x434ebf(_0x203536);});});}exports[_0xf8e6('0xc')]=function(_0x10486c,_0x55c155,_0x270414){return function(_0x23ffa5){if(_0x270414[_0xf8e6('0xd')]&&!_0x270414[_0xf8e6('0xd')][_0x10486c]){logger['info'](_0xf8e6('0xe'),_0x10486c);return _0x23ffa5[_0xf8e6('0xf')]();}var _0x27a713=[];for(var _0x35f120=0x0;_0x35f120<_0x55c155[_0xf8e6('0x10')];_0x35f120+=0x1){_0x27a713['push'](request('Command',{'command':util[_0xf8e6('0x11')](_0xf8e6('0x12'),_0x55c155[_0x35f120])})[_0xf8e6('0x8')](function(_0x5adca3){return _0x5adca3&&_0x5adca3[_0xf8e6('0xa')]&&_0x5adca3['message'][_0xf8e6('0x13')](_0xf8e6('0x14'))>=0x0?!![]:![];})[_0xf8e6('0x15')](function(_0x56700a){logger[_0xf8e6('0x9')](_0xf8e6('0x16'),_0x10486c,_0x55c155[_0x35f120]);}));}BPromise['all'](_0x27a713)[_0xf8e6('0x8')](function(_0x3509dc){var _0x3c6db8=_[_0xf8e6('0x17')](_0x3509dc);logger[_0xf8e6('0x18')]('[%s][INTERVAL]\x20%s\x20%s',_0x10486c,_0x55c155[_0xf8e6('0x19')](_0xf8e6('0x1a')),_0x3c6db8);_0x23ffa5['when'](_0x3c6db8);})[_0xf8e6('0x15')](function(_0x17250f){console[_0xf8e6('0x1b')](_0x17250f);logger[_0xf8e6('0x9')](_0xf8e6('0x1c'),_0x10486c,_0x55c155[_0xf8e6('0x19')](_0xf8e6('0x1a')),_0x17250f[_0xf8e6('0x1d')]);_0x23ffa5['stop']();});};};