Built motion from commit bab6f49e.|2.6.17
[motion2.git] / server / services / ami / rpc / 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 _0xe5a9=['isArray','length','resolve','number','every','string','map','concat','Request','IntervalIftime','intervalIftime','../../../config/logger','../client','stack','replace','silly','intervalIftime\x20called\x20with'];(function(_0x51d1b8,_0x50795f){var _0x1256c9=function(_0xc0322a){while(--_0xc0322a){_0x51d1b8['push'](_0x51d1b8['shift']());}};_0x1256c9(++_0x50795f);}(_0xe5a9,0x71));var _0x9e5a=function(_0x4b77a4,_0x238eef){_0x4b77a4=_0x4b77a4-0x0;var _0x434550=_0xe5a9[_0x4b77a4];return _0x434550;};var logger=require(_0x9e5a('0x0'))('dialer');var client=require(_0x9e5a('0x1'));function intervalIftime(_0x218324,_0x1086d4){const _0x292e19=new Error()[_0x9e5a('0x2')][_0x9e5a('0x3')](/^Error/,'')['trim']();logger[_0x9e5a('0x4')](_0x9e5a('0x5'),_0x218324,_0x1086d4,_0x292e19);const _0x311676=Array[_0x9e5a('0x6')](_0x218324);if(!_0x218324||_0x311676&&_0x218324[_0x9e5a('0x7')]===0x0){return Promise[_0x9e5a('0x8')](![]);}else{var _0x2fc987=[];var _0x40edfe=[];var _0x274e00=_0x311676?_0x218324:[_0x218324];var _0x18c90b=_0x274e00['every'](function(_0x1a6ed0){return typeof _0x1a6ed0===_0x9e5a('0x9');});var _0x3ebcab=_0x274e00[_0x9e5a('0xa')](function(_0xd1d017){return typeof _0xd1d017===_0x9e5a('0xb');});if(!_0x18c90b&&!_0x3ebcab){_0x2fc987=_0x274e00[_0x9e5a('0xc')](function(_0x33425e){return _0x33425e['id'];});if(_0x2fc987[_0x9e5a('0x7')]===0x0){_0x40edfe=_0x274e00['map'](function(_0x5626b4){return _0x5626b4['interval'];});}}else{if(_0x18c90b){_0x2fc987=_0x2fc987[_0x9e5a('0xd')](_0x274e00);}if(_0x3ebcab){_0x40edfe=_0x40edfe['concat'](_0x274e00);}}return client[_0x9e5a('0xe')](_0x9e5a('0xf'),{'intervalIds':_0x2fc987,'intervals':_0x40edfe,'timezone':_0x1086d4,'log':'IntervalIftime'});}}exports[_0x9e5a('0x10')]=intervalIftime;