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 _0xc558=['Network,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','Network,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x2c98f5,_0x3505bd){var _0x1d5794=function(_0x4b511b){while(--_0x4b511b){_0x2c98f5['push'](_0x2c98f5['shift']());}};_0x1d5794(++_0x3505bd);}(_0xc558,0x84));var _0x8c55=function(_0x370ce7,_0x4b1b78){_0x370ce7=_0x370ce7-0x0;var _0xfb6b39=_0xc558[_0x370ce7];return _0xfb6b39;};'use strict';var _=require(_0x8c55('0x0'));var util=require(_0x8c55('0x1'));var moment=require(_0x8c55('0x2'));var BPromise=require('bluebird');var rs=require(_0x8c55('0x3'));var fs=require('fs');var Redis=require(_0x8c55('0x4'));var db=require(_0x8c55('0x5'))['db'];var utils=require(_0x8c55('0x6'));var logger=require(_0x8c55('0x7'))(_0x8c55('0x8'));var config=require('../../config/environment');var jayson=require(_0x8c55('0x9'));var client=jayson[_0x8c55('0xa')][_0x8c55('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3d3ace,_0x3be623,_0x23fafd){return new BPromise(function(_0x1e1ac4,_0x3f910b){return client[_0x8c55('0xc')](_0x3d3ace,_0x23fafd)[_0x8c55('0xd')](function(_0x16cf28){logger[_0x8c55('0xe')](_0x8c55('0xf'),_0x3be623,_0x8c55('0x10'));logger[_0x8c55('0x11')](_0x8c55('0x12'),_0x3be623,'request\x20sent',JSON[_0x8c55('0x13')](_0x16cf28));if(_0x16cf28[_0x8c55('0x14')]){if(_0x16cf28['error'][_0x8c55('0x15')]===0x1f4){logger['error'](_0x8c55('0xf'),_0x3be623,_0x16cf28['error'][_0x8c55('0x16')]);return _0x3f910b(_0x16cf28[_0x8c55('0x14')]['message']);}logger[_0x8c55('0x14')](_0x8c55('0xf'),_0x3be623,_0x16cf28['error']['message']);return _0x1e1ac4(_0x16cf28[_0x8c55('0x14')][_0x8c55('0x16')]);}else{logger[_0x8c55('0xe')](_0x8c55('0xf'),_0x3be623,'request\x20sent');_0x1e1ac4(_0x16cf28[_0x8c55('0x17')]['message']);}})[_0x8c55('0x18')](function(_0x1fb3d3){logger[_0x8c55('0x14')](_0x8c55('0xf'),_0x3be623,_0x1fb3d3);_0x3f910b(_0x1fb3d3);});});}