Built motion from commit (unavailable).|2.5.27
[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 _0xf526=['catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','request','then','info','request\x20sent','stringify','error','Network,\x20%s,\x20%s','message','result'];(function(_0x22327e,_0x19a584){var _0x35df53=function(_0x215495){while(--_0x215495){_0x22327e['push'](_0x22327e['shift']());}};_0x35df53(++_0x19a584);}(_0xf526,0x190));var _0x6f52=function(_0x3ca81a,_0x45dbec){_0x3ca81a=_0x3ca81a-0x0;var _0x45a6d3=_0xf526[_0x3ca81a];return _0x45a6d3;};'use strict';var _=require('lodash');var util=require(_0x6f52('0x0'));var moment=require(_0x6f52('0x1'));var BPromise=require(_0x6f52('0x2'));var rs=require(_0x6f52('0x3'));var fs=require('fs');var Redis=require(_0x6f52('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6f52('0x5'));var logger=require('../../config/logger')(_0x6f52('0x6'));var config=require(_0x6f52('0x7'));var jayson=require(_0x6f52('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x395e64,_0x4c2067,_0x974254){return new BPromise(function(_0xf9ec25,_0x348261){return client[_0x6f52('0x9')](_0x395e64,_0x974254)[_0x6f52('0xa')](function(_0x148ab2){logger[_0x6f52('0xb')]('Network,\x20%s,\x20%s',_0x4c2067,_0x6f52('0xc'));logger['debug']('Network,\x20%s,\x20%s,\x20%s',_0x4c2067,'request\x20sent',JSON[_0x6f52('0xd')](_0x148ab2));if(_0x148ab2[_0x6f52('0xe')]){if(_0x148ab2['error']['code']===0x1f4){logger[_0x6f52('0xe')](_0x6f52('0xf'),_0x4c2067,_0x148ab2[_0x6f52('0xe')]['message']);return _0x348261(_0x148ab2[_0x6f52('0xe')][_0x6f52('0x10')]);}logger[_0x6f52('0xe')](_0x6f52('0xf'),_0x4c2067,_0x148ab2[_0x6f52('0xe')][_0x6f52('0x10')]);return _0xf9ec25(_0x148ab2[_0x6f52('0xe')]['message']);}else{logger['info'](_0x6f52('0xf'),_0x4c2067,_0x6f52('0xc'));_0xf9ec25(_0x148ab2[_0x6f52('0x11')]['message']);}})[_0x6f52('0x12')](function(_0x44751d){logger[_0x6f52('0xe')](_0x6f52('0xf'),_0x4c2067,_0x44751d);_0x348261(_0x44751d);});});}