99c4ee771f8848c5ec9641fa7aeb80a611e0bc0d
[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 _0x6931=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x35fa02,_0x20c5b6){var _0x12e4bc=function(_0x4fdaa9){while(--_0x4fdaa9){_0x35fa02['push'](_0x35fa02['shift']());}};_0x12e4bc(++_0x20c5b6);}(_0x6931,0x1a9));var _0x1693=function(_0x4ca961,_0x110d45){_0x4ca961=_0x4ca961-0x0;var _0x26090d=_0x6931[_0x4ca961];return _0x26090d;};'use strict';var _=require(_0x1693('0x0'));var util=require(_0x1693('0x1'));var moment=require(_0x1693('0x2'));var BPromise=require(_0x1693('0x3'));var rs=require(_0x1693('0x4'));var fs=require('fs');var Redis=require(_0x1693('0x5'));var db=require(_0x1693('0x6'))['db'];var utils=require(_0x1693('0x7'));var logger=require('../../config/logger')(_0x1693('0x8'));var config=require(_0x1693('0x9'));var jayson=require(_0x1693('0xa'));var client=jayson[_0x1693('0xb')][_0x1693('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5de567,_0x3ab149,_0x2ec499){return new BPromise(function(_0x18e32e,_0x579434){return client[_0x1693('0xd')](_0x5de567,_0x2ec499)[_0x1693('0xe')](function(_0x356ec3){logger[_0x1693('0xf')](_0x1693('0x10'),_0x3ab149,_0x1693('0x11'));logger[_0x1693('0x12')](_0x1693('0x13'),_0x3ab149,_0x1693('0x11'),JSON[_0x1693('0x14')](_0x356ec3));if(_0x356ec3[_0x1693('0x15')]){if(_0x356ec3['error'][_0x1693('0x16')]===0x1f4){logger[_0x1693('0x15')](_0x1693('0x10'),_0x3ab149,_0x356ec3[_0x1693('0x15')][_0x1693('0x17')]);return _0x579434(_0x356ec3[_0x1693('0x15')][_0x1693('0x17')]);}logger['error'](_0x1693('0x10'),_0x3ab149,_0x356ec3['error'][_0x1693('0x17')]);return _0x18e32e(_0x356ec3['error'][_0x1693('0x17')]);}else{logger[_0x1693('0xf')]('CloudProvider,\x20%s,\x20%s',_0x3ab149,'request\x20sent');_0x18e32e(_0x356ec3[_0x1693('0x18')]['message']);}})['catch'](function(_0x54724d){logger[_0x1693('0x15')]('CloudProvider,\x20%s,\x20%s',_0x3ab149,_0x54724d);_0x579434(_0x54724d);});});}