Built motion from commit (unavailable).|2.4.20
[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 _0x4d49=['request','info','Dashboard,\x20%s,\x20%s','debug','Dashboard,\x20%s,\x20%s,\x20%s','error','code','message','result','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','./dashboard.socket','register'];(function(_0x4c4037,_0x15054b){var _0x357862=function(_0x480015){while(--_0x480015){_0x4c4037['push'](_0x4c4037['shift']());}};_0x357862(++_0x15054b);}(_0x4d49,0x1d1));var _0x94d4=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x4d49[_0x3947c9];return _0x2e7871;};'use strict';var _=require('lodash');var util=require(_0x94d4('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x94d4('0x1'));var fs=require('fs');var Redis=require(_0x94d4('0x2'));var db=require(_0x94d4('0x3'))['db'];var utils=require(_0x94d4('0x4'));var logger=require(_0x94d4('0x5'))(_0x94d4('0x6'));var config=require(_0x94d4('0x7'));var jayson=require(_0x94d4('0x8'));var client=jayson[_0x94d4('0x9')][_0x94d4('0xa')]({'port':0x232a});config['redis']=_[_0x94d4('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x94d4('0xc')]));require(_0x94d4('0xd'))[_0x94d4('0xe')](socket);function respondWithRpcPromise(_0xd7f1b9,_0x3e70c9,_0x5ed408){return new BPromise(function(_0x2bc302,_0x14768b){return client[_0x94d4('0xf')](_0xd7f1b9,_0x5ed408)['then'](function(_0x19ca3c){logger[_0x94d4('0x10')](_0x94d4('0x11'),_0x3e70c9,'request\x20sent');logger[_0x94d4('0x12')](_0x94d4('0x13'),_0x3e70c9,'request\x20sent',JSON['stringify'](_0x19ca3c));if(_0x19ca3c[_0x94d4('0x14')]){if(_0x19ca3c[_0x94d4('0x14')][_0x94d4('0x15')]===0x1f4){logger[_0x94d4('0x14')](_0x94d4('0x11'),_0x3e70c9,_0x19ca3c[_0x94d4('0x14')][_0x94d4('0x16')]);return _0x14768b(_0x19ca3c['error'][_0x94d4('0x16')]);}logger[_0x94d4('0x14')]('Dashboard,\x20%s,\x20%s',_0x3e70c9,_0x19ca3c[_0x94d4('0x14')][_0x94d4('0x16')]);return _0x2bc302(_0x19ca3c[_0x94d4('0x14')][_0x94d4('0x16')]);}else{logger['info'](_0x94d4('0x11'),_0x3e70c9,'request\x20sent');_0x2bc302(_0x19ca3c[_0x94d4('0x17')][_0x94d4('0x16')]);}})['catch'](function(_0xcbbcfb){logger['error'](_0x94d4('0x11'),_0x3e70c9,_0xcbbcfb);_0x14768b(_0xcbbcfb);});});}