Built motion from commit 953226e6.|2.6.32
[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 _0xb7f5=['code','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x1a6f76,_0x514bd4){var _0x484c93=function(_0x49975a){while(--_0x49975a){_0x1a6f76['push'](_0x1a6f76['shift']());}};_0x484c93(++_0x514bd4);}(_0xb7f5,0x10e));var _0x5b7f=function(_0x532224,_0x21fb5b){_0x532224=_0x532224-0x0;var _0x225ab4=_0xb7f5[_0x532224];return _0x225ab4;};'use strict';var _=require('lodash');var util=require(_0x5b7f('0x0'));var moment=require(_0x5b7f('0x1'));var BPromise=require(_0x5b7f('0x2'));var rs=require(_0x5b7f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5b7f('0x4'))['db'];var utils=require(_0x5b7f('0x5'));var logger=require('../../config/logger')(_0x5b7f('0x6'));var config=require('../../config/environment');var jayson=require(_0x5b7f('0x7'));var client=jayson[_0x5b7f('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x204806,_0x2fff66,_0x19c016){return new BPromise(function(_0x3c2feb,_0x5267c8){return client['request'](_0x204806,_0x19c016)['then'](function(_0x1b4c3a){logger[_0x5b7f('0x9')](_0x5b7f('0xa'),_0x2fff66,_0x5b7f('0xb'));logger[_0x5b7f('0xc')]('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x2fff66,_0x5b7f('0xb'),JSON[_0x5b7f('0xd')](_0x1b4c3a));if(_0x1b4c3a[_0x5b7f('0xe')]){if(_0x1b4c3a['error'][_0x5b7f('0xf')]===0x1f4){logger['error'](_0x5b7f('0xa'),_0x2fff66,_0x1b4c3a['error']['message']);return _0x5267c8(_0x1b4c3a[_0x5b7f('0xe')]['message']);}logger[_0x5b7f('0xe')]('AnalyticMetric,\x20%s,\x20%s',_0x2fff66,_0x1b4c3a['error']['message']);return _0x3c2feb(_0x1b4c3a[_0x5b7f('0xe')][_0x5b7f('0x10')]);}else{logger[_0x5b7f('0x9')]('AnalyticMetric,\x20%s,\x20%s',_0x2fff66,_0x5b7f('0xb'));_0x3c2feb(_0x1b4c3a[_0x5b7f('0x11')][_0x5b7f('0x10')]);}})[_0x5b7f('0x12')](function(_0x333450){logger[_0x5b7f('0xe')](_0x5b7f('0xa'),_0x2fff66,_0x333450);_0x5267c8(_0x333450);});});}