babffd8ca66c69f5a85c702e83849077633484e3
[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 _0xe5fc=['http','request','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x5178fb,_0x121e19){var _0x348183=function(_0x52c2ec){while(--_0x52c2ec){_0x5178fb['push'](_0x5178fb['shift']());}};_0x348183(++_0x121e19);}(_0xe5fc,0x109));var _0xce5f=function(_0x5022fe,_0x397576){_0x5022fe=_0x5022fe-0x0;var _0x5aa03d=_0xe5fc[_0x5022fe];return _0x5aa03d;};'use strict';var _=require(_0xce5f('0x0'));var util=require('util');var moment=require(_0xce5f('0x1'));var BPromise=require(_0xce5f('0x2'));var rs=require(_0xce5f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xce5f('0x4'))('rpc');var config=require(_0xce5f('0x5'));var jayson=require(_0xce5f('0x6'));var client=jayson[_0xce5f('0x7')][_0xce5f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3b77ef,_0x30a150,_0x2b64dc){return new BPromise(function(_0x3451af,_0x4fa651){return client[_0xce5f('0x9')](_0x3b77ef,_0x2b64dc)[_0xce5f('0xa')](function(_0x29a7bf){logger[_0xce5f('0xb')](_0xce5f('0xc'),_0x30a150,_0xce5f('0xd'));logger[_0xce5f('0xe')]('CloudProvider,\x20%s,\x20%s,\x20%s',_0x30a150,_0xce5f('0xd'),JSON[_0xce5f('0xf')](_0x29a7bf));if(_0x29a7bf[_0xce5f('0x10')]){if(_0x29a7bf[_0xce5f('0x10')][_0xce5f('0x11')]===0x1f4){logger[_0xce5f('0x10')](_0xce5f('0xc'),_0x30a150,_0x29a7bf[_0xce5f('0x10')][_0xce5f('0x12')]);return _0x4fa651(_0x29a7bf['error']['message']);}logger['error'](_0xce5f('0xc'),_0x30a150,_0x29a7bf[_0xce5f('0x10')][_0xce5f('0x12')]);return _0x3451af(_0x29a7bf[_0xce5f('0x10')]['message']);}else{logger[_0xce5f('0xb')](_0xce5f('0xc'),_0x30a150,_0xce5f('0xd'));_0x3451af(_0x29a7bf[_0xce5f('0x13')][_0xce5f('0x12')]);}})[_0xce5f('0x14')](function(_0x1544ba){logger[_0xce5f('0x10')](_0xce5f('0xc'),_0x30a150,_0x1544ba);_0x4fa651(_0x1544ba);});});}