Built motion from commit (unavailable).|2.5.15
[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 _0x864c=['push','iftime\x20%s','then','message','true','[%s][INTERVAL]\x20%s','\x20|\x20','when','[%s][INTERVAL]\x20%s\x20%s','join','stack','stop','util','bluebird','jayson/promise','lodash','../../../config/logger','routing','client','request','error','result','catch','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED'];(function(_0x444dbf,_0x3f13b2){var _0x355e9a=function(_0x3447a2){while(--_0x3447a2){_0x444dbf['push'](_0x444dbf['shift']());}};_0x355e9a(++_0x3f13b2);}(_0x864c,0x1f2));var _0xc864=function(_0x3310c0,_0x4174e8){_0x3310c0=_0x3310c0-0x0;var _0x4517fc=_0x864c[_0x3310c0];return _0x4517fc;};'use strict';var util=require(_0xc864('0x0'));var BPromise=require(_0xc864('0x1'));var jayson=require(_0xc864('0x2'));var _=require(_0xc864('0x3'));var logger=require(_0xc864('0x4'))(_0xc864('0x5'));var client=jayson[_0xc864('0x6')]['http']({'port':0x232a});function request(_0x79a1e4,_0x4c6d03){return new BPromise(function(_0x5be63d,_0x2d62f2){return client[_0xc864('0x7')](_0x79a1e4,_0x4c6d03)['then'](function(_0x572b08){if(_0x572b08['error']){return _0x2d62f2(_0x572b08[_0xc864('0x8')]['message']);}else{return _0x5be63d(_0x572b08[_0xc864('0x9')]);}})[_0xc864('0xa')](function(_0xfc5512){return _0x2d62f2(_0xfc5512);});});}exports[_0xc864('0xb')]=function(_0x538c3f,_0x227667,_0x1dfedf){return function(_0x23e474){if(_0x1dfedf[_0xc864('0xc')]&&!_0x1dfedf[_0xc864('0xc')][_0x538c3f]){logger[_0xc864('0xd')](_0xc864('0xe'),_0x538c3f);return _0x23e474['stop']();}var _0x283716=[];for(var _0x4a48a7=0x0;_0x4a48a7<_0x227667['length'];_0x4a48a7+=0x1){_0x283716[_0xc864('0xf')](request('Command',{'command':util['format'](_0xc864('0x10'),_0x227667[_0x4a48a7])})[_0xc864('0x11')](function(_0x491fe5){return _0x491fe5&&_0x491fe5[_0xc864('0x12')]&&_0x491fe5['message']['indexOf'](_0xc864('0x13'))>=0x0?!![]:![];})[_0xc864('0xa')](function(_0xcf17c1){logger[_0xc864('0x8')](_0xc864('0x14'),_0x538c3f,_0x227667[_0x4a48a7]);}));}BPromise['all'](_0x283716)[_0xc864('0x11')](function(_0x56bdb2){var _0x7b9ee0=_['some'](_0x56bdb2);logger[_0xc864('0xd')]('[%s][INTERVAL]\x20%s\x20%s',_0x538c3f,_0x227667['join'](_0xc864('0x15')),_0x7b9ee0);_0x23e474[_0xc864('0x16')](_0x7b9ee0);})[_0xc864('0xa')](function(_0x301a6f){console['log'](_0x301a6f);logger['error'](_0xc864('0x17'),_0x538c3f,_0x227667[_0xc864('0x18')]('\x20|\x20'),_0x301a6f[_0xc864('0x19')]);_0x23e474[_0xc864('0x1a')]();});};};