Built motion from commit (unavailable).|2.5.30
[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 _0x8994=['util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','error','code','message'];(function(_0xbe33e4,_0xb4340){var _0x5d9773=function(_0x845065){while(--_0x845065){_0xbe33e4['push'](_0xbe33e4['shift']());}};_0x5d9773(++_0xb4340);}(_0x8994,0xab));var _0x4899=function(_0x10004e,_0xd701e6){_0x10004e=_0x10004e-0x0;var _0x5af990=_0x8994[_0x10004e];return _0x5af990;};'use strict';var _=require('lodash');var util=require(_0x4899('0x0'));var moment=require(_0x4899('0x1'));var BPromise=require(_0x4899('0x2'));var rs=require(_0x4899('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4899('0x4'))['db'];var utils=require(_0x4899('0x5'));var logger=require(_0x4899('0x6'))(_0x4899('0x7'));var config=require(_0x4899('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x4899('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x123fee,_0x380fc9,_0x5addec){return new BPromise(function(_0x590a99,_0x3ba644){return client[_0x4899('0xa')](_0x123fee,_0x5addec)[_0x4899('0xb')](function(_0x35e475){logger[_0x4899('0xc')](_0x4899('0xd'),_0x380fc9,_0x4899('0xe'));logger[_0x4899('0xf')]('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x380fc9,_0x4899('0xe'),JSON['stringify'](_0x35e475));if(_0x35e475[_0x4899('0x10')]){if(_0x35e475[_0x4899('0x10')][_0x4899('0x11')]===0x1f4){logger['error']('AnalyticMetric,\x20%s,\x20%s',_0x380fc9,_0x35e475['error'][_0x4899('0x12')]);return _0x3ba644(_0x35e475['error'][_0x4899('0x12')]);}logger[_0x4899('0x10')](_0x4899('0xd'),_0x380fc9,_0x35e475['error'][_0x4899('0x12')]);return _0x590a99(_0x35e475['error'][_0x4899('0x12')]);}else{logger[_0x4899('0xc')](_0x4899('0xd'),_0x380fc9,_0x4899('0xe'));_0x590a99(_0x35e475['result'][_0x4899('0x12')]);}})['catch'](function(_0x4a65a3){logger[_0x4899('0x10')]('AnalyticMetric,\x20%s,\x20%s',_0x380fc9,_0x4a65a3);_0x3ba644(_0x4a65a3);});});}