Built motion from commit da617fac.|2.6.6
[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 _0x738b=['debug','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent'];(function(_0x2defb5,_0x1cda14){var _0x229c53=function(_0x5dd408){while(--_0x5dd408){_0x2defb5['push'](_0x2defb5['shift']());}};_0x229c53(++_0x1cda14);}(_0x738b,0x79));var _0xb738=function(_0x3318be,_0x1c7bcd){_0x3318be=_0x3318be-0x0;var _0x1229e4=_0x738b[_0x3318be];return _0x1229e4;};'use strict';var _=require(_0xb738('0x0'));var util=require(_0xb738('0x1'));var moment=require(_0xb738('0x2'));var BPromise=require(_0xb738('0x3'));var rs=require(_0xb738('0x4'));var fs=require('fs');var Redis=require(_0xb738('0x5'));var db=require(_0xb738('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xb738('0x7'))(_0xb738('0x8'));var config=require(_0xb738('0x9'));var jayson=require(_0xb738('0xa'));var client=jayson[_0xb738('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1bace8,_0x4bd31d,_0x22abd0){return new BPromise(function(_0x4a4e68,_0x480266){return client[_0xb738('0xc')](_0x1bace8,_0x22abd0)[_0xb738('0xd')](function(_0x5b8d47){logger[_0xb738('0xe')](_0xb738('0xf'),_0x4bd31d,_0xb738('0x10'));logger[_0xb738('0x11')]('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x4bd31d,'request\x20sent',JSON[_0xb738('0x12')](_0x5b8d47));if(_0x5b8d47[_0xb738('0x13')]){if(_0x5b8d47['error'][_0xb738('0x14')]===0x1f4){logger[_0xb738('0x13')](_0xb738('0xf'),_0x4bd31d,_0x5b8d47[_0xb738('0x13')][_0xb738('0x15')]);return _0x480266(_0x5b8d47[_0xb738('0x13')][_0xb738('0x15')]);}logger[_0xb738('0x13')](_0xb738('0xf'),_0x4bd31d,_0x5b8d47[_0xb738('0x13')][_0xb738('0x15')]);return _0x4a4e68(_0x5b8d47['error'][_0xb738('0x15')]);}else{logger[_0xb738('0xe')]('AnalyticMetric,\x20%s,\x20%s',_0x4bd31d,_0xb738('0x10'));_0x4a4e68(_0x5b8d47[_0xb738('0x16')]['message']);}})['catch'](function(_0x425033){logger[_0xb738('0x13')](_0xb738('0xf'),_0x4bd31d,_0x425033);_0x480266(_0x425033);});});}