Built motion from commit b0a9a629.|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 _0x85a9=['message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','request','info','Dashboard,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x9eab92,_0xe7e818){var _0x20dd9e=function(_0x2e4f03){while(--_0x2e4f03){_0x9eab92['push'](_0x9eab92['shift']());}};_0x20dd9e(++_0xe7e818);}(_0x85a9,0x107));var _0x985a=function(_0x4664db,_0x1de672){_0x4664db=_0x4664db-0x0;var _0x5615b4=_0x85a9[_0x4664db];return _0x5615b4;};'use strict';var _=require(_0x985a('0x0'));var util=require('util');var moment=require(_0x985a('0x1'));var BPromise=require(_0x985a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x985a('0x3'));var db=require(_0x985a('0x4'))['db'];var utils=require(_0x985a('0x5'));var logger=require(_0x985a('0x6'))('rpc');var config=require(_0x985a('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x985a('0x8')][_0x985a('0x9')]({'port':0x232a});config[_0x985a('0xa')]=_[_0x985a('0xb')](config['redis'],{'host':_0x985a('0xc'),'port':0x18eb});var socket=require(_0x985a('0xd'))(new Redis(config['redis']));require(_0x985a('0xe'))[_0x985a('0xf')](socket);function respondWithRpcPromise(_0x53bfd9,_0xedf266,_0x49d5a1){return new BPromise(function(_0x21247d,_0x499cc9){return client[_0x985a('0x10')](_0x53bfd9,_0x49d5a1)['then'](function(_0x427e60){logger[_0x985a('0x11')](_0x985a('0x12'),_0xedf266,'request\x20sent');logger['debug']('Dashboard,\x20%s,\x20%s,\x20%s',_0xedf266,_0x985a('0x13'),JSON[_0x985a('0x14')](_0x427e60));if(_0x427e60[_0x985a('0x15')]){if(_0x427e60[_0x985a('0x15')][_0x985a('0x16')]===0x1f4){logger['error']('Dashboard,\x20%s,\x20%s',_0xedf266,_0x427e60[_0x985a('0x15')][_0x985a('0x17')]);return _0x499cc9(_0x427e60['error']['message']);}logger['error'](_0x985a('0x12'),_0xedf266,_0x427e60[_0x985a('0x15')][_0x985a('0x17')]);return _0x21247d(_0x427e60[_0x985a('0x15')]['message']);}else{logger[_0x985a('0x11')](_0x985a('0x12'),_0xedf266,_0x985a('0x13'));_0x21247d(_0x427e60[_0x985a('0x18')][_0x985a('0x17')]);}})[_0x985a('0x19')](function(_0x392a01){logger[_0x985a('0x15')](_0x985a('0x12'),_0xedf266,_0x392a01);_0x499cc9(_0x392a01);});});}