Built motion from commit (unavailable).|2.5.17
[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 _0x5b42=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','register','then','info','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','Dashboard,\x20%s,\x20%s','message','result','catch','util'];(function(_0x5d7472,_0x531a70){var _0x7d1f30=function(_0x403aff){while(--_0x403aff){_0x5d7472['push'](_0x5d7472['shift']());}};_0x7d1f30(++_0x531a70);}(_0x5b42,0x1da));var _0x25b4=function(_0x14511a,_0xf6a4cb){_0x14511a=_0x14511a-0x0;var _0x15f2e7=_0x5b42[_0x14511a];return _0x15f2e7;};'use strict';var _=require('lodash');var util=require(_0x25b4('0x0'));var moment=require('moment');var BPromise=require(_0x25b4('0x1'));var rs=require(_0x25b4('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x25b4('0x3'))['db'];var utils=require(_0x25b4('0x4'));var logger=require(_0x25b4('0x5'))(_0x25b4('0x6'));var config=require(_0x25b4('0x7'));var jayson=require(_0x25b4('0x8'));var client=jayson[_0x25b4('0x9')][_0x25b4('0xa')]({'port':0x232a});config[_0x25b4('0xb')]=_['defaults'](config[_0x25b4('0xb')],{'host':_0x25b4('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x25b4('0xb')]));require('./dashboard.socket')[_0x25b4('0xd')](socket);function respondWithRpcPromise(_0x5dde56,_0x1e3f2e,_0x4e4fc6){return new BPromise(function(_0x597da2,_0x14a277){return client['request'](_0x5dde56,_0x4e4fc6)[_0x25b4('0xe')](function(_0x122363){logger[_0x25b4('0xf')]('Dashboard,\x20%s,\x20%s',_0x1e3f2e,_0x25b4('0x10'));logger[_0x25b4('0x11')](_0x25b4('0x12'),_0x1e3f2e,_0x25b4('0x10'),JSON[_0x25b4('0x13')](_0x122363));if(_0x122363[_0x25b4('0x14')]){if(_0x122363[_0x25b4('0x14')]['code']===0x1f4){logger[_0x25b4('0x14')](_0x25b4('0x15'),_0x1e3f2e,_0x122363[_0x25b4('0x14')]['message']);return _0x14a277(_0x122363[_0x25b4('0x14')][_0x25b4('0x16')]);}logger[_0x25b4('0x14')](_0x25b4('0x15'),_0x1e3f2e,_0x122363[_0x25b4('0x14')]['message']);return _0x597da2(_0x122363[_0x25b4('0x14')]['message']);}else{logger[_0x25b4('0xf')](_0x25b4('0x15'),_0x1e3f2e,_0x25b4('0x10'));_0x597da2(_0x122363[_0x25b4('0x17')][_0x25b4('0x16')]);}})[_0x25b4('0x18')](function(_0x470315){logger[_0x25b4('0x14')](_0x25b4('0x15'),_0x1e3f2e,_0x470315);_0x14a277(_0x470315);});});}