Built motion from commit 5ae82ce5.|2.6.7
[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 _0x29e3=['Command','iftime\x20%s','indexOf','[%s][INTERVAL]\x20%s','all','some','info','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','log','stack','util','bluebird','lodash','../../../config/logger','client','request','then','error','message','catch','condition','rules','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','push'];(function(_0x29279c,_0x570176){var _0x279b1f=function(_0xd36d1f){while(--_0xd36d1f){_0x29279c['push'](_0x29279c['shift']());}};_0x279b1f(++_0x570176);}(_0x29e3,0x124));var _0x329e=function(_0x32d25a,_0x559790){_0x32d25a=_0x32d25a-0x0;var _0x316a8d=_0x29e3[_0x32d25a];return _0x316a8d;};'use strict';var util=require(_0x329e('0x0'));var BPromise=require(_0x329e('0x1'));var jayson=require('jayson/promise');var _=require(_0x329e('0x2'));var logger=require(_0x329e('0x3'))('routing');var client=jayson[_0x329e('0x4')]['http']({'port':0x232a});function request(_0x13ead9,_0x1c5f70){return new BPromise(function(_0x11933f,_0x4e65a5){return client[_0x329e('0x5')](_0x13ead9,_0x1c5f70)[_0x329e('0x6')](function(_0x4cb561){if(_0x4cb561[_0x329e('0x7')]){return _0x4e65a5(_0x4cb561[_0x329e('0x7')][_0x329e('0x8')]);}else{return _0x11933f(_0x4cb561['result']);}})[_0x329e('0x9')](function(_0xa3497d){return _0x4e65a5(_0xa3497d);});});}exports[_0x329e('0xa')]=function(_0x39502d,_0x2e2282,_0x2b2147){return function(_0x344639){if(_0x2b2147[_0x329e('0xb')]&&!_0x2b2147[_0x329e('0xb')][_0x39502d]){logger['info'](_0x329e('0xc'),_0x39502d);return _0x344639[_0x329e('0xd')]();}var _0x1e2459=[];for(var _0x4508c6=0x0;_0x4508c6<_0x2e2282[_0x329e('0xe')];_0x4508c6+=0x1){_0x1e2459[_0x329e('0xf')](request(_0x329e('0x10'),{'command':util['format'](_0x329e('0x11'),_0x2e2282[_0x4508c6])})[_0x329e('0x6')](function(_0x2f7706){return _0x2f7706&&_0x2f7706[_0x329e('0x8')]&&_0x2f7706[_0x329e('0x8')][_0x329e('0x12')]('true')>=0x0?!![]:![];})[_0x329e('0x9')](function(_0x1173dd){logger[_0x329e('0x7')](_0x329e('0x13'),_0x39502d,_0x2e2282[_0x4508c6]);}));}BPromise[_0x329e('0x14')](_0x1e2459)['then'](function(_0x863b09){var _0x324ce3=_[_0x329e('0x15')](_0x863b09);logger[_0x329e('0x16')](_0x329e('0x17'),_0x39502d,_0x2e2282[_0x329e('0x18')](_0x329e('0x19')),_0x324ce3);_0x344639['when'](_0x324ce3);})[_0x329e('0x9')](function(_0x577cff){console[_0x329e('0x1a')](_0x577cff);logger['error'](_0x329e('0x17'),_0x39502d,_0x2e2282[_0x329e('0x18')](_0x329e('0x19')),_0x577cff[_0x329e('0x1b')]);_0x344639[_0x329e('0xd')]();});};};