Built motion from commit 43538d75.|2.5.35
[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 _0x82c8=['jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x256080,_0x246cc3){var _0x55f639=function(_0x4f20f3){while(--_0x4f20f3){_0x256080['push'](_0x256080['shift']());}};_0x55f639(++_0x246cc3);}(_0x82c8,0x1a7));var _0x882c=function(_0x347420,_0x3cd5c7){_0x347420=_0x347420-0x0;var _0x2fa985=_0x82c8[_0x347420];return _0x2fa985;};'use strict';var _=require(_0x882c('0x0'));var util=require(_0x882c('0x1'));var moment=require(_0x882c('0x2'));var BPromise=require(_0x882c('0x3'));var rs=require(_0x882c('0x4'));var fs=require('fs');var Redis=require(_0x882c('0x5'));var db=require(_0x882c('0x6'))['db'];var utils=require(_0x882c('0x7'));var logger=require('../../config/logger')(_0x882c('0x8'));var config=require('../../config/environment');var jayson=require(_0x882c('0x9'));var client=jayson['client'][_0x882c('0xa')]({'port':0x232a});config[_0x882c('0xb')]=_[_0x882c('0xc')](config[_0x882c('0xb')],{'host':_0x882c('0xd'),'port':0x18eb});var socket=require(_0x882c('0xe'))(new Redis(config[_0x882c('0xb')]));require(_0x882c('0xf'))['register'](socket);function respondWithRpcPromise(_0xe8fe4b,_0x21a429,_0x1c9959){return new BPromise(function(_0x3a8439,_0x5f10b0){return client['request'](_0xe8fe4b,_0x1c9959)[_0x882c('0x10')](function(_0x11943a){logger[_0x882c('0x11')](_0x882c('0x12'),_0x21a429,_0x882c('0x13'));logger[_0x882c('0x14')](_0x882c('0x15'),_0x21a429,'request\x20sent',JSON[_0x882c('0x16')](_0x11943a));if(_0x11943a[_0x882c('0x17')]){if(_0x11943a[_0x882c('0x17')]['code']===0x1f4){logger[_0x882c('0x17')]('Dashboard,\x20%s,\x20%s',_0x21a429,_0x11943a[_0x882c('0x17')]['message']);return _0x5f10b0(_0x11943a['error'][_0x882c('0x18')]);}logger[_0x882c('0x17')](_0x882c('0x12'),_0x21a429,_0x11943a[_0x882c('0x17')][_0x882c('0x18')]);return _0x3a8439(_0x11943a[_0x882c('0x17')]['message']);}else{logger['info'](_0x882c('0x12'),_0x21a429,_0x882c('0x13'));_0x3a8439(_0x11943a[_0x882c('0x19')][_0x882c('0x18')]);}})[_0x882c('0x1a')](function(_0x3c0d81){logger[_0x882c('0x17')](_0x882c('0x12'),_0x21a429,_0x3c0d81);_0x5f10b0(_0x3c0d81);});});}