Built motion from commit (unavailable).|2.5.15
[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 _0xb0b9=['error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','defaults','redis','localhost','./dashboard.socket','register','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xb0b9,0x1be));var _0x9b0b=function(_0x184df8,_0x429c0c){_0x184df8=_0x184df8-0x0;var _0x4f5112=_0xb0b9[_0x184df8];return _0x4f5112;};'use strict';var _=require(_0x9b0b('0x0'));var util=require(_0x9b0b('0x1'));var moment=require(_0x9b0b('0x2'));var BPromise=require(_0x9b0b('0x3'));var rs=require(_0x9b0b('0x4'));var fs=require('fs');var Redis=require(_0x9b0b('0x5'));var db=require(_0x9b0b('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x9b0b('0x7'))(_0x9b0b('0x8'));var config=require('../../config/environment');var jayson=require(_0x9b0b('0x9'));var client=jayson['client'][_0x9b0b('0xa')]({'port':0x232a});config['redis']=_[_0x9b0b('0xb')](config[_0x9b0b('0xc')],{'host':_0x9b0b('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9b0b('0xc')]));require(_0x9b0b('0xe'))[_0x9b0b('0xf')](socket);function respondWithRpcPromise(_0x4e3de3,_0x598cca,_0x33640a){return new BPromise(function(_0x3e89c6,_0x4c94f1){return client['request'](_0x4e3de3,_0x33640a)['then'](function(_0x4ce982){logger[_0x9b0b('0x10')](_0x9b0b('0x11'),_0x598cca,_0x9b0b('0x12'));logger[_0x9b0b('0x13')](_0x9b0b('0x14'),_0x598cca,'request\x20sent',JSON[_0x9b0b('0x15')](_0x4ce982));if(_0x4ce982['error']){if(_0x4ce982[_0x9b0b('0x16')][_0x9b0b('0x17')]===0x1f4){logger['error'](_0x9b0b('0x11'),_0x598cca,_0x4ce982[_0x9b0b('0x16')][_0x9b0b('0x18')]);return _0x4c94f1(_0x4ce982[_0x9b0b('0x16')][_0x9b0b('0x18')]);}logger['error'](_0x9b0b('0x11'),_0x598cca,_0x4ce982[_0x9b0b('0x16')][_0x9b0b('0x18')]);return _0x3e89c6(_0x4ce982['error'][_0x9b0b('0x18')]);}else{logger[_0x9b0b('0x10')](_0x9b0b('0x11'),_0x598cca,_0x9b0b('0x12'));_0x3e89c6(_0x4ce982['result'][_0x9b0b('0x18')]);}})[_0x9b0b('0x19')](function(_0xbf8d38){logger['error'](_0x9b0b('0x11'),_0x598cca,_0xbf8d38);_0x4c94f1(_0xbf8d38);});});}