101b69a7d4cb0be5948e1d13b89b66a928915dc2
[motion2.git] / server / api / cloudProvider / cloudProvider.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 _0x297f=['request','info','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http'];(function(_0x324df8,_0x4db988){var _0x4b593a=function(_0xdf1737){while(--_0xdf1737){_0x324df8['push'](_0x324df8['shift']());}};_0x4b593a(++_0x4db988);}(_0x297f,0x15e));var _0xf297=function(_0x2c8d11,_0x1e4251){_0x2c8d11=_0x2c8d11-0x0;var _0x44e0cc=_0x297f[_0x2c8d11];return _0x44e0cc;};'use strict';var _=require(_0xf297('0x0'));var util=require(_0xf297('0x1'));var moment=require(_0xf297('0x2'));var BPromise=require('bluebird');var rs=require(_0xf297('0x3'));var fs=require('fs');var Redis=require(_0xf297('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xf297('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xf297('0x6'));var jayson=require(_0xf297('0x7'));var client=jayson[_0xf297('0x8')][_0xf297('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2a24a7,_0x4a89f6,_0x462334){return new BPromise(function(_0x41c7c3,_0x4856c3){return client[_0xf297('0xa')](_0x2a24a7,_0x462334)['then'](function(_0x510fcd){logger[_0xf297('0xb')](_0xf297('0xc'),_0x4a89f6,_0xf297('0xd'));logger[_0xf297('0xe')]('CloudProvider,\x20%s,\x20%s,\x20%s',_0x4a89f6,_0xf297('0xd'),JSON['stringify'](_0x510fcd));if(_0x510fcd[_0xf297('0xf')]){if(_0x510fcd[_0xf297('0xf')][_0xf297('0x10')]===0x1f4){logger[_0xf297('0xf')](_0xf297('0xc'),_0x4a89f6,_0x510fcd[_0xf297('0xf')][_0xf297('0x11')]);return _0x4856c3(_0x510fcd[_0xf297('0xf')][_0xf297('0x11')]);}logger['error'](_0xf297('0xc'),_0x4a89f6,_0x510fcd[_0xf297('0xf')][_0xf297('0x11')]);return _0x41c7c3(_0x510fcd[_0xf297('0xf')][_0xf297('0x11')]);}else{logger['info'](_0xf297('0xc'),_0x4a89f6,'request\x20sent');_0x41c7c3(_0x510fcd[_0xf297('0x12')][_0xf297('0x11')]);}})[_0xf297('0x13')](function(_0xb19b73){logger[_0xf297('0xf')](_0xf297('0xc'),_0x4a89f6,_0xb19b73);_0x4856c3(_0xb19b73);});});}