Built motion from commit (unavailable).|2.5.12
[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 _0x6e4d=['../../config/logger','../../config/environment','client','http','request','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','../../config/utils'];(function(_0x5d5560,_0x5f5def){var _0x2cac59=function(_0x4968f1){while(--_0x4968f1){_0x5d5560['push'](_0x5d5560['shift']());}};_0x2cac59(++_0x5f5def);}(_0x6e4d,0x96));var _0xd6e4=function(_0x34f6ed,_0x2fd82f){_0x34f6ed=_0x34f6ed-0x0;var _0xb904c9=_0x6e4d[_0x34f6ed];return _0xb904c9;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd6e4('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xd6e4('0x1'));var logger=require(_0xd6e4('0x2'))('rpc');var config=require(_0xd6e4('0x3'));var jayson=require('jayson/promise');var client=jayson[_0xd6e4('0x4')][_0xd6e4('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x27beac,_0x46f4a2,_0x2600c3){return new BPromise(function(_0x59dc69,_0x3807a3){return client[_0xd6e4('0x6')](_0x27beac,_0x2600c3)[_0xd6e4('0x7')](function(_0x182c58){logger[_0xd6e4('0x8')](_0xd6e4('0x9'),_0x46f4a2,_0xd6e4('0xa'));logger[_0xd6e4('0xb')](_0xd6e4('0xc'),_0x46f4a2,_0xd6e4('0xa'),JSON[_0xd6e4('0xd')](_0x182c58));if(_0x182c58[_0xd6e4('0xe')]){if(_0x182c58['error'][_0xd6e4('0xf')]===0x1f4){logger['error'](_0xd6e4('0x9'),_0x46f4a2,_0x182c58[_0xd6e4('0xe')][_0xd6e4('0x10')]);return _0x3807a3(_0x182c58[_0xd6e4('0xe')][_0xd6e4('0x10')]);}logger['error'](_0xd6e4('0x9'),_0x46f4a2,_0x182c58['error'][_0xd6e4('0x10')]);return _0x59dc69(_0x182c58[_0xd6e4('0xe')][_0xd6e4('0x10')]);}else{logger[_0xd6e4('0x8')](_0xd6e4('0x9'),_0x46f4a2,_0xd6e4('0xa'));_0x59dc69(_0x182c58[_0xd6e4('0x11')]['message']);}})[_0xd6e4('0x12')](function(_0x4639ec){logger['error'](_0xd6e4('0x9'),_0x46f4a2,_0x4639ec);_0x3807a3(_0x4639ec);});});}