Built motion from commit (unavailable).|2.5.15
[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 _0x4330=['../../config/environment','jayson/promise','http','then','info','Network,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x4e68aa,_0x77632d){var _0xfe0a56=function(_0xd7b460){while(--_0xd7b460){_0x4e68aa['push'](_0x4e68aa['shift']());}};_0xfe0a56(++_0x77632d);}(_0x4330,0x125));var _0x0433=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x4330[_0x397e5f];return _0x5302b8;};'use strict';var _=require('lodash');var util=require(_0x0433('0x0'));var moment=require(_0x0433('0x1'));var BPromise=require('bluebird');var rs=require(_0x0433('0x2'));var fs=require('fs');var Redis=require(_0x0433('0x3'));var db=require(_0x0433('0x4'))['db'];var utils=require(_0x0433('0x5'));var logger=require(_0x0433('0x6'))('rpc');var config=require(_0x0433('0x7'));var jayson=require(_0x0433('0x8'));var client=jayson['client'][_0x0433('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2b34a7,_0x43723f,_0x5d1bda){return new BPromise(function(_0x1e874d,_0x17cfc8){return client['request'](_0x2b34a7,_0x5d1bda)[_0x0433('0xa')](function(_0x348a61){logger[_0x0433('0xb')](_0x0433('0xc'),_0x43723f,'request\x20sent');logger[_0x0433('0xd')]('Network,\x20%s,\x20%s,\x20%s',_0x43723f,_0x0433('0xe'),JSON[_0x0433('0xf')](_0x348a61));if(_0x348a61[_0x0433('0x10')]){if(_0x348a61['error']['code']===0x1f4){logger[_0x0433('0x10')]('Network,\x20%s,\x20%s',_0x43723f,_0x348a61[_0x0433('0x10')][_0x0433('0x11')]);return _0x17cfc8(_0x348a61['error']['message']);}logger['error']('Network,\x20%s,\x20%s',_0x43723f,_0x348a61[_0x0433('0x10')][_0x0433('0x11')]);return _0x1e874d(_0x348a61['error'][_0x0433('0x11')]);}else{logger['info'](_0x0433('0xc'),_0x43723f,_0x0433('0xe'));_0x1e874d(_0x348a61[_0x0433('0x12')]['message']);}})[_0x0433('0x13')](function(_0x19e7f3){logger[_0x0433('0x10')]('Network,\x20%s,\x20%s',_0x43723f,_0x19e7f3);_0x17cfc8(_0x19e7f3);});});}