Built motion from commit 25580385.|2.6.2
[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 _0xb936=['../../config/utils','rpc','../../config/environment','client','http','defaults','redis','localhost','./dashboard.socket','then','Dashboard,\x20%s,\x20%s','Dashboard,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0x261e29,_0x10fffd){var _0x25ef43=function(_0x21b8e7){while(--_0x21b8e7){_0x261e29['push'](_0x261e29['shift']());}};_0x25ef43(++_0x10fffd);}(_0xb936,0x10d));var _0x6b93=function(_0x1034e6,_0x43076a){_0x1034e6=_0x1034e6-0x0;var _0x343c70=_0xb936[_0x1034e6];return _0x343c70;};'use strict';var _=require(_0x6b93('0x0'));var util=require(_0x6b93('0x1'));var moment=require(_0x6b93('0x2'));var BPromise=require(_0x6b93('0x3'));var rs=require(_0x6b93('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6b93('0x5'))['db'];var utils=require(_0x6b93('0x6'));var logger=require('../../config/logger')(_0x6b93('0x7'));var config=require(_0x6b93('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x6b93('0x9')][_0x6b93('0xa')]({'port':0x232a});config['redis']=_[_0x6b93('0xb')](config[_0x6b93('0xc')],{'host':_0x6b93('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6b93('0xc')]));require(_0x6b93('0xe'))['register'](socket);function respondWithRpcPromise(_0x138cc0,_0x11a883,_0x40148d){return new BPromise(function(_0x3a9361,_0x2db34b){return client['request'](_0x138cc0,_0x40148d)[_0x6b93('0xf')](function(_0xd89b83){logger['info'](_0x6b93('0x10'),_0x11a883,'request\x20sent');logger['debug'](_0x6b93('0x11'),_0x11a883,_0x6b93('0x12'),JSON[_0x6b93('0x13')](_0xd89b83));if(_0xd89b83[_0x6b93('0x14')]){if(_0xd89b83['error'][_0x6b93('0x15')]===0x1f4){logger[_0x6b93('0x14')]('Dashboard,\x20%s,\x20%s',_0x11a883,_0xd89b83[_0x6b93('0x14')][_0x6b93('0x16')]);return _0x2db34b(_0xd89b83[_0x6b93('0x14')][_0x6b93('0x16')]);}logger[_0x6b93('0x14')](_0x6b93('0x10'),_0x11a883,_0xd89b83['error'][_0x6b93('0x16')]);return _0x3a9361(_0xd89b83['error'][_0x6b93('0x16')]);}else{logger[_0x6b93('0x17')](_0x6b93('0x10'),_0x11a883,_0x6b93('0x12'));_0x3a9361(_0xd89b83['result']['message']);}})[_0x6b93('0x18')](function(_0x328453){logger[_0x6b93('0x14')](_0x6b93('0x10'),_0x11a883,_0x328453);_0x2db34b(_0x328453);});});}