Built motion from commit 9d0783e6.|2.6.13
[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 _0xeca4=['info','result','lodash','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','client','http','request','then','AnalyticMetric,\x20%s,\x20%s','request\x20sent','stringify','error','message'];(function(_0x565228,_0x8d5181){var _0x11570f=function(_0x949dc0){while(--_0x949dc0){_0x565228['push'](_0x565228['shift']());}};_0x11570f(++_0x8d5181);}(_0xeca4,0x1b7));var _0x4eca=function(_0x42e15e,_0x267b5d){_0x42e15e=_0x42e15e-0x0;var _0x1fd377=_0xeca4[_0x42e15e];return _0x1fd377;};'use strict';var _=require(_0x4eca('0x0'));var util=require(_0x4eca('0x1'));var moment=require(_0x4eca('0x2'));var BPromise=require(_0x4eca('0x3'));var rs=require(_0x4eca('0x4'));var fs=require('fs');var Redis=require(_0x4eca('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x4eca('0x6'));var config=require(_0x4eca('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x4eca('0x8')][_0x4eca('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x45bb29,_0xecd238,_0x2d725e){return new BPromise(function(_0x12164c,_0x50842e){return client[_0x4eca('0xa')](_0x45bb29,_0x2d725e)[_0x4eca('0xb')](function(_0xe8663a){logger['info'](_0x4eca('0xc'),_0xecd238,_0x4eca('0xd'));logger['debug']('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0xecd238,'request\x20sent',JSON[_0x4eca('0xe')](_0xe8663a));if(_0xe8663a['error']){if(_0xe8663a[_0x4eca('0xf')]['code']===0x1f4){logger[_0x4eca('0xf')](_0x4eca('0xc'),_0xecd238,_0xe8663a['error'][_0x4eca('0x10')]);return _0x50842e(_0xe8663a[_0x4eca('0xf')][_0x4eca('0x10')]);}logger[_0x4eca('0xf')](_0x4eca('0xc'),_0xecd238,_0xe8663a['error'][_0x4eca('0x10')]);return _0x12164c(_0xe8663a[_0x4eca('0xf')][_0x4eca('0x10')]);}else{logger[_0x4eca('0x11')](_0x4eca('0xc'),_0xecd238,'request\x20sent');_0x12164c(_0xe8663a[_0x4eca('0x12')][_0x4eca('0x10')]);}})['catch'](function(_0xac73a0){logger[_0x4eca('0xf')](_0x4eca('0xc'),_0xecd238,_0xac73a0);_0x50842e(_0xac73a0);});});}