Built motion from commit 3c2ce842.|2.6.31
[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 _0x2cbe=['redis','defaults','socket.io-emitter','./dashboard.socket','register','request','then','info','Dashboard,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','Dashboard,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','ioredis','../../config/logger','client','http'];(function(_0x7cb073,_0x3fcc51){var _0x428a5d=function(_0x6f5779){while(--_0x6f5779){_0x7cb073['push'](_0x7cb073['shift']());}};_0x428a5d(++_0x3fcc51);}(_0x2cbe,0xf5));var _0xe2cb=function(_0x1075b8,_0xd606e2){_0x1075b8=_0x1075b8-0x0;var _0x5d047f=_0x2cbe[_0x1075b8];return _0x5d047f;};'use strict';var _=require(_0xe2cb('0x0'));var util=require(_0xe2cb('0x1'));var moment=require(_0xe2cb('0x2'));var BPromise=require(_0xe2cb('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe2cb('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xe2cb('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xe2cb('0x6')][_0xe2cb('0x7')]({'port':0x232a});config[_0xe2cb('0x8')]=_[_0xe2cb('0x9')](config[_0xe2cb('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0xe2cb('0xa'))(new Redis(config[_0xe2cb('0x8')]));require(_0xe2cb('0xb'))[_0xe2cb('0xc')](socket);function respondWithRpcPromise(_0x30d116,_0x2829e5,_0x3ebd53){return new BPromise(function(_0x114989,_0x2877e3){return client[_0xe2cb('0xd')](_0x30d116,_0x3ebd53)[_0xe2cb('0xe')](function(_0x125897){logger[_0xe2cb('0xf')]('Dashboard,\x20%s,\x20%s',_0x2829e5,'request\x20sent');logger['debug'](_0xe2cb('0x10'),_0x2829e5,_0xe2cb('0x11'),JSON[_0xe2cb('0x12')](_0x125897));if(_0x125897[_0xe2cb('0x13')]){if(_0x125897[_0xe2cb('0x13')]['code']===0x1f4){logger[_0xe2cb('0x13')](_0xe2cb('0x14'),_0x2829e5,_0x125897[_0xe2cb('0x13')][_0xe2cb('0x15')]);return _0x2877e3(_0x125897[_0xe2cb('0x13')]['message']);}logger[_0xe2cb('0x13')]('Dashboard,\x20%s,\x20%s',_0x2829e5,_0x125897[_0xe2cb('0x13')][_0xe2cb('0x15')]);return _0x114989(_0x125897[_0xe2cb('0x13')]['message']);}else{logger['info'](_0xe2cb('0x14'),_0x2829e5,'request\x20sent');_0x114989(_0x125897['result'][_0xe2cb('0x15')]);}})[_0xe2cb('0x16')](function(_0x5c34a6){logger[_0xe2cb('0x13')](_0xe2cb('0x14'),_0x2829e5,_0x5c34a6);_0x2877e3(_0x5c34a6);});});}