Built motion from commit (unavailable).|2.3.96
[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 _0x2137=['code','AnalyticMetric,\x20%s,\x20%s','message','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','http','request','info','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x14ddd4,_0x5b527d){var _0x421616=function(_0x4f0a42){while(--_0x4f0a42){_0x14ddd4['push'](_0x14ddd4['shift']());}};_0x421616(++_0x5b527d);}(_0x2137,0x134));var _0x7213=function(_0x4a2cc2,_0x1fbafa){_0x4a2cc2=_0x4a2cc2-0x0;var _0x3f5f5c=_0x2137[_0x4a2cc2];return _0x3f5f5c;};'use strict';var _=require(_0x7213('0x0'));var util=require(_0x7213('0x1'));var moment=require(_0x7213('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7213('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x7213('0x4'));var logger=require(_0x7213('0x5'))(_0x7213('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x7213('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3aa8a3,_0x485886,_0x2cd831){return new BPromise(function(_0x2ad93f,_0x5a87cf){return client[_0x7213('0x8')](_0x3aa8a3,_0x2cd831)['then'](function(_0x5acb92){logger[_0x7213('0x9')]('AnalyticMetric,\x20%s,\x20%s',_0x485886,_0x7213('0xa'));logger[_0x7213('0xb')](_0x7213('0xc'),_0x485886,_0x7213('0xa'),JSON[_0x7213('0xd')](_0x5acb92));if(_0x5acb92[_0x7213('0xe')]){if(_0x5acb92[_0x7213('0xe')][_0x7213('0xf')]===0x1f4){logger[_0x7213('0xe')](_0x7213('0x10'),_0x485886,_0x5acb92['error'][_0x7213('0x11')]);return _0x5a87cf(_0x5acb92[_0x7213('0xe')][_0x7213('0x11')]);}logger[_0x7213('0xe')](_0x7213('0x10'),_0x485886,_0x5acb92[_0x7213('0xe')][_0x7213('0x11')]);return _0x2ad93f(_0x5acb92[_0x7213('0xe')][_0x7213('0x11')]);}else{logger[_0x7213('0x9')](_0x7213('0x10'),_0x485886,_0x7213('0xa'));_0x2ad93f(_0x5acb92['result'][_0x7213('0x11')]);}})[_0x7213('0x12')](function(_0x90151a){logger[_0x7213('0xe')](_0x7213('0x10'),_0x485886,_0x90151a);_0x5a87cf(_0x90151a);});});}