Built motion from commit c738b9ac.|2.6.25
[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 _0xe3a2=['code','message','result','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','request','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','error'];(function(_0x1777c1,_0x4a40fe){var _0x2eb089=function(_0x5d9162){while(--_0x5d9162){_0x1777c1['push'](_0x1777c1['shift']());}};_0x2eb089(++_0x4a40fe);}(_0xe3a2,0x1de));var _0x2e3a=function(_0x2a2591,_0x958577){_0x2a2591=_0x2a2591-0x0;var _0x45bde5=_0xe3a2[_0x2a2591];return _0x45bde5;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x2e3a('0x0'));var BPromise=require(_0x2e3a('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2e3a('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x2e3a('0x3'))(_0x2e3a('0x4'));var config=require(_0x2e3a('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x2e3a('0x6')][_0x2e3a('0x7')]({'port':0x232a});config[_0x2e3a('0x8')]=_[_0x2e3a('0x9')](config[_0x2e3a('0x8')],{'host':_0x2e3a('0xa'),'port':0x18eb});var socket=require(_0x2e3a('0xb'))(new Redis(config[_0x2e3a('0x8')]));require(_0x2e3a('0xc'))[_0x2e3a('0xd')](socket);function respondWithRpcPromise(_0x3ff573,_0x93bb42,_0x53f821){return new BPromise(function(_0x46b9d7,_0xa2bfa0){return client[_0x2e3a('0xe')](_0x3ff573,_0x53f821)[_0x2e3a('0xf')](function(_0x4fae2c){logger[_0x2e3a('0x10')](_0x2e3a('0x11'),_0x93bb42,_0x2e3a('0x12'));logger[_0x2e3a('0x13')](_0x2e3a('0x14'),_0x93bb42,_0x2e3a('0x12'),JSON['stringify'](_0x4fae2c));if(_0x4fae2c[_0x2e3a('0x15')]){if(_0x4fae2c[_0x2e3a('0x15')][_0x2e3a('0x16')]===0x1f4){logger['error'](_0x2e3a('0x11'),_0x93bb42,_0x4fae2c[_0x2e3a('0x15')][_0x2e3a('0x17')]);return _0xa2bfa0(_0x4fae2c[_0x2e3a('0x15')][_0x2e3a('0x17')]);}logger[_0x2e3a('0x15')]('Dashboard,\x20%s,\x20%s',_0x93bb42,_0x4fae2c[_0x2e3a('0x15')]['message']);return _0x46b9d7(_0x4fae2c['error']['message']);}else{logger[_0x2e3a('0x10')]('Dashboard,\x20%s,\x20%s',_0x93bb42,'request\x20sent');_0x46b9d7(_0x4fae2c[_0x2e3a('0x18')]['message']);}})['catch'](function(_0xd1a57a){logger[_0x2e3a('0x15')](_0x2e3a('0x11'),_0x93bb42,_0xd1a57a);_0xa2bfa0(_0xd1a57a);});});}