Built motion from commit (unavailable).|2.5.8
[motion2.git] / server / api / network / network.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 _0xa26e=['request','then','info','request\x20sent','debug','stringify','error','Network,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','ioredis','../../config/logger','../../config/environment','client'];(function(_0x469c70,_0x4ce7fe){var _0x4e342f=function(_0x42ae50){while(--_0x42ae50){_0x469c70['push'](_0x469c70['shift']());}};_0x4e342f(++_0x4ce7fe);}(_0xa26e,0x14e));var _0xea26=function(_0x2d6a2c,_0x34fa96){_0x2d6a2c=_0x2d6a2c-0x0;var _0x153e9c=_0xa26e[_0x2d6a2c];return _0x153e9c;};'use strict';var _=require(_0xea26('0x0'));var util=require(_0xea26('0x1'));var moment=require(_0xea26('0x2'));var BPromise=require('bluebird');var rs=require(_0xea26('0x3'));var fs=require('fs');var Redis=require(_0xea26('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xea26('0x5'))('rpc');var config=require(_0xea26('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xea26('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0xaad2d7,_0x112f8d,_0xbd037f){return new BPromise(function(_0x4f442f,_0x448c71){return client[_0xea26('0x8')](_0xaad2d7,_0xbd037f)[_0xea26('0x9')](function(_0x3818cb){logger[_0xea26('0xa')]('Network,\x20%s,\x20%s',_0x112f8d,_0xea26('0xb'));logger[_0xea26('0xc')]('Network,\x20%s,\x20%s,\x20%s',_0x112f8d,_0xea26('0xb'),JSON[_0xea26('0xd')](_0x3818cb));if(_0x3818cb['error']){if(_0x3818cb['error']['code']===0x1f4){logger[_0xea26('0xe')](_0xea26('0xf'),_0x112f8d,_0x3818cb[_0xea26('0xe')][_0xea26('0x10')]);return _0x448c71(_0x3818cb[_0xea26('0xe')]['message']);}logger[_0xea26('0xe')](_0xea26('0xf'),_0x112f8d,_0x3818cb[_0xea26('0xe')][_0xea26('0x10')]);return _0x4f442f(_0x3818cb[_0xea26('0xe')]['message']);}else{logger[_0xea26('0xa')]('Network,\x20%s,\x20%s',_0x112f8d,_0xea26('0xb'));_0x4f442f(_0x3818cb[_0xea26('0x11')]['message']);}})[_0xea26('0x12')](function(_0x26d3a0){logger['error'](_0xea26('0xf'),_0x112f8d,_0x26d3a0);_0x448c71(_0x26d3a0);});});}