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 _0x5d00=['then','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','AnalyticMetric,\x20%s,\x20%s','message','info','catch','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','client','http','request'];(function(_0x28c0df,_0x4ff141){var _0x210835=function(_0x3f985c){while(--_0x3f985c){_0x28c0df['push'](_0x28c0df['shift']());}};_0x210835(++_0x4ff141);}(_0x5d00,0xa2));var _0x05d0=function(_0x412342,_0x180734){_0x412342=_0x412342-0x0;var _0x3e62cb=_0x5d00[_0x412342];return _0x3e62cb;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x05d0('0x0'));var BPromise=require(_0x05d0('0x1'));var rs=require(_0x05d0('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x05d0('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x05d0('0x4'));var config=require(_0x05d0('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x05d0('0x6')][_0x05d0('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x396116,_0x3db0a8,_0x1cd536){return new BPromise(function(_0x5d5487,_0x147dca){return client[_0x05d0('0x8')](_0x396116,_0x1cd536)[_0x05d0('0x9')](function(_0x130ae9){logger['info']('AnalyticMetric,\x20%s,\x20%s',_0x3db0a8,_0x05d0('0xa'));logger[_0x05d0('0xb')](_0x05d0('0xc'),_0x3db0a8,_0x05d0('0xa'),JSON[_0x05d0('0xd')](_0x130ae9));if(_0x130ae9[_0x05d0('0xe')]){if(_0x130ae9['error']['code']===0x1f4){logger[_0x05d0('0xe')](_0x05d0('0xf'),_0x3db0a8,_0x130ae9[_0x05d0('0xe')][_0x05d0('0x10')]);return _0x147dca(_0x130ae9[_0x05d0('0xe')]['message']);}logger['error']('AnalyticMetric,\x20%s,\x20%s',_0x3db0a8,_0x130ae9[_0x05d0('0xe')][_0x05d0('0x10')]);return _0x5d5487(_0x130ae9['error']['message']);}else{logger[_0x05d0('0x11')](_0x05d0('0xf'),_0x3db0a8,_0x05d0('0xa'));_0x5d5487(_0x130ae9['result']['message']);}})[_0x05d0('0x12')](function(_0xa0af69){logger[_0x05d0('0xe')](_0x05d0('0xf'),_0x3db0a8,_0xa0af69);_0x147dca(_0xa0af69);});});}