Built motion from commit f0b1811d.|2.6.6
[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 _0x8359=['http','request','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','code','error','message','catch','lodash','bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x8359,0x1ae));var _0x9835=function(_0x45806b,_0x53eeae){_0x45806b=_0x45806b-0x0;var _0x3e228e=_0x8359[_0x45806b];return _0x3e228e;};'use strict';var _=require(_0x9835('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x9835('0x1'));var rs=require(_0x9835('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x9835('0x3'))(_0x9835('0x4'));var config=require(_0x9835('0x5'));var jayson=require(_0x9835('0x6'));var client=jayson['client'][_0x9835('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5e7e06,_0x2fd687,_0xb8f73){return new BPromise(function(_0xbe185e,_0x4111fd){return client[_0x9835('0x8')](_0x5e7e06,_0xb8f73)[_0x9835('0x9')](function(_0x472d17){logger[_0x9835('0xa')](_0x9835('0xb'),_0x2fd687,_0x9835('0xc'));logger[_0x9835('0xd')](_0x9835('0xe'),_0x2fd687,'request\x20sent',JSON['stringify'](_0x472d17));if(_0x472d17['error']){if(_0x472d17['error'][_0x9835('0xf')]===0x1f4){logger[_0x9835('0x10')](_0x9835('0xb'),_0x2fd687,_0x472d17[_0x9835('0x10')][_0x9835('0x11')]);return _0x4111fd(_0x472d17[_0x9835('0x10')][_0x9835('0x11')]);}logger[_0x9835('0x10')](_0x9835('0xb'),_0x2fd687,_0x472d17[_0x9835('0x10')][_0x9835('0x11')]);return _0xbe185e(_0x472d17['error'][_0x9835('0x11')]);}else{logger['info']('AnalyticMetric,\x20%s,\x20%s',_0x2fd687,'request\x20sent');_0xbe185e(_0x472d17['result'][_0x9835('0x11')]);}})[_0x9835('0x12')](function(_0x1875b3){logger[_0x9835('0x10')](_0x9835('0xb'),_0x2fd687,_0x1875b3);_0x4111fd(_0x1875b3);});});}