Built motion from commit 42801a18.|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 _0x21a5=['result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','register','request','then','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','message','info'];(function(_0x533e4e,_0x4eba54){var _0x1f14bb=function(_0x33a485){while(--_0x33a485){_0x533e4e['push'](_0x533e4e['shift']());}};_0x1f14bb(++_0x4eba54);}(_0x21a5,0x12b));var _0x521a=function(_0x1fafa5,_0x1aa281){_0x1fafa5=_0x1fafa5-0x0;var _0xcf08c9=_0x21a5[_0x1fafa5];return _0xcf08c9;};'use strict';var _=require('lodash');var util=require(_0x521a('0x0'));var moment=require(_0x521a('0x1'));var BPromise=require('bluebird');var rs=require(_0x521a('0x2'));var fs=require('fs');var Redis=require(_0x521a('0x3'));var db=require(_0x521a('0x4'))['db'];var utils=require(_0x521a('0x5'));var logger=require(_0x521a('0x6'))(_0x521a('0x7'));var config=require('../../config/environment');var jayson=require(_0x521a('0x8'));var client=jayson['client'][_0x521a('0x9')]({'port':0x232a});config[_0x521a('0xa')]=_[_0x521a('0xb')](config[_0x521a('0xa')],{'host':_0x521a('0xc'),'port':0x18eb});var socket=require(_0x521a('0xd'))(new Redis(config['redis']));require('./dashboard.socket')[_0x521a('0xe')](socket);function respondWithRpcPromise(_0x5b75d4,_0x3e7ec6,_0x575ddd){return new BPromise(function(_0x4d5665,_0x3a19bb){return client[_0x521a('0xf')](_0x5b75d4,_0x575ddd)[_0x521a('0x10')](function(_0x52d0bc){logger['info'](_0x521a('0x11'),_0x3e7ec6,_0x521a('0x12'));logger[_0x521a('0x13')](_0x521a('0x14'),_0x3e7ec6,'request\x20sent',JSON[_0x521a('0x15')](_0x52d0bc));if(_0x52d0bc[_0x521a('0x16')]){if(_0x52d0bc['error']['code']===0x1f4){logger[_0x521a('0x16')](_0x521a('0x11'),_0x3e7ec6,_0x52d0bc[_0x521a('0x16')][_0x521a('0x17')]);return _0x3a19bb(_0x52d0bc[_0x521a('0x16')][_0x521a('0x17')]);}logger[_0x521a('0x16')]('Dashboard,\x20%s,\x20%s',_0x3e7ec6,_0x52d0bc[_0x521a('0x16')]['message']);return _0x4d5665(_0x52d0bc['error'][_0x521a('0x17')]);}else{logger[_0x521a('0x18')]('Dashboard,\x20%s,\x20%s',_0x3e7ec6,_0x521a('0x12'));_0x4d5665(_0x52d0bc[_0x521a('0x19')]['message']);}})[_0x521a('0x1a')](function(_0x309884){logger[_0x521a('0x16')](_0x521a('0x11'),_0x3e7ec6,_0x309884);_0x3a19bb(_0x309884);});});}