Built motion from commit 9e1399f3.|2.5.37
[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 _0xc818=['stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','defaults','socket.io-emitter','./dashboard.socket','register','request','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','Dashboard,\x20%s,\x20%s,\x20%s'];(function(_0x5826ef,_0x23018f){var _0x5af785=function(_0x40c321){while(--_0x40c321){_0x5826ef['push'](_0x5826ef['shift']());}};_0x5af785(++_0x23018f);}(_0xc818,0xe6));var _0x8c81=function(_0x51d09c,_0x3b2caf){_0x51d09c=_0x51d09c-0x0;var _0x18bb06=_0xc818[_0x51d09c];return _0x18bb06;};'use strict';var _=require(_0x8c81('0x0'));var util=require(_0x8c81('0x1'));var moment=require(_0x8c81('0x2'));var BPromise=require(_0x8c81('0x3'));var rs=require(_0x8c81('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8c81('0x5'))['db'];var utils=require(_0x8c81('0x6'));var logger=require(_0x8c81('0x7'))(_0x8c81('0x8'));var config=require(_0x8c81('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8c81('0xa')]({'port':0x232a});config[_0x8c81('0xb')]=_[_0x8c81('0xc')](config[_0x8c81('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x8c81('0xd'))(new Redis(config['redis']));require(_0x8c81('0xe'))[_0x8c81('0xf')](socket);function respondWithRpcPromise(_0x7bdab5,_0x2fd0a3,_0xef8209){return new BPromise(function(_0x5b31b3,_0x131968){return client[_0x8c81('0x10')](_0x7bdab5,_0xef8209)[_0x8c81('0x11')](function(_0x3aff47){logger[_0x8c81('0x12')](_0x8c81('0x13'),_0x2fd0a3,_0x8c81('0x14'));logger['debug'](_0x8c81('0x15'),_0x2fd0a3,_0x8c81('0x14'),JSON[_0x8c81('0x16')](_0x3aff47));if(_0x3aff47[_0x8c81('0x17')]){if(_0x3aff47[_0x8c81('0x17')][_0x8c81('0x18')]===0x1f4){logger['error'](_0x8c81('0x13'),_0x2fd0a3,_0x3aff47[_0x8c81('0x17')][_0x8c81('0x19')]);return _0x131968(_0x3aff47[_0x8c81('0x17')][_0x8c81('0x19')]);}logger['error'](_0x8c81('0x13'),_0x2fd0a3,_0x3aff47[_0x8c81('0x17')]['message']);return _0x5b31b3(_0x3aff47[_0x8c81('0x17')][_0x8c81('0x19')]);}else{logger['info'](_0x8c81('0x13'),_0x2fd0a3,_0x8c81('0x14'));_0x5b31b3(_0x3aff47[_0x8c81('0x1a')][_0x8c81('0x19')]);}})[_0x8c81('0x1b')](function(_0x2cd89a){logger['error'](_0x8c81('0x13'),_0x2fd0a3,_0x2cd89a);_0x131968(_0x2cd89a);});});}