f3850a2c24866fadef382980cb7c8ec6c27c98be
[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 _0xe87d=['stringify','error','message','info','result','catch','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then','AnalyticMetric,\x20%s,\x20%s','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x55e08b,_0x421620){var _0xd1a7ff=function(_0x58c7ff){while(--_0x58c7ff){_0x55e08b['push'](_0x55e08b['shift']());}};_0xd1a7ff(++_0x421620);}(_0xe87d,0x182));var _0xde87=function(_0x2335c5,_0x2734b4){_0x2335c5=_0x2335c5-0x0;var _0x1e7618=_0xe87d[_0x2335c5];return _0x1e7618;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xde87('0x0'));var BPromise=require(_0xde87('0x1'));var rs=require(_0xde87('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xde87('0x3'))['db'];var utils=require(_0xde87('0x4'));var logger=require(_0xde87('0x5'))('rpc');var config=require(_0xde87('0x6'));var jayson=require(_0xde87('0x7'));var client=jayson['client'][_0xde87('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x123aa2,_0x1d1dc6,_0x201af9){return new BPromise(function(_0xa418ac,_0x4e6533){return client['request'](_0x123aa2,_0x201af9)[_0xde87('0x9')](function(_0x4b5b97){logger['info'](_0xde87('0xa'),_0x1d1dc6,'request\x20sent');logger[_0xde87('0xb')](_0xde87('0xc'),_0x1d1dc6,_0xde87('0xd'),JSON[_0xde87('0xe')](_0x4b5b97));if(_0x4b5b97['error']){if(_0x4b5b97['error']['code']===0x1f4){logger['error'](_0xde87('0xa'),_0x1d1dc6,_0x4b5b97[_0xde87('0xf')][_0xde87('0x10')]);return _0x4e6533(_0x4b5b97[_0xde87('0xf')]['message']);}logger[_0xde87('0xf')]('AnalyticMetric,\x20%s,\x20%s',_0x1d1dc6,_0x4b5b97['error'][_0xde87('0x10')]);return _0xa418ac(_0x4b5b97[_0xde87('0xf')][_0xde87('0x10')]);}else{logger[_0xde87('0x11')]('AnalyticMetric,\x20%s,\x20%s',_0x1d1dc6,_0xde87('0xd'));_0xa418ac(_0x4b5b97[_0xde87('0x12')][_0xde87('0x10')]);}})[_0xde87('0x13')](function(_0x345aca){logger[_0xde87('0xf')](_0xde87('0xa'),_0x1d1dc6,_0x345aca);_0x4e6533(_0x345aca);});});}