Built motion from commit (unavailable).|2.5.3
[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 _0x790e=['debug','request\x20sent','stringify','error','code','message','info','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','AnalyticMetric,\x20%s,\x20%s'];(function(_0xf79550,_0x4f3d76){var _0x42c1ef=function(_0xc3fd7){while(--_0xc3fd7){_0xf79550['push'](_0xf79550['shift']());}};_0x42c1ef(++_0x4f3d76);}(_0x790e,0x80));var _0xe790=function(_0x3cebd6,_0x91ff8c){_0x3cebd6=_0x3cebd6-0x0;var _0x16025a=_0x790e[_0x3cebd6];return _0x16025a;};'use strict';var _=require(_0xe790('0x0'));var util=require(_0xe790('0x1'));var moment=require('moment');var BPromise=require(_0xe790('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe790('0x3'));var db=require(_0xe790('0x4'))['db'];var utils=require(_0xe790('0x5'));var logger=require('../../config/logger')(_0xe790('0x6'));var config=require('../../config/environment');var jayson=require(_0xe790('0x7'));var client=jayson[_0xe790('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3f91d3,_0x24f1d8,_0x3701fc){return new BPromise(function(_0x11090b,_0x282a11){return client[_0xe790('0x9')](_0x3f91d3,_0x3701fc)[_0xe790('0xa')](function(_0x11636b){logger['info'](_0xe790('0xb'),_0x24f1d8,'request\x20sent');logger[_0xe790('0xc')]('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x24f1d8,_0xe790('0xd'),JSON[_0xe790('0xe')](_0x11636b));if(_0x11636b[_0xe790('0xf')]){if(_0x11636b['error'][_0xe790('0x10')]===0x1f4){logger['error'](_0xe790('0xb'),_0x24f1d8,_0x11636b[_0xe790('0xf')]['message']);return _0x282a11(_0x11636b[_0xe790('0xf')][_0xe790('0x11')]);}logger['error']('AnalyticMetric,\x20%s,\x20%s',_0x24f1d8,_0x11636b[_0xe790('0xf')][_0xe790('0x11')]);return _0x11090b(_0x11636b[_0xe790('0xf')][_0xe790('0x11')]);}else{logger[_0xe790('0x12')]('AnalyticMetric,\x20%s,\x20%s',_0x24f1d8,_0xe790('0xd'));_0x11090b(_0x11636b['result'][_0xe790('0x11')]);}})[_0xe790('0x13')](function(_0x4a686f){logger['error'](_0xe790('0xb'),_0x24f1d8,_0x4a686f);_0x282a11(_0x4a686f);});});}