Built motion from commit (unavailable).|2.5.23
[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 _0x6f72=['CloudProvider,\x20%s,\x20%s','request\x20sent','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','info'];(function(_0x2962d5,_0x38deda){var _0x273406=function(_0x3e0775){while(--_0x3e0775){_0x2962d5['push'](_0x2962d5['shift']());}};_0x273406(++_0x38deda);}(_0x6f72,0x198));var _0x26f7=function(_0x563707,_0x3f98ea){_0x563707=_0x563707-0x0;var _0x3b936c=_0x6f72[_0x563707];return _0x3b936c;};'use strict';var _=require(_0x26f7('0x0'));var util=require('util');var moment=require(_0x26f7('0x1'));var BPromise=require(_0x26f7('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x26f7('0x3'));var db=require(_0x26f7('0x4'))['db'];var utils=require(_0x26f7('0x5'));var logger=require(_0x26f7('0x6'))('rpc');var config=require(_0x26f7('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x26f7('0x8')][_0x26f7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1a81b1,_0x1c12cd,_0x26cca3){return new BPromise(function(_0x19ca7d,_0x5155f3){return client[_0x26f7('0xa')](_0x1a81b1,_0x26cca3)['then'](function(_0x5ee358){logger[_0x26f7('0xb')](_0x26f7('0xc'),_0x1c12cd,_0x26f7('0xd'));logger['debug'](_0x26f7('0xe'),_0x1c12cd,_0x26f7('0xd'),JSON[_0x26f7('0xf')](_0x5ee358));if(_0x5ee358['error']){if(_0x5ee358[_0x26f7('0x10')][_0x26f7('0x11')]===0x1f4){logger[_0x26f7('0x10')](_0x26f7('0xc'),_0x1c12cd,_0x5ee358['error']['message']);return _0x5155f3(_0x5ee358['error'][_0x26f7('0x12')]);}logger[_0x26f7('0x10')](_0x26f7('0xc'),_0x1c12cd,_0x5ee358['error']['message']);return _0x19ca7d(_0x5ee358[_0x26f7('0x10')]['message']);}else{logger['info'](_0x26f7('0xc'),_0x1c12cd,_0x26f7('0xd'));_0x19ca7d(_0x5ee358['result'][_0x26f7('0x12')]);}})[_0x26f7('0x13')](function(_0x4ffdf9){logger[_0x26f7('0x10')](_0x26f7('0xc'),_0x1c12cd,_0x4ffdf9);_0x5155f3(_0x4ffdf9);});});}