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 _0x521c=['error','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','Network,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x28e0ab,_0x48a7e9){var _0x53cad1=function(_0x208ef2){while(--_0x208ef2){_0x28e0ab['push'](_0x28e0ab['shift']());}};_0x53cad1(++_0x48a7e9);}(_0x521c,0xb6));var _0xc521=function(_0x34a512,_0x4af833){_0x34a512=_0x34a512-0x0;var _0x53e413=_0x521c[_0x34a512];return _0x53e413;};'use strict';var _=require(_0xc521('0x0'));var util=require(_0xc521('0x1'));var moment=require(_0xc521('0x2'));var BPromise=require(_0xc521('0x3'));var rs=require(_0xc521('0x4'));var fs=require('fs');var Redis=require(_0xc521('0x5'));var db=require(_0xc521('0x6'))['db'];var utils=require(_0xc521('0x7'));var logger=require(_0xc521('0x8'))(_0xc521('0x9'));var config=require(_0xc521('0xa'));var jayson=require(_0xc521('0xb'));var client=jayson[_0xc521('0xc')][_0xc521('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x4650f6,_0x2a0396,_0x4d3f7a){return new BPromise(function(_0x52842a,_0x297d54){return client['request'](_0x4650f6,_0x4d3f7a)[_0xc521('0xe')](function(_0x23960e){logger['info'](_0xc521('0xf'),_0x2a0396,_0xc521('0x10'));logger[_0xc521('0x11')]('Network,\x20%s,\x20%s,\x20%s',_0x2a0396,_0xc521('0x10'),JSON['stringify'](_0x23960e));if(_0x23960e[_0xc521('0x12')]){if(_0x23960e[_0xc521('0x12')]['code']===0x1f4){logger[_0xc521('0x12')](_0xc521('0xf'),_0x2a0396,_0x23960e[_0xc521('0x12')]['message']);return _0x297d54(_0x23960e[_0xc521('0x12')][_0xc521('0x13')]);}logger[_0xc521('0x12')](_0xc521('0xf'),_0x2a0396,_0x23960e[_0xc521('0x12')][_0xc521('0x13')]);return _0x52842a(_0x23960e['error'][_0xc521('0x13')]);}else{logger['info'](_0xc521('0xf'),_0x2a0396,'request\x20sent');_0x52842a(_0x23960e['result'][_0xc521('0x13')]);}})['catch'](function(_0x42cda2){logger[_0xc521('0x12')]('Network,\x20%s,\x20%s',_0x2a0396,_0x42cda2);_0x297d54(_0x42cda2);});});}