Built motion from commit da617fac.|2.6.6
[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 _0x622f=['redis','localhost','socket.io-emitter','./dashboard.socket','register','request','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x1a21ff,_0x4a7550){var _0x25afc1=function(_0x4a66ec){while(--_0x4a66ec){_0x1a21ff['push'](_0x1a21ff['shift']());}};_0x25afc1(++_0x4a7550);}(_0x622f,0xe9));var _0xf622=function(_0x5db810,_0x140222){_0x5db810=_0x5db810-0x0;var _0x14a975=_0x622f[_0x5db810];return _0x14a975;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf622('0x0'));var BPromise=require(_0xf622('0x1'));var rs=require(_0xf622('0x2'));var fs=require('fs');var Redis=require(_0xf622('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xf622('0x4'))(_0xf622('0x5'));var config=require(_0xf622('0x6'));var jayson=require(_0xf622('0x7'));var client=jayson[_0xf622('0x8')][_0xf622('0x9')]({'port':0x232a});config[_0xf622('0xa')]=_['defaults'](config['redis'],{'host':_0xf622('0xb'),'port':0x18eb});var socket=require(_0xf622('0xc'))(new Redis(config[_0xf622('0xa')]));require(_0xf622('0xd'))[_0xf622('0xe')](socket);function respondWithRpcPromise(_0x286aef,_0x2ee4ff,_0x1ede4a){return new BPromise(function(_0x3cee86,_0x111f8a){return client[_0xf622('0xf')](_0x286aef,_0x1ede4a)[_0xf622('0x10')](function(_0x2feaab){logger[_0xf622('0x11')](_0xf622('0x12'),_0x2ee4ff,_0xf622('0x13'));logger[_0xf622('0x14')](_0xf622('0x15'),_0x2ee4ff,_0xf622('0x13'),JSON[_0xf622('0x16')](_0x2feaab));if(_0x2feaab['error']){if(_0x2feaab['error'][_0xf622('0x17')]===0x1f4){logger[_0xf622('0x18')](_0xf622('0x12'),_0x2ee4ff,_0x2feaab[_0xf622('0x18')][_0xf622('0x19')]);return _0x111f8a(_0x2feaab[_0xf622('0x18')]['message']);}logger[_0xf622('0x18')](_0xf622('0x12'),_0x2ee4ff,_0x2feaab[_0xf622('0x18')][_0xf622('0x19')]);return _0x3cee86(_0x2feaab[_0xf622('0x18')][_0xf622('0x19')]);}else{logger[_0xf622('0x11')](_0xf622('0x12'),_0x2ee4ff,'request\x20sent');_0x3cee86(_0x2feaab[_0xf622('0x1a')]['message']);}})['catch'](function(_0x20add4){logger['error'](_0xf622('0x12'),_0x2ee4ff,_0x20add4);_0x111f8a(_0x20add4);});});}