Built motion from commit (unavailable).|2.5.22
[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 _0x5e66=['../../config/logger','jayson/promise','client','redis','localhost','socket.io-emitter','register','request','then','Dashboard,\x20%s,\x20%s','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0xa614e8,_0xba1dad){var _0xf9873b=function(_0xfc27ae){while(--_0xfc27ae){_0xa614e8['push'](_0xa614e8['shift']());}};_0xf9873b(++_0xba1dad);}(_0x5e66,0x158));var _0x65e6=function(_0x22d5d7,_0x466750){_0x22d5d7=_0x22d5d7-0x0;var _0x5c6b99=_0x5e66[_0x22d5d7];return _0x5c6b99;};'use strict';var _=require(_0x65e6('0x0'));var util=require(_0x65e6('0x1'));var moment=require('moment');var BPromise=require(_0x65e6('0x2'));var rs=require(_0x65e6('0x3'));var fs=require('fs');var Redis=require(_0x65e6('0x4'));var db=require(_0x65e6('0x5'))['db'];var utils=require(_0x65e6('0x6'));var logger=require(_0x65e6('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x65e6('0x8'));var client=jayson[_0x65e6('0x9')]['http']({'port':0x232a});config[_0x65e6('0xa')]=_['defaults'](config[_0x65e6('0xa')],{'host':_0x65e6('0xb'),'port':0x18eb});var socket=require(_0x65e6('0xc'))(new Redis(config['redis']));require('./dashboard.socket')[_0x65e6('0xd')](socket);function respondWithRpcPromise(_0x74cd87,_0x1d4f6c,_0x45cefc){return new BPromise(function(_0xb0fec5,_0x21a031){return client[_0x65e6('0xe')](_0x74cd87,_0x45cefc)[_0x65e6('0xf')](function(_0x56c9b7){logger['info'](_0x65e6('0x10'),_0x1d4f6c,'request\x20sent');logger[_0x65e6('0x11')](_0x65e6('0x12'),_0x1d4f6c,'request\x20sent',JSON[_0x65e6('0x13')](_0x56c9b7));if(_0x56c9b7[_0x65e6('0x14')]){if(_0x56c9b7[_0x65e6('0x14')][_0x65e6('0x15')]===0x1f4){logger['error'](_0x65e6('0x10'),_0x1d4f6c,_0x56c9b7[_0x65e6('0x14')][_0x65e6('0x16')]);return _0x21a031(_0x56c9b7[_0x65e6('0x14')]['message']);}logger[_0x65e6('0x14')](_0x65e6('0x10'),_0x1d4f6c,_0x56c9b7[_0x65e6('0x14')][_0x65e6('0x16')]);return _0xb0fec5(_0x56c9b7[_0x65e6('0x14')][_0x65e6('0x16')]);}else{logger[_0x65e6('0x17')]('Dashboard,\x20%s,\x20%s',_0x1d4f6c,_0x65e6('0x18'));_0xb0fec5(_0x56c9b7[_0x65e6('0x19')]['message']);}})[_0x65e6('0x1a')](function(_0xa05631){logger[_0x65e6('0x14')]('Dashboard,\x20%s,\x20%s',_0x1d4f6c,_0xa05631);_0x21a031(_0xa05631);});});}