Built motion from commit b0a9a629.|2.6.33
[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 _0xa302=['code','AnalyticMetric,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','stringify','error'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xa302,0x1e9));var _0x2a30=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xa302[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x2a30('0x0'));var util=require('util');var moment=require(_0x2a30('0x1'));var BPromise=require(_0x2a30('0x2'));var rs=require(_0x2a30('0x3'));var fs=require('fs');var Redis=require(_0x2a30('0x4'));var db=require(_0x2a30('0x5'))['db'];var utils=require(_0x2a30('0x6'));var logger=require(_0x2a30('0x7'))('rpc');var config=require(_0x2a30('0x8'));var jayson=require(_0x2a30('0x9'));var client=jayson['client'][_0x2a30('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x417ce9,_0x5811ff,_0x41b3dd){return new BPromise(function(_0x2086ae,_0x441b04){return client[_0x2a30('0xb')](_0x417ce9,_0x41b3dd)[_0x2a30('0xc')](function(_0x4398de){logger[_0x2a30('0xd')]('AnalyticMetric,\x20%s,\x20%s',_0x5811ff,_0x2a30('0xe'));logger['debug']('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x5811ff,_0x2a30('0xe'),JSON[_0x2a30('0xf')](_0x4398de));if(_0x4398de[_0x2a30('0x10')]){if(_0x4398de[_0x2a30('0x10')][_0x2a30('0x11')]===0x1f4){logger[_0x2a30('0x10')](_0x2a30('0x12'),_0x5811ff,_0x4398de['error'][_0x2a30('0x13')]);return _0x441b04(_0x4398de['error']['message']);}logger[_0x2a30('0x10')]('AnalyticMetric,\x20%s,\x20%s',_0x5811ff,_0x4398de[_0x2a30('0x10')][_0x2a30('0x13')]);return _0x2086ae(_0x4398de[_0x2a30('0x10')]['message']);}else{logger['info']('AnalyticMetric,\x20%s,\x20%s',_0x5811ff,'request\x20sent');_0x2086ae(_0x4398de[_0x2a30('0x14')]['message']);}})[_0x2a30('0x15')](function(_0x4456ad){logger[_0x2a30('0x10')](_0x2a30('0x12'),_0x5811ff,_0x4456ad);_0x441b04(_0x4456ad);});});}