Built motion from commit 775e2a94.|2.6.3
[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 _0xc35a=['client','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','request','then','Dashboard,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise'];(function(_0x161271,_0x50c970){var _0x5af393=function(_0x30b8b2){while(--_0x30b8b2){_0x161271['push'](_0x161271['shift']());}};_0x5af393(++_0x50c970);}(_0xc35a,0x7e));var _0xac35=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xc35a[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0xac35('0x0'));var util=require('util');var moment=require(_0xac35('0x1'));var BPromise=require(_0xac35('0x2'));var rs=require(_0xac35('0x3'));var fs=require('fs');var Redis=require(_0xac35('0x4'));var db=require(_0xac35('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xac35('0x6'))('rpc');var config=require(_0xac35('0x7'));var jayson=require(_0xac35('0x8'));var client=jayson[_0xac35('0x9')]['http']({'port':0x232a});config[_0xac35('0xa')]=_[_0xac35('0xb')](config['redis'],{'host':_0xac35('0xc'),'port':0x18eb});var socket=require(_0xac35('0xd'))(new Redis(config[_0xac35('0xa')]));require(_0xac35('0xe'))['register'](socket);function respondWithRpcPromise(_0x20ac69,_0x3860c7,_0x474451){return new BPromise(function(_0x26c38f,_0x914b65){return client[_0xac35('0xf')](_0x20ac69,_0x474451)[_0xac35('0x10')](function(_0x1762ca){logger['info'](_0xac35('0x11'),_0x3860c7,_0xac35('0x12'));logger[_0xac35('0x13')]('Dashboard,\x20%s,\x20%s,\x20%s',_0x3860c7,'request\x20sent',JSON[_0xac35('0x14')](_0x1762ca));if(_0x1762ca[_0xac35('0x15')]){if(_0x1762ca[_0xac35('0x15')][_0xac35('0x16')]===0x1f4){logger[_0xac35('0x15')](_0xac35('0x11'),_0x3860c7,_0x1762ca[_0xac35('0x15')][_0xac35('0x17')]);return _0x914b65(_0x1762ca['error']['message']);}logger[_0xac35('0x15')](_0xac35('0x11'),_0x3860c7,_0x1762ca[_0xac35('0x15')][_0xac35('0x17')]);return _0x26c38f(_0x1762ca['error']['message']);}else{logger[_0xac35('0x18')](_0xac35('0x11'),_0x3860c7,_0xac35('0x12'));_0x26c38f(_0x1762ca[_0xac35('0x19')]['message']);}})[_0xac35('0x1a')](function(_0x18ba5e){logger[_0xac35('0x15')](_0xac35('0x11'),_0x3860c7,_0x18ba5e);_0x914b65(_0x18ba5e);});});}