9fa72f1419d1aec9548cd29a7510d0ffe767dd8a
[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 _0x8fc5=['then','info','Network,\x20%s,\x20%s','debug','Network,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request'];(function(_0x4c4224,_0xbf6a24){var _0x2b7205=function(_0x5b1f7d){while(--_0x5b1f7d){_0x4c4224['push'](_0x4c4224['shift']());}};_0x2b7205(++_0xbf6a24);}(_0x8fc5,0x109));var _0x58fc=function(_0x9e002b,_0x1640ad){_0x9e002b=_0x9e002b-0x0;var _0x377d8b=_0x8fc5[_0x9e002b];return _0x377d8b;};'use strict';var _=require('lodash');var util=require(_0x58fc('0x0'));var moment=require(_0x58fc('0x1'));var BPromise=require(_0x58fc('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x58fc('0x3'));var db=require(_0x58fc('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x58fc('0x5'))(_0x58fc('0x6'));var config=require(_0x58fc('0x7'));var jayson=require(_0x58fc('0x8'));var client=jayson[_0x58fc('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x23f8d2,_0x1d2c6a,_0x4ea268){return new BPromise(function(_0xb8f039,_0x2797a2){return client[_0x58fc('0xa')](_0x23f8d2,_0x4ea268)[_0x58fc('0xb')](function(_0x5d8c53){logger[_0x58fc('0xc')](_0x58fc('0xd'),_0x1d2c6a,'request\x20sent');logger[_0x58fc('0xe')](_0x58fc('0xf'),_0x1d2c6a,_0x58fc('0x10'),JSON[_0x58fc('0x11')](_0x5d8c53));if(_0x5d8c53[_0x58fc('0x12')]){if(_0x5d8c53[_0x58fc('0x12')][_0x58fc('0x13')]===0x1f4){logger[_0x58fc('0x12')](_0x58fc('0xd'),_0x1d2c6a,_0x5d8c53[_0x58fc('0x12')][_0x58fc('0x14')]);return _0x2797a2(_0x5d8c53[_0x58fc('0x12')][_0x58fc('0x14')]);}logger[_0x58fc('0x12')]('Network,\x20%s,\x20%s',_0x1d2c6a,_0x5d8c53[_0x58fc('0x12')]['message']);return _0xb8f039(_0x5d8c53['error'][_0x58fc('0x14')]);}else{logger[_0x58fc('0xc')]('Network,\x20%s,\x20%s',_0x1d2c6a,_0x58fc('0x10'));_0xb8f039(_0x5d8c53[_0x58fc('0x15')]['message']);}})[_0x58fc('0x16')](function(_0x4882a1){logger[_0x58fc('0x12')](_0x58fc('0xd'),_0x1d2c6a,_0x4882a1);_0x2797a2(_0x4882a1);});});}