Built motion from commit (unavailable).|2.5.23
[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 _0xce4f=['../../mysqldb','../../config/utils','rpc','client','then','info','AnalyticMetric,\x20%s,\x20%s','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','code','error','message','request\x20sent','result','catch','lodash','moment','bluebird','ioredis'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xce4f,0x1c8));var _0xfce4=function(_0xa55b9,_0x132eda){_0xa55b9=_0xa55b9-0x0;var _0x44d93a=_0xce4f[_0xa55b9];return _0x44d93a;};'use strict';var _=require(_0xfce4('0x0'));var util=require('util');var moment=require(_0xfce4('0x1'));var BPromise=require(_0xfce4('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfce4('0x3'));var db=require(_0xfce4('0x4'))['db'];var utils=require(_0xfce4('0x5'));var logger=require('../../config/logger')(_0xfce4('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xfce4('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2e2ef2,_0x37b4e6,_0x9641fa){return new BPromise(function(_0x5d7771,_0x179bd5){return client['request'](_0x2e2ef2,_0x9641fa)[_0xfce4('0x8')](function(_0x330284){logger[_0xfce4('0x9')](_0xfce4('0xa'),_0x37b4e6,'request\x20sent');logger[_0xfce4('0xb')](_0xfce4('0xc'),_0x37b4e6,'request\x20sent',JSON[_0xfce4('0xd')](_0x330284));if(_0x330284['error']){if(_0x330284['error'][_0xfce4('0xe')]===0x1f4){logger[_0xfce4('0xf')]('AnalyticMetric,\x20%s,\x20%s',_0x37b4e6,_0x330284['error']['message']);return _0x179bd5(_0x330284[_0xfce4('0xf')]['message']);}logger[_0xfce4('0xf')](_0xfce4('0xa'),_0x37b4e6,_0x330284[_0xfce4('0xf')][_0xfce4('0x10')]);return _0x5d7771(_0x330284['error'][_0xfce4('0x10')]);}else{logger[_0xfce4('0x9')]('AnalyticMetric,\x20%s,\x20%s',_0x37b4e6,_0xfce4('0x11'));_0x5d7771(_0x330284[_0xfce4('0x12')][_0xfce4('0x10')]);}})[_0xfce4('0x13')](function(_0x266012){logger[_0xfce4('0xf')]('AnalyticMetric,\x20%s,\x20%s',_0x37b4e6,_0x266012);_0x179bd5(_0x266012);});});}