Built motion from commit (unavailable).|2.4.18
[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 _0xf5e1=['bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','error','code','Network,\x20%s,\x20%s','message','info','result','util','moment'];(function(_0x292f35,_0x72e859){var _0x288e75=function(_0x1bba68){while(--_0x1bba68){_0x292f35['push'](_0x292f35['shift']());}};_0x288e75(++_0x72e859);}(_0xf5e1,0x139));var _0x1f5e=function(_0x433b81,_0x58f15b){_0x433b81=_0x433b81-0x0;var _0x295221=_0xf5e1[_0x433b81];return _0x295221;};'use strict';var _=require('lodash');var util=require(_0x1f5e('0x0'));var moment=require(_0x1f5e('0x1'));var BPromise=require(_0x1f5e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1f5e('0x3'))['db'];var utils=require(_0x1f5e('0x4'));var logger=require(_0x1f5e('0x5'))(_0x1f5e('0x6'));var config=require(_0x1f5e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x1f5e('0x8')][_0x1f5e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x11e0d5,_0x1ce1f8,_0x56339f){return new BPromise(function(_0x27d1fa,_0x1ad31d){return client[_0x1f5e('0xa')](_0x11e0d5,_0x56339f)[_0x1f5e('0xb')](function(_0x306f7f){logger['info']('Network,\x20%s,\x20%s',_0x1ce1f8,_0x1f5e('0xc'));logger[_0x1f5e('0xd')](_0x1f5e('0xe'),_0x1ce1f8,_0x1f5e('0xc'),JSON['stringify'](_0x306f7f));if(_0x306f7f[_0x1f5e('0xf')]){if(_0x306f7f[_0x1f5e('0xf')][_0x1f5e('0x10')]===0x1f4){logger[_0x1f5e('0xf')](_0x1f5e('0x11'),_0x1ce1f8,_0x306f7f[_0x1f5e('0xf')][_0x1f5e('0x12')]);return _0x1ad31d(_0x306f7f[_0x1f5e('0xf')][_0x1f5e('0x12')]);}logger['error'](_0x1f5e('0x11'),_0x1ce1f8,_0x306f7f[_0x1f5e('0xf')]['message']);return _0x27d1fa(_0x306f7f[_0x1f5e('0xf')][_0x1f5e('0x12')]);}else{logger[_0x1f5e('0x13')](_0x1f5e('0x11'),_0x1ce1f8,_0x1f5e('0xc'));_0x27d1fa(_0x306f7f[_0x1f5e('0x14')][_0x1f5e('0x12')]);}})['catch'](function(_0x2e0d74){logger[_0x1f5e('0xf')](_0x1f5e('0x11'),_0x1ce1f8,_0x2e0d74);_0x1ad31d(_0x2e0d74);});});}