67519e7e3d0d6193158813ad376ea6d10ffc375a
[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 _0xd267=['request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','client','then','info','CloudProvider,\x20%s,\x20%s'];(function(_0x4e1bcf,_0x462f1d){var _0x46e82f=function(_0x46109d){while(--_0x46109d){_0x4e1bcf['push'](_0x4e1bcf['shift']());}};_0x46e82f(++_0x462f1d);}(_0xd267,0x7a));var _0x7d26=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd267[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x7d26('0x0'));var moment=require(_0x7d26('0x1'));var BPromise=require(_0x7d26('0x2'));var rs=require(_0x7d26('0x3'));var fs=require('fs');var Redis=require(_0x7d26('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7d26('0x5'));var config=require(_0x7d26('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x7d26('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3ad5a8,_0x240ac0,_0x242b82){return new BPromise(function(_0x32c765,_0x3eb536){return client['request'](_0x3ad5a8,_0x242b82)[_0x7d26('0x8')](function(_0x6b9619){logger[_0x7d26('0x9')](_0x7d26('0xa'),_0x240ac0,_0x7d26('0xb'));logger[_0x7d26('0xc')](_0x7d26('0xd'),_0x240ac0,_0x7d26('0xb'),JSON['stringify'](_0x6b9619));if(_0x6b9619[_0x7d26('0xe')]){if(_0x6b9619['error'][_0x7d26('0xf')]===0x1f4){logger[_0x7d26('0xe')](_0x7d26('0xa'),_0x240ac0,_0x6b9619['error'][_0x7d26('0x10')]);return _0x3eb536(_0x6b9619[_0x7d26('0xe')][_0x7d26('0x10')]);}logger['error'](_0x7d26('0xa'),_0x240ac0,_0x6b9619[_0x7d26('0xe')][_0x7d26('0x10')]);return _0x32c765(_0x6b9619['error'][_0x7d26('0x10')]);}else{logger[_0x7d26('0x9')](_0x7d26('0xa'),_0x240ac0,'request\x20sent');_0x32c765(_0x6b9619[_0x7d26('0x11')][_0x7d26('0x10')]);}})[_0x7d26('0x12')](function(_0x2ef9ef){logger[_0x7d26('0xe')](_0x7d26('0xa'),_0x240ac0,_0x2ef9ef);_0x3eb536(_0x2ef9ef);});});}