f9b36fe57950904603ece8e1785b068351dc0354
[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 _0xfc1b=['info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x3680d4,_0x2ccdc3){var _0x3ecefb=function(_0x41cfae){while(--_0x41cfae){_0x3680d4['push'](_0x3680d4['shift']());}};_0x3ecefb(++_0x2ccdc3);}(_0xfc1b,0xb3));var _0xbfc1=function(_0x2bc456,_0x437b38){_0x2bc456=_0x2bc456-0x0;var _0x2da9fd=_0xfc1b[_0x2bc456];return _0x2da9fd;};'use strict';var _=require(_0xbfc1('0x0'));var util=require(_0xbfc1('0x1'));var moment=require(_0xbfc1('0x2'));var BPromise=require(_0xbfc1('0x3'));var rs=require(_0xbfc1('0x4'));var fs=require('fs');var Redis=require(_0xbfc1('0x5'));var db=require(_0xbfc1('0x6'))['db'];var utils=require(_0xbfc1('0x7'));var logger=require(_0xbfc1('0x8'))(_0xbfc1('0x9'));var config=require(_0xbfc1('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xbfc1('0xb')][_0xbfc1('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x128dc7,_0x3a7058,_0x28aa86){return new BPromise(function(_0x1eda05,_0x3e439a){return client['request'](_0x128dc7,_0x28aa86)['then'](function(_0x133f8a){logger[_0xbfc1('0xd')](_0xbfc1('0xe'),_0x3a7058,_0xbfc1('0xf'));logger[_0xbfc1('0x10')](_0xbfc1('0x11'),_0x3a7058,_0xbfc1('0xf'),JSON[_0xbfc1('0x12')](_0x133f8a));if(_0x133f8a[_0xbfc1('0x13')]){if(_0x133f8a['error'][_0xbfc1('0x14')]===0x1f4){logger[_0xbfc1('0x13')]('AnalyticMetric,\x20%s,\x20%s',_0x3a7058,_0x133f8a[_0xbfc1('0x13')][_0xbfc1('0x15')]);return _0x3e439a(_0x133f8a[_0xbfc1('0x13')][_0xbfc1('0x15')]);}logger[_0xbfc1('0x13')](_0xbfc1('0xe'),_0x3a7058,_0x133f8a[_0xbfc1('0x13')][_0xbfc1('0x15')]);return _0x1eda05(_0x133f8a[_0xbfc1('0x13')][_0xbfc1('0x15')]);}else{logger['info'](_0xbfc1('0xe'),_0x3a7058,_0xbfc1('0xf'));_0x1eda05(_0x133f8a[_0xbfc1('0x16')][_0xbfc1('0x15')]);}})[_0xbfc1('0x17')](function(_0x5bdf07){logger['error'](_0xbfc1('0xe'),_0x3a7058,_0x5bdf07);_0x3e439a(_0x5bdf07);});});}