Built motion from commit (unavailable).|2.5.29
[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 _0xd06a=['stringify','error','Dashboard,\x20%s,\x20%s','message','info','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./dashboard.socket','then','request\x20sent','Dashboard,\x20%s,\x20%s,\x20%s'];(function(_0x2bd662,_0x1c1eb5){var _0x44935f=function(_0x22023e){while(--_0x22023e){_0x2bd662['push'](_0x2bd662['shift']());}};_0x44935f(++_0x1c1eb5);}(_0xd06a,0xd6));var _0xad06=function(_0x30f0f2,_0x8a4674){_0x30f0f2=_0x30f0f2-0x0;var _0x1abc3f=_0xd06a[_0x30f0f2];return _0x1abc3f;};'use strict';var _=require('lodash');var util=require(_0xad06('0x0'));var moment=require(_0xad06('0x1'));var BPromise=require(_0xad06('0x2'));var rs=require(_0xad06('0x3'));var fs=require('fs');var Redis=require(_0xad06('0x4'));var db=require(_0xad06('0x5'))['db'];var utils=require(_0xad06('0x6'));var logger=require(_0xad06('0x7'))(_0xad06('0x8'));var config=require(_0xad06('0x9'));var jayson=require(_0xad06('0xa'));var client=jayson[_0xad06('0xb')][_0xad06('0xc')]({'port':0x232a});config[_0xad06('0xd')]=_['defaults'](config[_0xad06('0xd')],{'host':_0xad06('0xe'),'port':0x18eb});var socket=require(_0xad06('0xf'))(new Redis(config[_0xad06('0xd')]));require(_0xad06('0x10'))['register'](socket);function respondWithRpcPromise(_0x31fec3,_0x2aa383,_0x299912){return new BPromise(function(_0x313cd9,_0x24b593){return client['request'](_0x31fec3,_0x299912)[_0xad06('0x11')](function(_0x2bbb2c){logger['info']('Dashboard,\x20%s,\x20%s',_0x2aa383,_0xad06('0x12'));logger['debug'](_0xad06('0x13'),_0x2aa383,_0xad06('0x12'),JSON[_0xad06('0x14')](_0x2bbb2c));if(_0x2bbb2c[_0xad06('0x15')]){if(_0x2bbb2c[_0xad06('0x15')]['code']===0x1f4){logger[_0xad06('0x15')](_0xad06('0x16'),_0x2aa383,_0x2bbb2c[_0xad06('0x15')][_0xad06('0x17')]);return _0x24b593(_0x2bbb2c[_0xad06('0x15')][_0xad06('0x17')]);}logger[_0xad06('0x15')](_0xad06('0x16'),_0x2aa383,_0x2bbb2c[_0xad06('0x15')][_0xad06('0x17')]);return _0x313cd9(_0x2bbb2c[_0xad06('0x15')][_0xad06('0x17')]);}else{logger[_0xad06('0x18')](_0xad06('0x16'),_0x2aa383,_0xad06('0x12'));_0x313cd9(_0x2bbb2c['result'][_0xad06('0x17')]);}})[_0xad06('0x19')](function(_0x5ccd7c){logger['error']('Dashboard,\x20%s,\x20%s',_0x2aa383,_0x5ccd7c);_0x24b593(_0x5ccd7c);});});}