Built motion from commit 936e8062.|2.5.33
[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 _0x1b6a=['redis','defaults','localhost','register','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','lodash','util','moment','bluebird','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x1b6a,0x186));var _0xa1b6=function(_0x3cfb23,_0x48307d){_0x3cfb23=_0x3cfb23-0x0;var _0x415b60=_0x1b6a[_0x3cfb23];return _0x415b60;};'use strict';var _=require(_0xa1b6('0x0'));var util=require(_0xa1b6('0x1'));var moment=require(_0xa1b6('0x2'));var BPromise=require(_0xa1b6('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xa1b6('0x4'))('rpc');var config=require(_0xa1b6('0x5'));var jayson=require(_0xa1b6('0x6'));var client=jayson[_0xa1b6('0x7')][_0xa1b6('0x8')]({'port':0x232a});config[_0xa1b6('0x9')]=_[_0xa1b6('0xa')](config['redis'],{'host':_0xa1b6('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./dashboard.socket')[_0xa1b6('0xc')](socket);function respondWithRpcPromise(_0x1a13ec,_0xbc7b59,_0x1a18fb){return new BPromise(function(_0x58c8d5,_0x2aecef){return client['request'](_0x1a13ec,_0x1a18fb)['then'](function(_0x55e81e){logger[_0xa1b6('0xd')](_0xa1b6('0xe'),_0xbc7b59,_0xa1b6('0xf'));logger[_0xa1b6('0x10')]('Dashboard,\x20%s,\x20%s,\x20%s',_0xbc7b59,_0xa1b6('0xf'),JSON['stringify'](_0x55e81e));if(_0x55e81e[_0xa1b6('0x11')]){if(_0x55e81e[_0xa1b6('0x11')]['code']===0x1f4){logger['error'](_0xa1b6('0xe'),_0xbc7b59,_0x55e81e[_0xa1b6('0x11')][_0xa1b6('0x12')]);return _0x2aecef(_0x55e81e[_0xa1b6('0x11')][_0xa1b6('0x12')]);}logger['error'](_0xa1b6('0xe'),_0xbc7b59,_0x55e81e['error'][_0xa1b6('0x12')]);return _0x58c8d5(_0x55e81e[_0xa1b6('0x11')][_0xa1b6('0x12')]);}else{logger[_0xa1b6('0xd')](_0xa1b6('0xe'),_0xbc7b59,_0xa1b6('0xf'));_0x58c8d5(_0x55e81e[_0xa1b6('0x13')]['message']);}})[_0xa1b6('0x14')](function(_0x51bf80){logger['error'](_0xa1b6('0xe'),_0xbc7b59,_0x51bf80);_0x2aecef(_0x51bf80);});});}