Built motion from commit eddce310.|2.6.12
[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 _0xcd18=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','http','defaults','redis','./dashboard.socket','register','request','then','request\x20sent','debug','stringify','error','Dashboard,\x20%s,\x20%s','message','info','catch','lodash','util','bluebird'];(function(_0xb24170,_0x544806){var _0x42679a=function(_0x50a95b){while(--_0x50a95b){_0xb24170['push'](_0xb24170['shift']());}};_0x42679a(++_0x544806);}(_0xcd18,0x195));var _0x8cd1=function(_0x5aeda7,_0x74556a){_0x5aeda7=_0x5aeda7-0x0;var _0x122f8a=_0xcd18[_0x5aeda7];return _0x122f8a;};'use strict';var _=require(_0x8cd1('0x0'));var util=require(_0x8cd1('0x1'));var moment=require('moment');var BPromise=require(_0x8cd1('0x2'));var rs=require(_0x8cd1('0x3'));var fs=require('fs');var Redis=require(_0x8cd1('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x8cd1('0x5'));var logger=require(_0x8cd1('0x6'))(_0x8cd1('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x8cd1('0x8')][_0x8cd1('0x9')]({'port':0x232a});config['redis']=_[_0x8cd1('0xa')](config[_0x8cd1('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8cd1('0xb')]));require(_0x8cd1('0xc'))[_0x8cd1('0xd')](socket);function respondWithRpcPromise(_0x53aaa9,_0x9e8ed9,_0x3211d0){return new BPromise(function(_0x4b65ed,_0xfa96){return client[_0x8cd1('0xe')](_0x53aaa9,_0x3211d0)[_0x8cd1('0xf')](function(_0x594157){logger['info']('Dashboard,\x20%s,\x20%s',_0x9e8ed9,_0x8cd1('0x10'));logger[_0x8cd1('0x11')]('Dashboard,\x20%s,\x20%s,\x20%s',_0x9e8ed9,_0x8cd1('0x10'),JSON[_0x8cd1('0x12')](_0x594157));if(_0x594157['error']){if(_0x594157[_0x8cd1('0x13')]['code']===0x1f4){logger[_0x8cd1('0x13')](_0x8cd1('0x14'),_0x9e8ed9,_0x594157[_0x8cd1('0x13')]['message']);return _0xfa96(_0x594157['error'][_0x8cd1('0x15')]);}logger[_0x8cd1('0x13')](_0x8cd1('0x14'),_0x9e8ed9,_0x594157[_0x8cd1('0x13')][_0x8cd1('0x15')]);return _0x4b65ed(_0x594157['error'][_0x8cd1('0x15')]);}else{logger[_0x8cd1('0x16')](_0x8cd1('0x14'),_0x9e8ed9,'request\x20sent');_0x4b65ed(_0x594157['result'][_0x8cd1('0x15')]);}})[_0x8cd1('0x17')](function(_0x3ebf22){logger[_0x8cd1('0x13')]('Dashboard,\x20%s,\x20%s',_0x9e8ed9,_0x3ebf22);_0xfa96(_0x3ebf22);});});}