Built motion from commit 06eb8eb0.|2.6.31
[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 _0xa587=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','code','AnalyticMetric,\x20%s,\x20%s','message','result','catch','bluebird','ioredis'];(function(_0x27538b,_0x47639d){var _0x4a0938=function(_0x10fdf5){while(--_0x10fdf5){_0x27538b['push'](_0x27538b['shift']());}};_0x4a0938(++_0x47639d);}(_0xa587,0xc4));var _0x7a58=function(_0x153268,_0x10fb17){_0x153268=_0x153268-0x0;var _0x120f98=_0xa587[_0x153268];return _0x120f98;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x7a58('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7a58('0x1'));var db=require(_0x7a58('0x2'))['db'];var utils=require(_0x7a58('0x3'));var logger=require(_0x7a58('0x4'))(_0x7a58('0x5'));var config=require(_0x7a58('0x6'));var jayson=require(_0x7a58('0x7'));var client=jayson['client'][_0x7a58('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x20f207,_0x3c0992,_0x2e91b9){return new BPromise(function(_0x40d384,_0x5d6bb4){return client[_0x7a58('0x9')](_0x20f207,_0x2e91b9)[_0x7a58('0xa')](function(_0x4aad23){logger[_0x7a58('0xb')]('AnalyticMetric,\x20%s,\x20%s',_0x3c0992,_0x7a58('0xc'));logger[_0x7a58('0xd')](_0x7a58('0xe'),_0x3c0992,'request\x20sent',JSON[_0x7a58('0xf')](_0x4aad23));if(_0x4aad23[_0x7a58('0x10')]){if(_0x4aad23[_0x7a58('0x10')][_0x7a58('0x11')]===0x1f4){logger['error'](_0x7a58('0x12'),_0x3c0992,_0x4aad23[_0x7a58('0x10')]['message']);return _0x5d6bb4(_0x4aad23['error'][_0x7a58('0x13')]);}logger[_0x7a58('0x10')](_0x7a58('0x12'),_0x3c0992,_0x4aad23[_0x7a58('0x10')][_0x7a58('0x13')]);return _0x40d384(_0x4aad23[_0x7a58('0x10')][_0x7a58('0x13')]);}else{logger[_0x7a58('0xb')]('AnalyticMetric,\x20%s,\x20%s',_0x3c0992,_0x7a58('0xc'));_0x40d384(_0x4aad23[_0x7a58('0x14')]['message']);}})[_0x7a58('0x15')](function(_0x2d8f61){logger['error'](_0x7a58('0x12'),_0x3c0992,_0x2d8f61);_0x5d6bb4(_0x2d8f61);});});}