Built motion from commit (unavailable).|2.5.22
[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 _0x149a=['error','message','catch','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','push','format','iftime\x20%s','then','indexOf','true','all','some','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','when','log','stack','stop','lodash','../../../config/logger','routing','client','http','request'];(function(_0x671369,_0x433da5){var _0x33f2b4=function(_0x2e9db2){while(--_0x2e9db2){_0x671369['push'](_0x671369['shift']());}};_0x33f2b4(++_0x433da5);}(_0x149a,0xb7));var _0xa149=function(_0x3c2b5d,_0x27a30c){_0x3c2b5d=_0x3c2b5d-0x0;var _0x52deda=_0x149a[_0x3c2b5d];return _0x52deda;};'use strict';var util=require('util');var BPromise=require('bluebird');var jayson=require('jayson/promise');var _=require(_0xa149('0x0'));var logger=require(_0xa149('0x1'))(_0xa149('0x2'));var client=jayson[_0xa149('0x3')][_0xa149('0x4')]({'port':0x232a});function request(_0x3484d4,_0x1f9758){return new BPromise(function(_0x45e94d,_0x9c96c9){return client[_0xa149('0x5')](_0x3484d4,_0x1f9758)['then'](function(_0x4a21cb){if(_0x4a21cb['error']){return _0x9c96c9(_0x4a21cb[_0xa149('0x6')][_0xa149('0x7')]);}else{return _0x45e94d(_0x4a21cb['result']);}})[_0xa149('0x8')](function(_0xc1d6de){return _0x9c96c9(_0xc1d6de);});});}exports['condition']=function(_0x3b281b,_0x608d16,_0x411a25){return function(_0x2501b0){if(_0x411a25[_0xa149('0x9')]&&!_0x411a25['rules'][_0x3b281b]){logger[_0xa149('0xa')](_0xa149('0xb'),_0x3b281b);return _0x2501b0['stop']();}var _0x1709fa=[];for(var _0x5e50f4=0x0;_0x5e50f4<_0x608d16['length'];_0x5e50f4+=0x1){_0x1709fa[_0xa149('0xc')](request('Command',{'command':util[_0xa149('0xd')](_0xa149('0xe'),_0x608d16[_0x5e50f4])})[_0xa149('0xf')](function(_0x2af045){return _0x2af045&&_0x2af045['message']&&_0x2af045['message'][_0xa149('0x10')](_0xa149('0x11'))>=0x0?!![]:![];})[_0xa149('0x8')](function(_0x2e4c96){logger[_0xa149('0x6')]('[%s][INTERVAL]\x20%s',_0x3b281b,_0x608d16[_0x5e50f4]);}));}BPromise[_0xa149('0x12')](_0x1709fa)['then'](function(_0x540b00){var _0x2d3343=_[_0xa149('0x13')](_0x540b00);logger[_0xa149('0xa')](_0xa149('0x14'),_0x3b281b,_0x608d16[_0xa149('0x15')](_0xa149('0x16')),_0x2d3343);_0x2501b0[_0xa149('0x17')](_0x2d3343);})[_0xa149('0x8')](function(_0xea81a2){console[_0xa149('0x18')](_0xea81a2);logger[_0xa149('0x6')](_0xa149('0x14'),_0x3b281b,_0x608d16['join'](_0xa149('0x16')),_0xea81a2[_0xa149('0x19')]);_0x2501b0[_0xa149('0x1a')]();});};};