4dac6b50000e7845d40f2a5f38bad5d872c62174
[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 _0x26ea=['../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x26ea,0x72));var _0xa26e=function(_0x1836db,_0x3b675d){_0x1836db=_0x1836db-0x0;var _0x71f7d7=_0x26ea[_0x1836db];return _0x71f7d7;};'use strict';var _=require(_0xa26e('0x0'));var util=require(_0xa26e('0x1'));var moment=require(_0xa26e('0x2'));var BPromise=require(_0xa26e('0x3'));var rs=require(_0xa26e('0x4'));var fs=require('fs');var Redis=require(_0xa26e('0x5'));var db=require(_0xa26e('0x6'))['db'];var utils=require(_0xa26e('0x7'));var logger=require('../../config/logger')(_0xa26e('0x8'));var config=require(_0xa26e('0x9'));var jayson=require(_0xa26e('0xa'));var client=jayson['client'][_0xa26e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x39084f,_0x2dc491,_0x3fa507){return new BPromise(function(_0x53e474,_0x2e5396){return client[_0xa26e('0xc')](_0x39084f,_0x3fa507)[_0xa26e('0xd')](function(_0x1cb41a){logger['info'](_0xa26e('0xe'),_0x2dc491,_0xa26e('0xf'));logger[_0xa26e('0x10')](_0xa26e('0x11'),_0x2dc491,'request\x20sent',JSON[_0xa26e('0x12')](_0x1cb41a));if(_0x1cb41a['error']){if(_0x1cb41a[_0xa26e('0x13')][_0xa26e('0x14')]===0x1f4){logger[_0xa26e('0x13')]('AnalyticMetric,\x20%s,\x20%s',_0x2dc491,_0x1cb41a['error'][_0xa26e('0x15')]);return _0x2e5396(_0x1cb41a[_0xa26e('0x13')][_0xa26e('0x15')]);}logger[_0xa26e('0x13')](_0xa26e('0xe'),_0x2dc491,_0x1cb41a[_0xa26e('0x13')][_0xa26e('0x15')]);return _0x53e474(_0x1cb41a[_0xa26e('0x13')][_0xa26e('0x15')]);}else{logger[_0xa26e('0x16')](_0xa26e('0xe'),_0x2dc491,_0xa26e('0xf'));_0x53e474(_0x1cb41a[_0xa26e('0x17')][_0xa26e('0x15')]);}})['catch'](function(_0x58a001){logger[_0xa26e('0x13')]('AnalyticMetric,\x20%s,\x20%s',_0x2dc491,_0x58a001);_0x2e5396(_0x58a001);});});}