Built motion from commit 616d3211.|2.6.4
[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 _0x6340=['when','\x20|\x20','util','bluebird','jayson/promise','lodash','../../../config/logger','routing','client','http','request','then','error','result','catch','condition','rules','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','push','Command','format','iftime\x20%s','message','indexOf','true','[%s][INTERVAL]\x20%s','all','some','info','[%s][INTERVAL]\x20%s\x20%s','join'];(function(_0x1af075,_0x26eedc){var _0x117f72=function(_0x2fad65){while(--_0x2fad65){_0x1af075['push'](_0x1af075['shift']());}};_0x117f72(++_0x26eedc);}(_0x6340,0xc8));var _0x0634=function(_0x16dfee,_0x1dba0b){_0x16dfee=_0x16dfee-0x0;var _0x3ced82=_0x6340[_0x16dfee];return _0x3ced82;};'use strict';var util=require(_0x0634('0x0'));var BPromise=require(_0x0634('0x1'));var jayson=require(_0x0634('0x2'));var _=require(_0x0634('0x3'));var logger=require(_0x0634('0x4'))(_0x0634('0x5'));var client=jayson[_0x0634('0x6')][_0x0634('0x7')]({'port':0x232a});function request(_0x36e80a,_0xf8a7b5){return new BPromise(function(_0x1a44b2,_0x4e7152){return client[_0x0634('0x8')](_0x36e80a,_0xf8a7b5)[_0x0634('0x9')](function(_0x5b0375){if(_0x5b0375[_0x0634('0xa')]){return _0x4e7152(_0x5b0375[_0x0634('0xa')]['message']);}else{return _0x1a44b2(_0x5b0375[_0x0634('0xb')]);}})[_0x0634('0xc')](function(_0x4e7864){return _0x4e7152(_0x4e7864);});});}exports[_0x0634('0xd')]=function(_0x5cd480,_0x5ec441,_0xbfd78d){return function(_0x1b0774){if(_0xbfd78d[_0x0634('0xe')]&&!_0xbfd78d[_0x0634('0xe')][_0x5cd480]){logger['info'](_0x0634('0xf'),_0x5cd480);return _0x1b0774[_0x0634('0x10')]();}var _0x39e7c8=[];for(var _0x1d5435=0x0;_0x1d5435<_0x5ec441[_0x0634('0x11')];_0x1d5435+=0x1){_0x39e7c8[_0x0634('0x12')](request(_0x0634('0x13'),{'command':util[_0x0634('0x14')](_0x0634('0x15'),_0x5ec441[_0x1d5435])})[_0x0634('0x9')](function(_0x5e18c8){return _0x5e18c8&&_0x5e18c8['message']&&_0x5e18c8[_0x0634('0x16')][_0x0634('0x17')](_0x0634('0x18'))>=0x0?!![]:![];})[_0x0634('0xc')](function(_0x58f639){logger[_0x0634('0xa')](_0x0634('0x19'),_0x5cd480,_0x5ec441[_0x1d5435]);}));}BPromise[_0x0634('0x1a')](_0x39e7c8)[_0x0634('0x9')](function(_0x66d565){var _0x54454f=_[_0x0634('0x1b')](_0x66d565);logger[_0x0634('0x1c')](_0x0634('0x1d'),_0x5cd480,_0x5ec441[_0x0634('0x1e')]('\x20|\x20'),_0x54454f);_0x1b0774[_0x0634('0x1f')](_0x54454f);})[_0x0634('0xc')](function(_0x227936){console['log'](_0x227936);logger['error'](_0x0634('0x1d'),_0x5cd480,_0x5ec441[_0x0634('0x1e')](_0x0634('0x20')),_0x227936['stack']);_0x1b0774['stop']();});};};