Built motion from commit 3e059bc2.|2.5.32
[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 _0xc749=['client','redis','defaults','localhost','./dashboard.socket','request','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','ioredis','../../config/environment'];(function(_0x59d53d,_0x280b1a){var _0x2f4bc4=function(_0x4bc7ba){while(--_0x4bc7ba){_0x59d53d['push'](_0x59d53d['shift']());}};_0x2f4bc4(++_0x280b1a);}(_0xc749,0x182));var _0x9c74=function(_0x34f80f,_0x17961c){_0x34f80f=_0x34f80f-0x0;var _0x24bd16=_0xc749[_0x34f80f];return _0x24bd16;};'use strict';var _=require(_0x9c74('0x0'));var util=require('util');var moment=require(_0x9c74('0x1'));var BPromise=require(_0x9c74('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9c74('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x9c74('0x4'));var jayson=require('jayson/promise');var client=jayson[_0x9c74('0x5')]['http']({'port':0x232a});config[_0x9c74('0x6')]=_[_0x9c74('0x7')](config[_0x9c74('0x6')],{'host':_0x9c74('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9c74('0x6')]));require(_0x9c74('0x9'))['register'](socket);function respondWithRpcPromise(_0x41b1e0,_0x17b00e,_0x1010a1){return new BPromise(function(_0x5b860e,_0x3bccad){return client[_0x9c74('0xa')](_0x41b1e0,_0x1010a1)[_0x9c74('0xb')](function(_0x5f353c){logger[_0x9c74('0xc')](_0x9c74('0xd'),_0x17b00e,_0x9c74('0xe'));logger[_0x9c74('0xf')](_0x9c74('0x10'),_0x17b00e,'request\x20sent',JSON[_0x9c74('0x11')](_0x5f353c));if(_0x5f353c[_0x9c74('0x12')]){if(_0x5f353c[_0x9c74('0x12')][_0x9c74('0x13')]===0x1f4){logger[_0x9c74('0x12')](_0x9c74('0xd'),_0x17b00e,_0x5f353c[_0x9c74('0x12')][_0x9c74('0x14')]);return _0x3bccad(_0x5f353c['error'][_0x9c74('0x14')]);}logger[_0x9c74('0x12')](_0x9c74('0xd'),_0x17b00e,_0x5f353c[_0x9c74('0x12')][_0x9c74('0x14')]);return _0x5b860e(_0x5f353c['error'][_0x9c74('0x14')]);}else{logger['info'](_0x9c74('0xd'),_0x17b00e,_0x9c74('0xe'));_0x5b860e(_0x5f353c[_0x9c74('0x15')][_0x9c74('0x14')]);}})[_0x9c74('0x16')](function(_0xf449f4){logger[_0x9c74('0x12')](_0x9c74('0xd'),_0x17b00e,_0xf449f4);_0x3bccad(_0xf449f4);});});}