ce4355e5ee7ef02b02fff3ec586b881eebab6ac5
[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 _0x201f=['then','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','client','http','request'];(function(_0x1b2e34,_0x8d3ab5){var _0x13c2b9=function(_0x1d4bb3){while(--_0x1d4bb3){_0x1b2e34['push'](_0x1b2e34['shift']());}};_0x13c2b9(++_0x8d3ab5);}(_0x201f,0xda));var _0xf201=function(_0x32381e,_0x122f77){_0x32381e=_0x32381e-0x0;var _0x1617c8=_0x201f[_0x32381e];return _0x1617c8;};'use strict';var _=require(_0xf201('0x0'));var util=require('util');var moment=require(_0xf201('0x1'));var BPromise=require(_0xf201('0x2'));var rs=require(_0xf201('0x3'));var fs=require('fs');var Redis=require(_0xf201('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xf201('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xf201('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xf201('0x7')][_0xf201('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x42c351,_0x1198b2,_0x150386){return new BPromise(function(_0x1a5694,_0x400562){return client[_0xf201('0x9')](_0x42c351,_0x150386)[_0xf201('0xa')](function(_0x2a019f){logger['info'](_0xf201('0xb'),_0x1198b2,_0xf201('0xc'));logger[_0xf201('0xd')]('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x1198b2,'request\x20sent',JSON[_0xf201('0xe')](_0x2a019f));if(_0x2a019f['error']){if(_0x2a019f[_0xf201('0xf')][_0xf201('0x10')]===0x1f4){logger[_0xf201('0xf')]('AnalyticMetric,\x20%s,\x20%s',_0x1198b2,_0x2a019f[_0xf201('0xf')][_0xf201('0x11')]);return _0x400562(_0x2a019f[_0xf201('0xf')][_0xf201('0x11')]);}logger[_0xf201('0xf')](_0xf201('0xb'),_0x1198b2,_0x2a019f[_0xf201('0xf')][_0xf201('0x11')]);return _0x1a5694(_0x2a019f[_0xf201('0xf')][_0xf201('0x11')]);}else{logger['info'](_0xf201('0xb'),_0x1198b2,_0xf201('0xc'));_0x1a5694(_0x2a019f[_0xf201('0x12')][_0xf201('0x11')]);}})['catch'](function(_0x259677){logger['error'](_0xf201('0xb'),_0x1198b2,_0x259677);_0x400562(_0x259677);});});}