Built motion from commit (unavailable).|2.5.24
[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 _0xb81c=['../../config/utils','rpc','http','request','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','error','code','message','result','lodash','moment','bluebird','ioredis','../../mysqldb'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xb81c,0x10b));var _0xcb81=function(_0x20e796,_0x476b50){_0x20e796=_0x20e796-0x0;var _0xe8bdf0=_0xb81c[_0x20e796];return _0xe8bdf0;};'use strict';var _=require(_0xcb81('0x0'));var util=require('util');var moment=require(_0xcb81('0x1'));var BPromise=require(_0xcb81('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcb81('0x3'));var db=require(_0xcb81('0x4'))['db'];var utils=require(_0xcb81('0x5'));var logger=require('../../config/logger')(_0xcb81('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xcb81('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1f2195,_0x17420c,_0x50a752){return new BPromise(function(_0x287d7f,_0x16f777){return client[_0xcb81('0x8')](_0x1f2195,_0x50a752)[_0xcb81('0x9')](function(_0x18e8a7){logger[_0xcb81('0xa')](_0xcb81('0xb'),_0x17420c,_0xcb81('0xc'));logger['debug']('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x17420c,_0xcb81('0xc'),JSON['stringify'](_0x18e8a7));if(_0x18e8a7[_0xcb81('0xd')]){if(_0x18e8a7[_0xcb81('0xd')][_0xcb81('0xe')]===0x1f4){logger[_0xcb81('0xd')](_0xcb81('0xb'),_0x17420c,_0x18e8a7[_0xcb81('0xd')][_0xcb81('0xf')]);return _0x16f777(_0x18e8a7[_0xcb81('0xd')][_0xcb81('0xf')]);}logger[_0xcb81('0xd')]('AnalyticMetric,\x20%s,\x20%s',_0x17420c,_0x18e8a7[_0xcb81('0xd')][_0xcb81('0xf')]);return _0x287d7f(_0x18e8a7['error'][_0xcb81('0xf')]);}else{logger[_0xcb81('0xa')](_0xcb81('0xb'),_0x17420c,'request\x20sent');_0x287d7f(_0x18e8a7[_0xcb81('0x10')][_0xcb81('0xf')]);}})['catch'](function(_0x259008){logger['error'](_0xcb81('0xb'),_0x17420c,_0x259008);_0x16f777(_0x259008);});});}