Built motion from commit dc14b02d.|2.6.27
[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 _0x3f38=['jayson/promise','http','defaults','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','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0x3f38,0x1dc));var _0x83f3=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x3f38[_0x3ab51d];return _0x29a04e;};'use strict';var _=require('lodash');var util=require(_0x83f3('0x0'));var moment=require(_0x83f3('0x1'));var BPromise=require(_0x83f3('0x2'));var rs=require(_0x83f3('0x3'));var fs=require('fs');var Redis=require(_0x83f3('0x4'));var db=require(_0x83f3('0x5'))['db'];var utils=require(_0x83f3('0x6'));var logger=require(_0x83f3('0x7'))(_0x83f3('0x8'));var config=require(_0x83f3('0x9'));var jayson=require(_0x83f3('0xa'));var client=jayson['client'][_0x83f3('0xb')]({'port':0x232a});config['redis']=_[_0x83f3('0xc')](config[_0x83f3('0xd')],{'host':_0x83f3('0xe'),'port':0x18eb});var socket=require(_0x83f3('0xf'))(new Redis(config[_0x83f3('0xd')]));require('./dashboard.socket')[_0x83f3('0x10')](socket);function respondWithRpcPromise(_0x5d2456,_0x327fbf,_0x39fdf6){return new BPromise(function(_0x414b84,_0x40c295){return client[_0x83f3('0x11')](_0x5d2456,_0x39fdf6)[_0x83f3('0x12')](function(_0x1f8ae6){logger['info'](_0x83f3('0x13'),_0x327fbf,'request\x20sent');logger[_0x83f3('0x14')](_0x83f3('0x15'),_0x327fbf,'request\x20sent',JSON[_0x83f3('0x16')](_0x1f8ae6));if(_0x1f8ae6[_0x83f3('0x17')]){if(_0x1f8ae6[_0x83f3('0x17')][_0x83f3('0x18')]===0x1f4){logger['error'](_0x83f3('0x13'),_0x327fbf,_0x1f8ae6[_0x83f3('0x17')][_0x83f3('0x19')]);return _0x40c295(_0x1f8ae6[_0x83f3('0x17')][_0x83f3('0x19')]);}logger[_0x83f3('0x17')](_0x83f3('0x13'),_0x327fbf,_0x1f8ae6[_0x83f3('0x17')]['message']);return _0x414b84(_0x1f8ae6[_0x83f3('0x17')][_0x83f3('0x19')]);}else{logger['info'](_0x83f3('0x13'),_0x327fbf,'request\x20sent');_0x414b84(_0x1f8ae6[_0x83f3('0x1a')][_0x83f3('0x19')]);}})['catch'](function(_0x1a7f7f){logger['error'](_0x83f3('0x13'),_0x327fbf,_0x1a7f7f);_0x40c295(_0x1a7f7f);});});}