Built motion from commit bab6f49e.|2.6.17
[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 _0x2f6c=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','defaults','redis','localhost','register','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','moment','bluebird'];(function(_0x4d6ec9,_0x506fb3){var _0xd7b8fd=function(_0x450341){while(--_0x450341){_0x4d6ec9['push'](_0x4d6ec9['shift']());}};_0xd7b8fd(++_0x506fb3);}(_0x2f6c,0x6c));var _0xc2f6=function(_0xe1b5f6,_0x210c09){_0xe1b5f6=_0xe1b5f6-0x0;var _0x44636e=_0x2f6c[_0xe1b5f6];return _0x44636e;};'use strict';var _=require(_0xc2f6('0x0'));var util=require(_0xc2f6('0x1'));var moment=require(_0xc2f6('0x2'));var BPromise=require(_0xc2f6('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc2f6('0x4'))['db'];var utils=require(_0xc2f6('0x5'));var logger=require(_0xc2f6('0x6'))(_0xc2f6('0x7'));var config=require(_0xc2f6('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xc2f6('0x9')][_0xc2f6('0xa')]({'port':0x232a});config['redis']=_[_0xc2f6('0xb')](config[_0xc2f6('0xc')],{'host':_0xc2f6('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./dashboard.socket')[_0xc2f6('0xe')](socket);function respondWithRpcPromise(_0x4a8fe3,_0x40ba13,_0x16342b){return new BPromise(function(_0xc4bf4a,_0x50e30d){return client[_0xc2f6('0xf')](_0x4a8fe3,_0x16342b)[_0xc2f6('0x10')](function(_0x17e3a5){logger[_0xc2f6('0x11')](_0xc2f6('0x12'),_0x40ba13,_0xc2f6('0x13'));logger[_0xc2f6('0x14')](_0xc2f6('0x15'),_0x40ba13,'request\x20sent',JSON[_0xc2f6('0x16')](_0x17e3a5));if(_0x17e3a5[_0xc2f6('0x17')]){if(_0x17e3a5['error'][_0xc2f6('0x18')]===0x1f4){logger[_0xc2f6('0x17')]('Dashboard,\x20%s,\x20%s',_0x40ba13,_0x17e3a5[_0xc2f6('0x17')][_0xc2f6('0x19')]);return _0x50e30d(_0x17e3a5['error']['message']);}logger[_0xc2f6('0x17')]('Dashboard,\x20%s,\x20%s',_0x40ba13,_0x17e3a5['error'][_0xc2f6('0x19')]);return _0xc4bf4a(_0x17e3a5[_0xc2f6('0x17')][_0xc2f6('0x19')]);}else{logger[_0xc2f6('0x11')](_0xc2f6('0x12'),_0x40ba13,_0xc2f6('0x13'));_0xc4bf4a(_0x17e3a5[_0xc2f6('0x1a')][_0xc2f6('0x19')]);}})[_0xc2f6('0x1b')](function(_0x98a894){logger[_0xc2f6('0x17')](_0xc2f6('0x12'),_0x40ba13,_0x98a894);_0x50e30d(_0x98a894);});});}