04e6cbd112928276af041c09a8a308daff1843b8
[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 _0x5ec4=['result','catch','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','Network,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x24f31b,_0x44b8f3){var _0x488401=function(_0x204caf){while(--_0x204caf){_0x24f31b['push'](_0x24f31b['shift']());}};_0x488401(++_0x44b8f3);}(_0x5ec4,0x145));var _0x45ec=function(_0xf6459e,_0x46ce62){_0xf6459e=_0xf6459e-0x0;var _0x5d4dc2=_0x5ec4[_0xf6459e];return _0x5d4dc2;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x45ec('0x0'));var rs=require(_0x45ec('0x1'));var fs=require('fs');var Redis=require(_0x45ec('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x45ec('0x3'));var logger=require(_0x45ec('0x4'))(_0x45ec('0x5'));var config=require(_0x45ec('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x45ec('0x7')][_0x45ec('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x230aae,_0x3bfcc4,_0x125e9f){return new BPromise(function(_0x274b39,_0x1a70e9){return client['request'](_0x230aae,_0x125e9f)[_0x45ec('0x9')](function(_0x5606af){logger['info'](_0x45ec('0xa'),_0x3bfcc4,_0x45ec('0xb'));logger[_0x45ec('0xc')]('Network,\x20%s,\x20%s,\x20%s',_0x3bfcc4,_0x45ec('0xb'),JSON[_0x45ec('0xd')](_0x5606af));if(_0x5606af['error']){if(_0x5606af[_0x45ec('0xe')][_0x45ec('0xf')]===0x1f4){logger[_0x45ec('0xe')](_0x45ec('0xa'),_0x3bfcc4,_0x5606af[_0x45ec('0xe')][_0x45ec('0x10')]);return _0x1a70e9(_0x5606af[_0x45ec('0xe')][_0x45ec('0x10')]);}logger['error'](_0x45ec('0xa'),_0x3bfcc4,_0x5606af[_0x45ec('0xe')][_0x45ec('0x10')]);return _0x274b39(_0x5606af[_0x45ec('0xe')][_0x45ec('0x10')]);}else{logger['info'](_0x45ec('0xa'),_0x3bfcc4,_0x45ec('0xb'));_0x274b39(_0x5606af[_0x45ec('0x11')][_0x45ec('0x10')]);}})[_0x45ec('0x12')](function(_0x923bc1){logger['error'](_0x45ec('0xa'),_0x3bfcc4,_0x923bc1);_0x1a70e9(_0x923bc1);});});}