Built motion from commit (unavailable).|2.5.2
[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 _0xa537=['request','then','AnalyticMetric,\x20%s,\x20%s','request\x20sent','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','http'];(function(_0x838813,_0x448f0f){var _0x2bd32d=function(_0x57b589){while(--_0x57b589){_0x838813['push'](_0x838813['shift']());}};_0x2bd32d(++_0x448f0f);}(_0xa537,0x79));var _0x7a53=function(_0x5a29c4,_0x42a86d){_0x5a29c4=_0x5a29c4-0x0;var _0x557a9a=_0xa537[_0x5a29c4];return _0x557a9a;};'use strict';var _=require(_0x7a53('0x0'));var util=require(_0x7a53('0x1'));var moment=require(_0x7a53('0x2'));var BPromise=require(_0x7a53('0x3'));var rs=require(_0x7a53('0x4'));var fs=require('fs');var Redis=require(_0x7a53('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x7a53('0x6'));var logger=require(_0x7a53('0x7'))('rpc');var config=require(_0x7a53('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x7a53('0x9')][_0x7a53('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4fe857,_0x29cf65,_0x1c5f00){return new BPromise(function(_0x2c6664,_0x56038c){return client[_0x7a53('0xb')](_0x4fe857,_0x1c5f00)[_0x7a53('0xc')](function(_0x5acaf2){logger['info'](_0x7a53('0xd'),_0x29cf65,_0x7a53('0xe'));logger['debug'](_0x7a53('0xf'),_0x29cf65,_0x7a53('0xe'),JSON[_0x7a53('0x10')](_0x5acaf2));if(_0x5acaf2[_0x7a53('0x11')]){if(_0x5acaf2['error'][_0x7a53('0x12')]===0x1f4){logger['error'](_0x7a53('0xd'),_0x29cf65,_0x5acaf2[_0x7a53('0x11')]['message']);return _0x56038c(_0x5acaf2['error']['message']);}logger[_0x7a53('0x11')](_0x7a53('0xd'),_0x29cf65,_0x5acaf2['error'][_0x7a53('0x13')]);return _0x2c6664(_0x5acaf2['error'][_0x7a53('0x13')]);}else{logger['info']('AnalyticMetric,\x20%s,\x20%s',_0x29cf65,'request\x20sent');_0x2c6664(_0x5acaf2[_0x7a53('0x14')]['message']);}})[_0x7a53('0x15')](function(_0xd066a4){logger[_0x7a53('0x11')](_0x7a53('0xd'),_0x29cf65,_0xd066a4);_0x56038c(_0xd066a4);});});}