Built motion from commit 67e5df37.|2.0.66
[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 _0x7ebc=['util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','jayson/promise','http','request','info','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','message','Network,\x20%s,\x20%s','result','catch','lodash'];(function(_0x4671a5,_0x1db5f4){var _0x12f1ac=function(_0x3f09de){while(--_0x3f09de){_0x4671a5['push'](_0x4671a5['shift']());}};_0x12f1ac(++_0x1db5f4);}(_0x7ebc,0x117));var _0xc7eb=function(_0x5a2285,_0x3212d1){_0x5a2285=_0x5a2285-0x0;var _0x48f6ed=_0x7ebc[_0x5a2285];return _0x48f6ed;};'use strict';var _=require(_0xc7eb('0x0'));var util=require(_0xc7eb('0x1'));var moment=require(_0xc7eb('0x2'));var BPromise=require(_0xc7eb('0x3'));var rs=require(_0xc7eb('0x4'));var fs=require('fs');var db=require(_0xc7eb('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc7eb('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xc7eb('0x7'));var client=jayson['client'][_0xc7eb('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3a8031,_0x133db7,_0x534c37){return new BPromise(function(_0x341388,_0x383328){return client[_0xc7eb('0x9')](_0x3a8031,_0x534c37)['then'](function(_0x396f46){logger[_0xc7eb('0xa')]('Network,\x20%s,\x20%s',_0x133db7,_0xc7eb('0xb'));logger[_0xc7eb('0xc')](_0xc7eb('0xd'),_0x133db7,_0xc7eb('0xb'),JSON[_0xc7eb('0xe')](_0x396f46));if(_0x396f46[_0xc7eb('0xf')]){if(_0x396f46[_0xc7eb('0xf')]['code']===0x1f4){logger['error']('Network,\x20%s,\x20%s',_0x133db7,_0x396f46[_0xc7eb('0xf')]['message']);return _0x383328(_0x396f46[_0xc7eb('0xf')][_0xc7eb('0x10')]);}logger[_0xc7eb('0xf')](_0xc7eb('0x11'),_0x133db7,_0x396f46[_0xc7eb('0xf')][_0xc7eb('0x10')]);return _0x341388(_0x396f46['error'][_0xc7eb('0x10')]);}else{logger[_0xc7eb('0xa')](_0xc7eb('0x11'),_0x133db7,_0xc7eb('0xb'));_0x341388(_0x396f46[_0xc7eb('0x12')][_0xc7eb('0x10')]);}})[_0xc7eb('0x13')](function(_0x35e2fc){logger[_0xc7eb('0xf')](_0xc7eb('0x11'),_0x133db7,_0x35e2fc);_0x383328(_0x35e2fc);});});}