Built motion from commit (unavailable).|2.5.11
[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 _0x2e9b=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','error','message','result','moment'];(function(_0x44913c,_0x754aad){var _0x4b7ca2=function(_0x35345e){while(--_0x35345e){_0x44913c['push'](_0x44913c['shift']());}};_0x4b7ca2(++_0x754aad);}(_0x2e9b,0x179));var _0xb2e9=function(_0x373767,_0x3b3587){_0x373767=_0x373767-0x0;var _0xd808fb=_0x2e9b[_0x373767];return _0xd808fb;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xb2e9('0x0'));var BPromise=require(_0xb2e9('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb2e9('0x2'));var db=require(_0xb2e9('0x3'))['db'];var utils=require(_0xb2e9('0x4'));var logger=require(_0xb2e9('0x5'))(_0xb2e9('0x6'));var config=require(_0xb2e9('0x7'));var jayson=require(_0xb2e9('0x8'));var client=jayson[_0xb2e9('0x9')][_0xb2e9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x12eb46,_0xb4bec,_0x418aa9){return new BPromise(function(_0x370d36,_0x194128){return client[_0xb2e9('0xb')](_0x12eb46,_0x418aa9)[_0xb2e9('0xc')](function(_0x304d52){logger[_0xb2e9('0xd')](_0xb2e9('0xe'),_0xb4bec,_0xb2e9('0xf'));logger[_0xb2e9('0x10')](_0xb2e9('0x11'),_0xb4bec,_0xb2e9('0xf'),JSON['stringify'](_0x304d52));if(_0x304d52['error']){if(_0x304d52['error']['code']===0x1f4){logger[_0xb2e9('0x12')](_0xb2e9('0xe'),_0xb4bec,_0x304d52[_0xb2e9('0x12')]['message']);return _0x194128(_0x304d52['error'][_0xb2e9('0x13')]);}logger[_0xb2e9('0x12')]('AnalyticMetric,\x20%s,\x20%s',_0xb4bec,_0x304d52[_0xb2e9('0x12')][_0xb2e9('0x13')]);return _0x370d36(_0x304d52[_0xb2e9('0x12')][_0xb2e9('0x13')]);}else{logger['info'](_0xb2e9('0xe'),_0xb4bec,_0xb2e9('0xf'));_0x370d36(_0x304d52[_0xb2e9('0x14')][_0xb2e9('0x13')]);}})['catch'](function(_0x2275f3){logger['error'](_0xb2e9('0xe'),_0xb4bec,_0x2275f3);_0x194128(_0x2275f3);});});}