8441cd3d6c06b4d2ca1454bbc1cb1b0e80c1cbdd
[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 _0xcff4=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','Network,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','Network,\x20%s,\x20%s','message','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x1f1bf5,_0x17d280){var _0x12eaba=function(_0x40cf74){while(--_0x40cf74){_0x1f1bf5['push'](_0x1f1bf5['shift']());}};_0x12eaba(++_0x17d280);}(_0xcff4,0x1db));var _0x4cff=function(_0x26c580,_0x473665){_0x26c580=_0x26c580-0x0;var _0x5a55b5=_0xcff4[_0x26c580];return _0x5a55b5;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4cff('0x0'));var BPromise=require(_0x4cff('0x1'));var rs=require(_0x4cff('0x2'));var fs=require('fs');var Redis=require(_0x4cff('0x3'));var db=require(_0x4cff('0x4'))['db'];var utils=require(_0x4cff('0x5'));var logger=require(_0x4cff('0x6'))(_0x4cff('0x7'));var config=require(_0x4cff('0x8'));var jayson=require(_0x4cff('0x9'));var client=jayson[_0x4cff('0xa')][_0x4cff('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3bdc26,_0x410fc2,_0xf293d7){return new BPromise(function(_0x4730f5,_0x28beb4){return client['request'](_0x3bdc26,_0xf293d7)[_0x4cff('0xc')](function(_0x3c7ab2){logger[_0x4cff('0xd')]('Network,\x20%s,\x20%s',_0x410fc2,'request\x20sent');logger['debug'](_0x4cff('0xe'),_0x410fc2,_0x4cff('0xf'),JSON[_0x4cff('0x10')](_0x3c7ab2));if(_0x3c7ab2['error']){if(_0x3c7ab2[_0x4cff('0x11')]['code']===0x1f4){logger[_0x4cff('0x11')](_0x4cff('0x12'),_0x410fc2,_0x3c7ab2[_0x4cff('0x11')][_0x4cff('0x13')]);return _0x28beb4(_0x3c7ab2['error']['message']);}logger['error'](_0x4cff('0x12'),_0x410fc2,_0x3c7ab2['error']['message']);return _0x4730f5(_0x3c7ab2[_0x4cff('0x11')][_0x4cff('0x13')]);}else{logger['info'](_0x4cff('0x12'),_0x410fc2,_0x4cff('0xf'));_0x4730f5(_0x3c7ab2['result'][_0x4cff('0x13')]);}})['catch'](function(_0x57f1fe){logger['error'](_0x4cff('0x12'),_0x410fc2,_0x57f1fe);_0x28beb4(_0x57f1fe);});});}