Built motion from commit (unavailable).|2.3.4
[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 _0xf015=['defaults','localhost','socket.io-emitter','./dashboard.socket','request','then','info','request\x20sent','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','Dashboard,\x20%s,\x20%s','message','result','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis'];(function(_0x1021b2,_0x40fb44){var _0x3ca16c=function(_0xa16fad){while(--_0xa16fad){_0x1021b2['push'](_0x1021b2['shift']());}};_0x3ca16c(++_0x40fb44);}(_0xf015,0x1bf));var _0x5f01=function(_0x311869,_0x378ceb){_0x311869=_0x311869-0x0;var _0x4a2a67=_0xf015[_0x311869];return _0x4a2a67;};'use strict';var _=require(_0x5f01('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x5f01('0x1'));var rs=require(_0x5f01('0x2'));var fs=require('fs');var Redis=require(_0x5f01('0x3'));var db=require(_0x5f01('0x4'))['db'];var utils=require(_0x5f01('0x5'));var logger=require(_0x5f01('0x6'))(_0x5f01('0x7'));var config=require('../../config/environment');var jayson=require(_0x5f01('0x8'));var client=jayson[_0x5f01('0x9')][_0x5f01('0xa')]({'port':0x232a});config[_0x5f01('0xb')]=_[_0x5f01('0xc')](config[_0x5f01('0xb')],{'host':_0x5f01('0xd'),'port':0x18eb});var socket=require(_0x5f01('0xe'))(new Redis(config['redis']));require(_0x5f01('0xf'))['register'](socket);function respondWithRpcPromise(_0x1d6fcf,_0x249ada,_0x70478f){return new BPromise(function(_0x109945,_0x2b47d2){return client[_0x5f01('0x10')](_0x1d6fcf,_0x70478f)[_0x5f01('0x11')](function(_0x5f0688){logger[_0x5f01('0x12')]('Dashboard,\x20%s,\x20%s',_0x249ada,_0x5f01('0x13'));logger['debug'](_0x5f01('0x14'),_0x249ada,'request\x20sent',JSON[_0x5f01('0x15')](_0x5f0688));if(_0x5f0688[_0x5f01('0x16')]){if(_0x5f0688[_0x5f01('0x16')][_0x5f01('0x17')]===0x1f4){logger['error'](_0x5f01('0x18'),_0x249ada,_0x5f0688['error'][_0x5f01('0x19')]);return _0x2b47d2(_0x5f0688[_0x5f01('0x16')][_0x5f01('0x19')]);}logger[_0x5f01('0x16')](_0x5f01('0x18'),_0x249ada,_0x5f0688[_0x5f01('0x16')]['message']);return _0x109945(_0x5f0688[_0x5f01('0x16')][_0x5f01('0x19')]);}else{logger[_0x5f01('0x12')](_0x5f01('0x18'),_0x249ada,_0x5f01('0x13'));_0x109945(_0x5f0688[_0x5f01('0x1a')][_0x5f01('0x19')]);}})['catch'](function(_0x1b2266){logger[_0x5f01('0x16')]('Dashboard,\x20%s,\x20%s',_0x249ada,_0x1b2266);_0x2b47d2(_0x1b2266);});});}