Built motion from commit ae138b72.|2.6.28
[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 _0xb9d3=['randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','request','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','moment','bluebird'];(function(_0x5a5762,_0x41ce84){var _0x1fa9a1=function(_0x4a0b05){while(--_0x4a0b05){_0x5a5762['push'](_0x5a5762['shift']());}};_0x1fa9a1(++_0x41ce84);}(_0xb9d3,0x15c));var _0x3b9d=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0xb9d3[_0x27af45];return _0x18df21;};'use strict';var _=require(_0x3b9d('0x0'));var util=require('util');var moment=require(_0x3b9d('0x1'));var BPromise=require(_0x3b9d('0x2'));var rs=require(_0x3b9d('0x3'));var fs=require('fs');var Redis=require(_0x3b9d('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3b9d('0x5'));var logger=require(_0x3b9d('0x6'))('rpc');var config=require(_0x3b9d('0x7'));var jayson=require(_0x3b9d('0x8'));var client=jayson[_0x3b9d('0x9')][_0x3b9d('0xa')]({'port':0x232a});config[_0x3b9d('0xb')]=_[_0x3b9d('0xc')](config[_0x3b9d('0xb')],{'host':_0x3b9d('0xd'),'port':0x18eb});var socket=require(_0x3b9d('0xe'))(new Redis(config[_0x3b9d('0xb')]));require('./dashboard.socket')['register'](socket);function respondWithRpcPromise(_0x36e08b,_0xb89a7d,_0x5046d5){return new BPromise(function(_0x31e06e,_0x171a8e){return client[_0x3b9d('0xf')](_0x36e08b,_0x5046d5)[_0x3b9d('0x10')](function(_0x19856a){logger[_0x3b9d('0x11')](_0x3b9d('0x12'),_0xb89a7d,_0x3b9d('0x13'));logger[_0x3b9d('0x14')](_0x3b9d('0x15'),_0xb89a7d,_0x3b9d('0x13'),JSON['stringify'](_0x19856a));if(_0x19856a[_0x3b9d('0x16')]){if(_0x19856a[_0x3b9d('0x16')][_0x3b9d('0x17')]===0x1f4){logger[_0x3b9d('0x16')](_0x3b9d('0x12'),_0xb89a7d,_0x19856a[_0x3b9d('0x16')][_0x3b9d('0x18')]);return _0x171a8e(_0x19856a[_0x3b9d('0x16')]['message']);}logger[_0x3b9d('0x16')](_0x3b9d('0x12'),_0xb89a7d,_0x19856a[_0x3b9d('0x16')][_0x3b9d('0x18')]);return _0x31e06e(_0x19856a['error']['message']);}else{logger['info'](_0x3b9d('0x12'),_0xb89a7d,_0x3b9d('0x13'));_0x31e06e(_0x19856a[_0x3b9d('0x19')][_0x3b9d('0x18')]);}})[_0x3b9d('0x1a')](function(_0x441bc2){logger[_0x3b9d('0x16')]('Dashboard,\x20%s,\x20%s',_0xb89a7d,_0x441bc2);_0x171a8e(_0x441bc2);});});}