Built motion from commit a8c4dd89.|2.6.33
[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 _0x8b6d=['jayson/promise','client','http','defaults','localhost','socket.io-emitter','redis','./dashboard.socket','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Dashboard,\x20%s,\x20%s','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x8b6d,0x124));var _0xd8b6=function(_0x453baa,_0x46c17a){_0x453baa=_0x453baa-0x0;var _0x39825=_0x8b6d[_0x453baa];return _0x39825;};'use strict';var _=require(_0xd8b6('0x0'));var util=require('util');var moment=require(_0xd8b6('0x1'));var BPromise=require(_0xd8b6('0x2'));var rs=require(_0xd8b6('0x3'));var fs=require('fs');var Redis=require(_0xd8b6('0x4'));var db=require(_0xd8b6('0x5'))['db'];var utils=require(_0xd8b6('0x6'));var logger=require('../../config/logger')(_0xd8b6('0x7'));var config=require('../../config/environment');var jayson=require(_0xd8b6('0x8'));var client=jayson[_0xd8b6('0x9')][_0xd8b6('0xa')]({'port':0x232a});config['redis']=_[_0xd8b6('0xb')](config['redis'],{'host':_0xd8b6('0xc'),'port':0x18eb});var socket=require(_0xd8b6('0xd'))(new Redis(config[_0xd8b6('0xe')]));require(_0xd8b6('0xf'))['register'](socket);function respondWithRpcPromise(_0x104137,_0x5502b4,_0x1eeb9b){return new BPromise(function(_0x3ed5fc,_0x502676){return client['request'](_0x104137,_0x1eeb9b)['then'](function(_0x52f0b8){logger['info']('Dashboard,\x20%s,\x20%s',_0x5502b4,_0xd8b6('0x10'));logger[_0xd8b6('0x11')](_0xd8b6('0x12'),_0x5502b4,_0xd8b6('0x10'),JSON[_0xd8b6('0x13')](_0x52f0b8));if(_0x52f0b8[_0xd8b6('0x14')]){if(_0x52f0b8[_0xd8b6('0x14')][_0xd8b6('0x15')]===0x1f4){logger[_0xd8b6('0x14')]('Dashboard,\x20%s,\x20%s',_0x5502b4,_0x52f0b8[_0xd8b6('0x14')][_0xd8b6('0x16')]);return _0x502676(_0x52f0b8[_0xd8b6('0x14')][_0xd8b6('0x16')]);}logger[_0xd8b6('0x14')](_0xd8b6('0x17'),_0x5502b4,_0x52f0b8[_0xd8b6('0x14')][_0xd8b6('0x16')]);return _0x3ed5fc(_0x52f0b8[_0xd8b6('0x14')][_0xd8b6('0x16')]);}else{logger['info'](_0xd8b6('0x17'),_0x5502b4,_0xd8b6('0x10'));_0x3ed5fc(_0x52f0b8[_0xd8b6('0x18')]['message']);}})['catch'](function(_0x382ac5){logger[_0xd8b6('0x14')]('Dashboard,\x20%s,\x20%s',_0x5502b4,_0x382ac5);_0x502676(_0x382ac5);});});}