Built motion from commit (unavailable).|2.5.4
[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 _0x6f1a=['lodash','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch'];(function(_0xb34fc1,_0x2a76f9){var _0x1e2ac6=function(_0x3fad88){while(--_0x3fad88){_0xb34fc1['push'](_0xb34fc1['shift']());}};_0x1e2ac6(++_0x2a76f9);}(_0x6f1a,0xc6));var _0xa6f1=function(_0x2766cc,_0x246297){_0x2766cc=_0x2766cc-0x0;var _0x3dd08f=_0x6f1a[_0x2766cc];return _0x3dd08f;};'use strict';var _=require(_0xa6f1('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xa6f1('0x1'));var rs=require(_0xa6f1('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa6f1('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xa6f1('0x4'))(_0xa6f1('0x5'));var config=require(_0xa6f1('0x6'));var jayson=require(_0xa6f1('0x7'));var client=jayson[_0xa6f1('0x8')][_0xa6f1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4e41aa,_0x4c8d03,_0x3324e){return new BPromise(function(_0x18335d,_0x3c991b){return client['request'](_0x4e41aa,_0x3324e)[_0xa6f1('0xa')](function(_0x1e3c71){logger['info'](_0xa6f1('0xb'),_0x4c8d03,_0xa6f1('0xc'));logger[_0xa6f1('0xd')](_0xa6f1('0xe'),_0x4c8d03,'request\x20sent',JSON[_0xa6f1('0xf')](_0x1e3c71));if(_0x1e3c71[_0xa6f1('0x10')]){if(_0x1e3c71['error'][_0xa6f1('0x11')]===0x1f4){logger[_0xa6f1('0x10')](_0xa6f1('0xb'),_0x4c8d03,_0x1e3c71['error'][_0xa6f1('0x12')]);return _0x3c991b(_0x1e3c71[_0xa6f1('0x10')]['message']);}logger[_0xa6f1('0x10')](_0xa6f1('0xb'),_0x4c8d03,_0x1e3c71['error'][_0xa6f1('0x12')]);return _0x18335d(_0x1e3c71[_0xa6f1('0x10')][_0xa6f1('0x12')]);}else{logger[_0xa6f1('0x13')](_0xa6f1('0xb'),_0x4c8d03,_0xa6f1('0xc'));_0x18335d(_0x1e3c71[_0xa6f1('0x14')][_0xa6f1('0x12')]);}})[_0xa6f1('0x15')](function(_0x3ce417){logger[_0xa6f1('0x10')](_0xa6f1('0xb'),_0x4c8d03,_0x3ce417);_0x3c991b(_0x3ce417);});});}