Built motion from commit 7158bc59.|2.5.42
[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 _0x9547=['./dashboard.socket','request','Dashboard,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','http','redis','defaults','localhost','socket.io-emitter'];(function(_0x85eeab,_0x367d2a){var _0x5b1338=function(_0x207d98){while(--_0x207d98){_0x85eeab['push'](_0x85eeab['shift']());}};_0x5b1338(++_0x367d2a);}(_0x9547,0xd9));var _0x7954=function(_0x35387d,_0x1ba72f){_0x35387d=_0x35387d-0x0;var _0x3aba56=_0x9547[_0x35387d];return _0x3aba56;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x7954('0x0'));var BPromise=require(_0x7954('0x1'));var rs=require(_0x7954('0x2'));var fs=require('fs');var Redis=require(_0x7954('0x3'));var db=require(_0x7954('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x7954('0x5'))(_0x7954('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7954('0x7')][_0x7954('0x8')]({'port':0x232a});config[_0x7954('0x9')]=_[_0x7954('0xa')](config[_0x7954('0x9')],{'host':_0x7954('0xb'),'port':0x18eb});var socket=require(_0x7954('0xc'))(new Redis(config[_0x7954('0x9')]));require(_0x7954('0xd'))['register'](socket);function respondWithRpcPromise(_0x112b14,_0x4febff,_0x26a18e){return new BPromise(function(_0x1279db,_0x5e3a09){return client[_0x7954('0xe')](_0x112b14,_0x26a18e)['then'](function(_0x3180d0){logger['info'](_0x7954('0xf'),_0x4febff,_0x7954('0x10'));logger['debug']('Dashboard,\x20%s,\x20%s,\x20%s',_0x4febff,_0x7954('0x10'),JSON[_0x7954('0x11')](_0x3180d0));if(_0x3180d0[_0x7954('0x12')]){if(_0x3180d0['error'][_0x7954('0x13')]===0x1f4){logger[_0x7954('0x12')](_0x7954('0xf'),_0x4febff,_0x3180d0['error'][_0x7954('0x14')]);return _0x5e3a09(_0x3180d0[_0x7954('0x12')][_0x7954('0x14')]);}logger[_0x7954('0x12')](_0x7954('0xf'),_0x4febff,_0x3180d0['error'][_0x7954('0x14')]);return _0x1279db(_0x3180d0[_0x7954('0x12')][_0x7954('0x14')]);}else{logger[_0x7954('0x15')](_0x7954('0xf'),_0x4febff,_0x7954('0x10'));_0x1279db(_0x3180d0['result'][_0x7954('0x14')]);}})[_0x7954('0x16')](function(_0x42a840){logger[_0x7954('0x12')]('Dashboard,\x20%s,\x20%s',_0x4febff,_0x42a840);_0x5e3a09(_0x42a840);});});}