Built motion from commit a61a4a20.|2.5.46
[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 _0x95c1=['debug','Dashboard,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','request','then','info','Dashboard,\x20%s,\x20%s'];(function(_0x25e75c,_0x186b0a){var _0x157314=function(_0x153f9c){while(--_0x153f9c){_0x25e75c['push'](_0x25e75c['shift']());}};_0x157314(++_0x186b0a);}(_0x95c1,0xfb));var _0x195c=function(_0x7e2eb0,_0x17cd58){_0x7e2eb0=_0x7e2eb0-0x0;var _0xd92de4=_0x95c1[_0x7e2eb0];return _0xd92de4;};'use strict';var _=require('lodash');var util=require(_0x195c('0x0'));var moment=require(_0x195c('0x1'));var BPromise=require(_0x195c('0x2'));var rs=require(_0x195c('0x3'));var fs=require('fs');var Redis=require(_0x195c('0x4'));var db=require(_0x195c('0x5'))['db'];var utils=require(_0x195c('0x6'));var logger=require(_0x195c('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x195c('0x8'));var client=jayson[_0x195c('0x9')][_0x195c('0xa')]({'port':0x232a});config['redis']=_[_0x195c('0xb')](config[_0x195c('0xc')],{'host':_0x195c('0xd'),'port':0x18eb});var socket=require(_0x195c('0xe'))(new Redis(config[_0x195c('0xc')]));require('./dashboard.socket')['register'](socket);function respondWithRpcPromise(_0x113296,_0x287ef2,_0x22159e){return new BPromise(function(_0x405174,_0x504a2c){return client[_0x195c('0xf')](_0x113296,_0x22159e)[_0x195c('0x10')](function(_0x2116c7){logger[_0x195c('0x11')](_0x195c('0x12'),_0x287ef2,'request\x20sent');logger[_0x195c('0x13')](_0x195c('0x14'),_0x287ef2,_0x195c('0x15'),JSON[_0x195c('0x16')](_0x2116c7));if(_0x2116c7[_0x195c('0x17')]){if(_0x2116c7['error']['code']===0x1f4){logger[_0x195c('0x17')](_0x195c('0x12'),_0x287ef2,_0x2116c7[_0x195c('0x17')][_0x195c('0x18')]);return _0x504a2c(_0x2116c7[_0x195c('0x17')][_0x195c('0x18')]);}logger[_0x195c('0x17')](_0x195c('0x12'),_0x287ef2,_0x2116c7[_0x195c('0x17')]['message']);return _0x405174(_0x2116c7['error'][_0x195c('0x18')]);}else{logger[_0x195c('0x11')]('Dashboard,\x20%s,\x20%s',_0x287ef2,_0x195c('0x15'));_0x405174(_0x2116c7[_0x195c('0x19')][_0x195c('0x18')]);}})[_0x195c('0x1a')](function(_0x1817f4){logger[_0x195c('0x17')]('Dashboard,\x20%s,\x20%s',_0x287ef2,_0x1817f4);_0x504a2c(_0x1817f4);});});}