Built motion from commit (unavailable).|2.5.30
[motion2.git] / server / api / dashboard / dashboard.rpc.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 _0x9a8a=['request\x20sent','Dashboard,\x20%s,\x20%s,\x20%s','error','message','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','socket.io-emitter','./dashboard.socket','then','info','Dashboard,\x20%s,\x20%s'];(function(_0x41ce54,_0x2ceefc){var _0x60b7e8=function(_0x5151aa){while(--_0x5151aa){_0x41ce54['push'](_0x41ce54['shift']());}};_0x60b7e8(++_0x2ceefc);}(_0x9a8a,0x1bd));var _0xa9a8=function(_0x5cadaa,_0x9f737d){_0x5cadaa=_0x5cadaa-0x0;var _0x56a664=_0x9a8a[_0x5cadaa];return _0x56a664;};'use strict';var _=require('lodash');var util=require(_0xa9a8('0x0'));var moment=require(_0xa9a8('0x1'));var BPromise=require('bluebird');var rs=require(_0xa9a8('0x2'));var fs=require('fs');var Redis=require(_0xa9a8('0x3'));var db=require(_0xa9a8('0x4'))['db'];var utils=require(_0xa9a8('0x5'));var logger=require(_0xa9a8('0x6'))(_0xa9a8('0x7'));var config=require(_0xa9a8('0x8'));var jayson=require(_0xa9a8('0x9'));var client=jayson[_0xa9a8('0xa')]['http']({'port':0x232a});config[_0xa9a8('0xb')]=_['defaults'](config[_0xa9a8('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xa9a8('0xc'))(new Redis(config[_0xa9a8('0xb')]));require(_0xa9a8('0xd'))['register'](socket);function respondWithRpcPromise(_0x116dfc,_0x2dcf97,_0xc60741){return new BPromise(function(_0x31d20a,_0x4eb7c7){return client['request'](_0x116dfc,_0xc60741)[_0xa9a8('0xe')](function(_0xb37c63){logger[_0xa9a8('0xf')](_0xa9a8('0x10'),_0x2dcf97,_0xa9a8('0x11'));logger['debug'](_0xa9a8('0x12'),_0x2dcf97,_0xa9a8('0x11'),JSON['stringify'](_0xb37c63));if(_0xb37c63['error']){if(_0xb37c63[_0xa9a8('0x13')]['code']===0x1f4){logger[_0xa9a8('0x13')](_0xa9a8('0x10'),_0x2dcf97,_0xb37c63[_0xa9a8('0x13')][_0xa9a8('0x14')]);return _0x4eb7c7(_0xb37c63['error']['message']);}logger[_0xa9a8('0x13')](_0xa9a8('0x10'),_0x2dcf97,_0xb37c63['error'][_0xa9a8('0x14')]);return _0x31d20a(_0xb37c63[_0xa9a8('0x13')][_0xa9a8('0x14')]);}else{logger[_0xa9a8('0xf')](_0xa9a8('0x10'),_0x2dcf97,_0xa9a8('0x11'));_0x31d20a(_0xb37c63['result'][_0xa9a8('0x14')]);}})[_0xa9a8('0x15')](function(_0x2c54ea){logger['error'](_0xa9a8('0x10'),_0x2dcf97,_0x2c54ea);_0x4eb7c7(_0x2c54ea);});});}