d2b9c457731cd64e6b28af2be6b3a424f3fb4849
[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 _0xd58a=['../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x2efe8d,_0x33f4a9){var _0x4345ff=function(_0x2395c7){while(--_0x2395c7){_0x2efe8d['push'](_0x2efe8d['shift']());}};_0x4345ff(++_0x33f4a9);}(_0xd58a,0x1dc));var _0xad58=function(_0x384c06,_0x20d767){_0x384c06=_0x384c06-0x0;var _0x36931f=_0xd58a[_0x384c06];return _0x36931f;};'use strict';var _=require(_0xad58('0x0'));var util=require(_0xad58('0x1'));var moment=require(_0xad58('0x2'));var BPromise=require(_0xad58('0x3'));var rs=require(_0xad58('0x4'));var fs=require('fs');var Redis=require(_0xad58('0x5'));var db=require(_0xad58('0x6'))['db'];var utils=require(_0xad58('0x7'));var logger=require(_0xad58('0x8'))(_0xad58('0x9'));var config=require(_0xad58('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xad58('0xb')][_0xad58('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2a4ee2,_0x5005ce,_0x32904b){return new BPromise(function(_0x2e5d4f,_0x57a89b){return client[_0xad58('0xd')](_0x2a4ee2,_0x32904b)[_0xad58('0xe')](function(_0x5577c5){logger[_0xad58('0xf')](_0xad58('0x10'),_0x5005ce,_0xad58('0x11'));logger['debug'](_0xad58('0x12'),_0x5005ce,_0xad58('0x11'),JSON[_0xad58('0x13')](_0x5577c5));if(_0x5577c5[_0xad58('0x14')]){if(_0x5577c5[_0xad58('0x14')][_0xad58('0x15')]===0x1f4){logger['error'](_0xad58('0x10'),_0x5005ce,_0x5577c5[_0xad58('0x14')][_0xad58('0x16')]);return _0x57a89b(_0x5577c5[_0xad58('0x14')][_0xad58('0x16')]);}logger[_0xad58('0x14')](_0xad58('0x10'),_0x5005ce,_0x5577c5[_0xad58('0x14')][_0xad58('0x16')]);return _0x2e5d4f(_0x5577c5['error'][_0xad58('0x16')]);}else{logger[_0xad58('0xf')]('CloudProvider,\x20%s,\x20%s',_0x5005ce,_0xad58('0x11'));_0x2e5d4f(_0x5577c5['result']['message']);}})['catch'](function(_0x4ef30c){logger[_0xad58('0x14')](_0xad58('0x10'),_0x5005ce,_0x4ef30c);_0x57a89b(_0x4ef30c);});});}