Built motion from commit 0900f080.|2.5.45
[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 _0xa2c0=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','request','info','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Dashboard,\x20%s,\x20%s','result','catch','util','moment','bluebird'];(function(_0x51bf0f,_0x3b3cfb){var _0x5c8633=function(_0x13ae1a){while(--_0x13ae1a){_0x51bf0f['push'](_0x51bf0f['shift']());}};_0x5c8633(++_0x3b3cfb);}(_0xa2c0,0x1ea));var _0x0a2c=function(_0x28168c,_0x54ef13){_0x28168c=_0x28168c-0x0;var _0x5a2062=_0xa2c0[_0x28168c];return _0x5a2062;};'use strict';var _=require('lodash');var util=require(_0x0a2c('0x0'));var moment=require(_0x0a2c('0x1'));var BPromise=require(_0x0a2c('0x2'));var rs=require(_0x0a2c('0x3'));var fs=require('fs');var Redis=require(_0x0a2c('0x4'));var db=require(_0x0a2c('0x5'))['db'];var utils=require(_0x0a2c('0x6'));var logger=require('../../config/logger')(_0x0a2c('0x7'));var config=require(_0x0a2c('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0a2c('0x9')][_0x0a2c('0xa')]({'port':0x232a});config[_0x0a2c('0xb')]=_[_0x0a2c('0xc')](config['redis'],{'host':_0x0a2c('0xd'),'port':0x18eb});var socket=require(_0x0a2c('0xe'))(new Redis(config[_0x0a2c('0xb')]));require(_0x0a2c('0xf'))[_0x0a2c('0x10')](socket);function respondWithRpcPromise(_0x5d3de4,_0x174752,_0x3ec160){return new BPromise(function(_0x2f79ad,_0x25620f){return client[_0x0a2c('0x11')](_0x5d3de4,_0x3ec160)['then'](function(_0x453594){logger[_0x0a2c('0x12')]('Dashboard,\x20%s,\x20%s',_0x174752,_0x0a2c('0x13'));logger[_0x0a2c('0x14')](_0x0a2c('0x15'),_0x174752,'request\x20sent',JSON[_0x0a2c('0x16')](_0x453594));if(_0x453594[_0x0a2c('0x17')]){if(_0x453594[_0x0a2c('0x17')][_0x0a2c('0x18')]===0x1f4){logger[_0x0a2c('0x17')]('Dashboard,\x20%s,\x20%s',_0x174752,_0x453594['error'][_0x0a2c('0x19')]);return _0x25620f(_0x453594['error'][_0x0a2c('0x19')]);}logger[_0x0a2c('0x17')](_0x0a2c('0x1a'),_0x174752,_0x453594[_0x0a2c('0x17')][_0x0a2c('0x19')]);return _0x2f79ad(_0x453594['error'][_0x0a2c('0x19')]);}else{logger[_0x0a2c('0x12')]('Dashboard,\x20%s,\x20%s',_0x174752,_0x0a2c('0x13'));_0x2f79ad(_0x453594[_0x0a2c('0x1b')][_0x0a2c('0x19')]);}})[_0x0a2c('0x1c')](function(_0x2d8910){logger['error']('Dashboard,\x20%s,\x20%s',_0x174752,_0x2d8910);_0x25620f(_0x2d8910);});});}