Built motion from commit (unavailable).|2.5.14
[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 _0x1653=['stringify','error','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','request','Network,\x20%s,\x20%s','request\x20sent','Network,\x20%s,\x20%s,\x20%s'];(function(_0x5530ea,_0x2488e3){var _0x4a230b=function(_0x4ca128){while(--_0x4ca128){_0x5530ea['push'](_0x5530ea['shift']());}};_0x4a230b(++_0x2488e3);}(_0x1653,0xad));var _0x3165=function(_0x1a9e78,_0x180720){_0x1a9e78=_0x1a9e78-0x0;var _0x113e06=_0x1653[_0x1a9e78];return _0x113e06;};'use strict';var _=require(_0x3165('0x0'));var util=require(_0x3165('0x1'));var moment=require(_0x3165('0x2'));var BPromise=require(_0x3165('0x3'));var rs=require(_0x3165('0x4'));var fs=require('fs');var Redis=require(_0x3165('0x5'));var db=require(_0x3165('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x3165('0x7'));var config=require(_0x3165('0x8'));var jayson=require(_0x3165('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x690289,_0x566ad6,_0x20141f){return new BPromise(function(_0x57330b,_0xb9e097){return client[_0x3165('0xa')](_0x690289,_0x20141f)['then'](function(_0x115d3e){logger['info'](_0x3165('0xb'),_0x566ad6,_0x3165('0xc'));logger['debug'](_0x3165('0xd'),_0x566ad6,_0x3165('0xc'),JSON[_0x3165('0xe')](_0x115d3e));if(_0x115d3e[_0x3165('0xf')]){if(_0x115d3e[_0x3165('0xf')]['code']===0x1f4){logger['error'](_0x3165('0xb'),_0x566ad6,_0x115d3e[_0x3165('0xf')][_0x3165('0x10')]);return _0xb9e097(_0x115d3e['error'][_0x3165('0x10')]);}logger[_0x3165('0xf')](_0x3165('0xb'),_0x566ad6,_0x115d3e[_0x3165('0xf')]['message']);return _0x57330b(_0x115d3e['error'][_0x3165('0x10')]);}else{logger['info']('Network,\x20%s,\x20%s',_0x566ad6,_0x3165('0xc'));_0x57330b(_0x115d3e['result'][_0x3165('0x10')]);}})['catch'](function(_0x41c690){logger[_0x3165('0xf')](_0x3165('0xb'),_0x566ad6,_0x41c690);_0xb9e097(_0x41c690);});});}