Built motion from commit 9d1906d1.|2.5.40
[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 _0x1bb7=['then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x12fde3,_0x4800c6){var _0x521038=function(_0x2ea066){while(--_0x2ea066){_0x12fde3['push'](_0x12fde3['shift']());}};_0x521038(++_0x4800c6);}(_0x1bb7,0x1ee));var _0x71bb=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x1bb7[_0x413feb];return _0x40ee88;};'use strict';var _=require(_0x71bb('0x0'));var util=require(_0x71bb('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x71bb('0x2'));var fs=require('fs');var Redis=require(_0x71bb('0x3'));var db=require(_0x71bb('0x4'))['db'];var utils=require(_0x71bb('0x5'));var logger=require(_0x71bb('0x6'))(_0x71bb('0x7'));var config=require(_0x71bb('0x8'));var jayson=require(_0x71bb('0x9'));var client=jayson[_0x71bb('0xa')][_0x71bb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x591178,_0xcb3e54,_0x498ec0){return new BPromise(function(_0x2ad5e1,_0x36ca0e){return client['request'](_0x591178,_0x498ec0)[_0x71bb('0xc')](function(_0xe53b16){logger[_0x71bb('0xd')](_0x71bb('0xe'),_0xcb3e54,_0x71bb('0xf'));logger['debug'](_0x71bb('0x10'),_0xcb3e54,_0x71bb('0xf'),JSON[_0x71bb('0x11')](_0xe53b16));if(_0xe53b16[_0x71bb('0x12')]){if(_0xe53b16[_0x71bb('0x12')][_0x71bb('0x13')]===0x1f4){logger[_0x71bb('0x12')]('AnalyticMetric,\x20%s,\x20%s',_0xcb3e54,_0xe53b16[_0x71bb('0x12')][_0x71bb('0x14')]);return _0x36ca0e(_0xe53b16[_0x71bb('0x12')]['message']);}logger[_0x71bb('0x12')](_0x71bb('0xe'),_0xcb3e54,_0xe53b16[_0x71bb('0x12')]['message']);return _0x2ad5e1(_0xe53b16[_0x71bb('0x12')][_0x71bb('0x14')]);}else{logger[_0x71bb('0xd')](_0x71bb('0xe'),_0xcb3e54,'request\x20sent');_0x2ad5e1(_0xe53b16[_0x71bb('0x15')]['message']);}})[_0x71bb('0x16')](function(_0x498115){logger[_0x71bb('0x12')]('AnalyticMetric,\x20%s,\x20%s',_0xcb3e54,_0x498115);_0x36ca0e(_0x498115);});});}