Built motion from commit b5413ace.|2.6.9
[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 _0xdc36=['jayson/promise','client','http','request','then','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdc36,0x17e));var _0x6dc3=function(_0x10b2d5,_0x5a7743){_0x10b2d5=_0x10b2d5-0x0;var _0x14b8d1=_0xdc36[_0x10b2d5];return _0x14b8d1;};'use strict';var _=require(_0x6dc3('0x0'));var util=require('util');var moment=require(_0x6dc3('0x1'));var BPromise=require('bluebird');var rs=require(_0x6dc3('0x2'));var fs=require('fs');var Redis=require(_0x6dc3('0x3'));var db=require(_0x6dc3('0x4'))['db'];var utils=require(_0x6dc3('0x5'));var logger=require(_0x6dc3('0x6'))(_0x6dc3('0x7'));var config=require(_0x6dc3('0x8'));var jayson=require(_0x6dc3('0x9'));var client=jayson[_0x6dc3('0xa')][_0x6dc3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x7b27ce,_0xef266e,_0x48558a){return new BPromise(function(_0x239031,_0x126df7){return client[_0x6dc3('0xc')](_0x7b27ce,_0x48558a)[_0x6dc3('0xd')](function(_0x965dc2){logger['info'](_0x6dc3('0xe'),_0xef266e,_0x6dc3('0xf'));logger[_0x6dc3('0x10')]('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0xef266e,_0x6dc3('0xf'),JSON[_0x6dc3('0x11')](_0x965dc2));if(_0x965dc2[_0x6dc3('0x12')]){if(_0x965dc2[_0x6dc3('0x12')][_0x6dc3('0x13')]===0x1f4){logger['error'](_0x6dc3('0xe'),_0xef266e,_0x965dc2[_0x6dc3('0x12')][_0x6dc3('0x14')]);return _0x126df7(_0x965dc2[_0x6dc3('0x12')][_0x6dc3('0x14')]);}logger[_0x6dc3('0x12')](_0x6dc3('0xe'),_0xef266e,_0x965dc2[_0x6dc3('0x12')]['message']);return _0x239031(_0x965dc2['error'][_0x6dc3('0x14')]);}else{logger['info'](_0x6dc3('0xe'),_0xef266e,'request\x20sent');_0x239031(_0x965dc2[_0x6dc3('0x15')][_0x6dc3('0x14')]);}})[_0x6dc3('0x16')](function(_0x5ac6eb){logger[_0x6dc3('0x12')]('AnalyticMetric,\x20%s,\x20%s',_0xef266e,_0x5ac6eb);_0x126df7(_0x5ac6eb);});});}