Built motion from commit 58b0471d.|2.6.29
[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 _0x0911=['message','info','result','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','request','Dashboard,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x4c7fb5,_0x2548ef){var _0x2e10ac=function(_0xf7e27c){while(--_0xf7e27c){_0x4c7fb5['push'](_0x4c7fb5['shift']());}};_0x2e10ac(++_0x2548ef);}(_0x0911,0xe4));var _0x1091=function(_0xffa198,_0x5a8940){_0xffa198=_0xffa198-0x0;var _0x1e4b50=_0x0911[_0xffa198];return _0x1e4b50;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1091('0x0'));var BPromise=require(_0x1091('0x1'));var rs=require(_0x1091('0x2'));var fs=require('fs');var Redis=require(_0x1091('0x3'));var db=require(_0x1091('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x1091('0x5'));var config=require(_0x1091('0x6'));var jayson=require(_0x1091('0x7'));var client=jayson['client'][_0x1091('0x8')]({'port':0x232a});config[_0x1091('0x9')]=_[_0x1091('0xa')](config['redis'],{'host':_0x1091('0xb'),'port':0x18eb});var socket=require(_0x1091('0xc'))(new Redis(config[_0x1091('0x9')]));require(_0x1091('0xd'))[_0x1091('0xe')](socket);function respondWithRpcPromise(_0x1f6964,_0x4d2e29,_0x40faa4){return new BPromise(function(_0x2fecd2,_0x7b8907){return client[_0x1091('0xf')](_0x1f6964,_0x40faa4)['then'](function(_0x9a764c){logger['info'](_0x1091('0x10'),_0x4d2e29,_0x1091('0x11'));logger[_0x1091('0x12')]('Dashboard,\x20%s,\x20%s,\x20%s',_0x4d2e29,_0x1091('0x11'),JSON[_0x1091('0x13')](_0x9a764c));if(_0x9a764c['error']){if(_0x9a764c[_0x1091('0x14')][_0x1091('0x15')]===0x1f4){logger[_0x1091('0x14')](_0x1091('0x10'),_0x4d2e29,_0x9a764c[_0x1091('0x14')][_0x1091('0x16')]);return _0x7b8907(_0x9a764c[_0x1091('0x14')]['message']);}logger[_0x1091('0x14')](_0x1091('0x10'),_0x4d2e29,_0x9a764c[_0x1091('0x14')][_0x1091('0x16')]);return _0x2fecd2(_0x9a764c[_0x1091('0x14')][_0x1091('0x16')]);}else{logger[_0x1091('0x17')](_0x1091('0x10'),_0x4d2e29,'request\x20sent');_0x2fecd2(_0x9a764c[_0x1091('0x18')][_0x1091('0x16')]);}})['catch'](function(_0x593549){logger[_0x1091('0x14')](_0x1091('0x10'),_0x4d2e29,_0x593549);_0x7b8907(_0x593549);});});}