Built motion from commit (unavailable).|2.4.18
[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 _0xc02c=['../../config/logger','../../config/environment','client','redis','defaults','localhost','./dashboard.socket','register','request','Dashboard,\x20%s,\x20%s','debug','stringify','error','code','message','info','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb'];(function(_0x27dbad,_0x497508){var _0x44e668=function(_0x108ef8){while(--_0x108ef8){_0x27dbad['push'](_0x27dbad['shift']());}};_0x44e668(++_0x497508);}(_0xc02c,0xf8));var _0xcc02=function(_0x4f617f,_0x28248f){_0x4f617f=_0x4f617f-0x0;var _0xe56a5a=_0xc02c[_0x4f617f];return _0xe56a5a;};'use strict';var _=require(_0xcc02('0x0'));var util=require('util');var moment=require(_0xcc02('0x1'));var BPromise=require('bluebird');var rs=require(_0xcc02('0x2'));var fs=require('fs');var Redis=require(_0xcc02('0x3'));var db=require(_0xcc02('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xcc02('0x5'))('rpc');var config=require(_0xcc02('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xcc02('0x7')]['http']({'port':0x232a});config[_0xcc02('0x8')]=_[_0xcc02('0x9')](config[_0xcc02('0x8')],{'host':_0xcc02('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xcc02('0x8')]));require(_0xcc02('0xb'))[_0xcc02('0xc')](socket);function respondWithRpcPromise(_0x32618d,_0x54ed1e,_0x5455e0){return new BPromise(function(_0x47f695,_0x4063e9){return client[_0xcc02('0xd')](_0x32618d,_0x5455e0)['then'](function(_0x4bc8b2){logger['info'](_0xcc02('0xe'),_0x54ed1e,'request\x20sent');logger[_0xcc02('0xf')]('Dashboard,\x20%s,\x20%s,\x20%s',_0x54ed1e,'request\x20sent',JSON[_0xcc02('0x10')](_0x4bc8b2));if(_0x4bc8b2[_0xcc02('0x11')]){if(_0x4bc8b2[_0xcc02('0x11')][_0xcc02('0x12')]===0x1f4){logger[_0xcc02('0x11')](_0xcc02('0xe'),_0x54ed1e,_0x4bc8b2['error'][_0xcc02('0x13')]);return _0x4063e9(_0x4bc8b2['error']['message']);}logger['error'](_0xcc02('0xe'),_0x54ed1e,_0x4bc8b2[_0xcc02('0x11')]['message']);return _0x47f695(_0x4bc8b2['error'][_0xcc02('0x13')]);}else{logger[_0xcc02('0x14')](_0xcc02('0xe'),_0x54ed1e,'request\x20sent');_0x47f695(_0x4bc8b2[_0xcc02('0x15')][_0xcc02('0x13')]);}})[_0xcc02('0x16')](function(_0x461daf){logger[_0xcc02('0x11')](_0xcc02('0xe'),_0x54ed1e,_0x461daf);_0x4063e9(_0x461daf);});});}