Built motion from commit e1760111.|2.6.18
[motion2.git] / server / api / analyticMetric / analyticMetric.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 _0xa9aa=['bluebird','randomstring','../../config/utils','../../config/logger','rpc','http','request','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','AnalyticMetric,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','moment'];(function(_0x5016fc,_0x3e5f95){var _0x4eaa13=function(_0x35f7d0){while(--_0x35f7d0){_0x5016fc['push'](_0x5016fc['shift']());}};_0x4eaa13(++_0x3e5f95);}(_0xa9aa,0xf4));var _0xaa9a=function(_0x42421e,_0x5a968d){_0x42421e=_0x42421e-0x0;var _0x56c250=_0xa9aa[_0x42421e];return _0x56c250;};'use strict';var _=require(_0xaa9a('0x0'));var util=require(_0xaa9a('0x1'));var moment=require(_0xaa9a('0x2'));var BPromise=require(_0xaa9a('0x3'));var rs=require(_0xaa9a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xaa9a('0x5'));var logger=require(_0xaa9a('0x6'))(_0xaa9a('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xaa9a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xa35d34,_0x4f813d,_0x529b3c){return new BPromise(function(_0x2ed1c9,_0x3807a4){return client[_0xaa9a('0x9')](_0xa35d34,_0x529b3c)[_0xaa9a('0xa')](function(_0x317e21){logger[_0xaa9a('0xb')](_0xaa9a('0xc'),_0x4f813d,_0xaa9a('0xd'));logger['debug'](_0xaa9a('0xe'),_0x4f813d,_0xaa9a('0xd'),JSON['stringify'](_0x317e21));if(_0x317e21[_0xaa9a('0xf')]){if(_0x317e21[_0xaa9a('0xf')][_0xaa9a('0x10')]===0x1f4){logger[_0xaa9a('0xf')](_0xaa9a('0xc'),_0x4f813d,_0x317e21['error'][_0xaa9a('0x11')]);return _0x3807a4(_0x317e21['error'][_0xaa9a('0x11')]);}logger['error']('AnalyticMetric,\x20%s,\x20%s',_0x4f813d,_0x317e21['error'][_0xaa9a('0x11')]);return _0x2ed1c9(_0x317e21['error'][_0xaa9a('0x11')]);}else{logger[_0xaa9a('0xb')](_0xaa9a('0xc'),_0x4f813d,_0xaa9a('0xd'));_0x2ed1c9(_0x317e21[_0xaa9a('0x12')][_0xaa9a('0x11')]);}})['catch'](function(_0x2247c3){logger[_0xaa9a('0xf')]('AnalyticMetric,\x20%s,\x20%s',_0x4f813d,_0x2247c3);_0x3807a4(_0x2247c3);});});}