Built motion from commit (unavailable).|2.5.0
[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 _0x2051=['../../config/environment','jayson/promise','client','then','info','request\x20sent','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','code','AnalyticMetric,\x20%s,\x20%s','message','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x941b21,_0x4446b5){var _0x39d21f=function(_0x58ccac){while(--_0x58ccac){_0x941b21['push'](_0x941b21['shift']());}};_0x39d21f(++_0x4446b5);}(_0x2051,0x198));var _0x1205=function(_0x7ef0da,_0x3778f6){_0x7ef0da=_0x7ef0da-0x0;var _0x2706c7=_0x2051[_0x7ef0da];return _0x2706c7;};'use strict';var _=require('lodash');var util=require(_0x1205('0x0'));var moment=require('moment');var BPromise=require(_0x1205('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1205('0x2'));var db=require(_0x1205('0x3'))['db'];var utils=require(_0x1205('0x4'));var logger=require(_0x1205('0x5'))('rpc');var config=require(_0x1205('0x6'));var jayson=require(_0x1205('0x7'));var client=jayson[_0x1205('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x47a359,_0x1ef04f,_0xff216b){return new BPromise(function(_0x12bc93,_0x3c7d1f){return client['request'](_0x47a359,_0xff216b)[_0x1205('0x9')](function(_0x59bfee){logger[_0x1205('0xa')]('AnalyticMetric,\x20%s,\x20%s',_0x1ef04f,_0x1205('0xb'));logger['debug'](_0x1205('0xc'),_0x1ef04f,'request\x20sent',JSON[_0x1205('0xd')](_0x59bfee));if(_0x59bfee[_0x1205('0xe')]){if(_0x59bfee[_0x1205('0xe')][_0x1205('0xf')]===0x1f4){logger['error'](_0x1205('0x10'),_0x1ef04f,_0x59bfee['error'][_0x1205('0x11')]);return _0x3c7d1f(_0x59bfee[_0x1205('0xe')][_0x1205('0x11')]);}logger['error'](_0x1205('0x10'),_0x1ef04f,_0x59bfee[_0x1205('0xe')][_0x1205('0x11')]);return _0x12bc93(_0x59bfee[_0x1205('0xe')]['message']);}else{logger[_0x1205('0xa')](_0x1205('0x10'),_0x1ef04f,'request\x20sent');_0x12bc93(_0x59bfee['result'][_0x1205('0x11')]);}})['catch'](function(_0x3b2f9f){logger[_0x1205('0xe')](_0x1205('0x10'),_0x1ef04f,_0x3b2f9f);_0x3c7d1f(_0x3b2f9f);});});}