Built motion from commit 87cd5f02.|2.5.48
[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 _0xdd77=['../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./dashboard.socket','request','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring'];(function(_0x430ed4,_0x1f1d65){var _0x48b24e=function(_0x177869){while(--_0x177869){_0x430ed4['push'](_0x430ed4['shift']());}};_0x48b24e(++_0x1f1d65);}(_0xdd77,0x15b));var _0x7dd7=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0xdd77[_0x29b609];return _0x54c952;};'use strict';var _=require(_0x7dd7('0x0'));var util=require(_0x7dd7('0x1'));var moment=require('moment');var BPromise=require(_0x7dd7('0x2'));var rs=require(_0x7dd7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7dd7('0x4'))['db'];var utils=require(_0x7dd7('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x7dd7('0x6'));var jayson=require(_0x7dd7('0x7'));var client=jayson[_0x7dd7('0x8')][_0x7dd7('0x9')]({'port':0x232a});config[_0x7dd7('0xa')]=_[_0x7dd7('0xb')](config[_0x7dd7('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x7dd7('0xc'))(new Redis(config['redis']));require(_0x7dd7('0xd'))['register'](socket);function respondWithRpcPromise(_0x247be7,_0x60d0f2,_0x1f732c){return new BPromise(function(_0x5b5ae5,_0x1ce419){return client[_0x7dd7('0xe')](_0x247be7,_0x1f732c)[_0x7dd7('0xf')](function(_0x54181c){logger[_0x7dd7('0x10')](_0x7dd7('0x11'),_0x60d0f2,_0x7dd7('0x12'));logger[_0x7dd7('0x13')](_0x7dd7('0x14'),_0x60d0f2,'request\x20sent',JSON[_0x7dd7('0x15')](_0x54181c));if(_0x54181c[_0x7dd7('0x16')]){if(_0x54181c[_0x7dd7('0x16')][_0x7dd7('0x17')]===0x1f4){logger[_0x7dd7('0x16')](_0x7dd7('0x11'),_0x60d0f2,_0x54181c[_0x7dd7('0x16')][_0x7dd7('0x18')]);return _0x1ce419(_0x54181c[_0x7dd7('0x16')][_0x7dd7('0x18')]);}logger[_0x7dd7('0x16')](_0x7dd7('0x11'),_0x60d0f2,_0x54181c[_0x7dd7('0x16')][_0x7dd7('0x18')]);return _0x5b5ae5(_0x54181c[_0x7dd7('0x16')]['message']);}else{logger[_0x7dd7('0x10')](_0x7dd7('0x11'),_0x60d0f2,_0x7dd7('0x12'));_0x5b5ae5(_0x54181c[_0x7dd7('0x19')]['message']);}})[_0x7dd7('0x1a')](function(_0x1e5c4a){logger[_0x7dd7('0x16')](_0x7dd7('0x11'),_0x60d0f2,_0x1e5c4a);_0x1ce419(_0x1e5c4a);});});}