Built motion from commit 67e5df37.|2.0.66
[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 _0x447c=['result','catch','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','push','Command','iftime\x20%s','message','[%s][INTERVAL]\x20%s','all','some','join','log','\x20|\x20','stringify','bluebird','jayson/promise','lodash','../../../config/logger','routing','client','http','request','then','error'];(function(_0x43f489,_0x2b4fea){var _0x4134b4=function(_0x4365f6){while(--_0x4365f6){_0x43f489['push'](_0x43f489['shift']());}};_0x4134b4(++_0x2b4fea);}(_0x447c,0xa4));var _0xc447=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x447c[_0x122ef9];return _0x42fba0;};'use strict';var util=require('util');var BPromise=require(_0xc447('0x0'));var jayson=require(_0xc447('0x1'));var _=require(_0xc447('0x2'));var logger=require(_0xc447('0x3'))(_0xc447('0x4'));var client=jayson[_0xc447('0x5')][_0xc447('0x6')]({'port':0x232a});function request(_0x2f85f1,_0x27a6d1){return new BPromise(function(_0x173c68,_0xcf59e0){return client[_0xc447('0x7')](_0x2f85f1,_0x27a6d1)[_0xc447('0x8')](function(_0x45444b){if(_0x45444b[_0xc447('0x9')]){return _0xcf59e0(_0x45444b[_0xc447('0x9')]['message']);}else{return _0x173c68(_0x45444b[_0xc447('0xa')]);}})[_0xc447('0xb')](function(_0x1c3eaa){return _0xcf59e0(_0x1c3eaa);});});}exports[_0xc447('0xc')]=function(_0x1c590f,_0x8b6968,_0x35757f){return function(_0x180deb){if(_0x35757f[_0xc447('0xd')]&&!_0x35757f[_0xc447('0xd')][_0x1c590f]){logger[_0xc447('0xe')](_0xc447('0xf'),_0x1c590f);return _0x180deb[_0xc447('0x10')]();}var _0x48ca5e=[];for(var _0x3e6905=0x0;_0x3e6905<_0x8b6968[_0xc447('0x11')];_0x3e6905+=0x1){_0x48ca5e[_0xc447('0x12')](request(_0xc447('0x13'),{'command':util['format'](_0xc447('0x14'),_0x8b6968[_0x3e6905])})[_0xc447('0x8')](function(_0x597240){return _0x597240&&_0x597240[_0xc447('0x15')]&&_0x597240['message']['indexOf']('true')>=0x0?!![]:![];})[_0xc447('0xb')](function(_0x504de4){logger[_0xc447('0x9')](_0xc447('0x16'),_0x1c590f,_0x8b6968[_0x3e6905]);}));}BPromise[_0xc447('0x17')](_0x48ca5e)[_0xc447('0x8')](function(_0x2d1202){var _0x2adf9d=_[_0xc447('0x18')](_0x2d1202);logger[_0xc447('0xe')]('[%s][INTERVAL]\x20%s\x20%s',_0x1c590f,_0x8b6968[_0xc447('0x19')]('\x20|\x20'),_0x2adf9d);_0x180deb['when'](_0x2adf9d);})['catch'](function(_0x30b8cd){console[_0xc447('0x1a')](_0x30b8cd);logger[_0xc447('0x9')]('[%s][INTERVAL]\x20%s\x20%s',_0x1c590f,_0x8b6968['join'](_0xc447('0x1b')),JSON[_0xc447('0x1c')](_0x30b8cd));_0x180deb['stop']();});};};