1ac767af6034ec774decb526cf983a09c6045924
[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 _0xf0e2=['then','info','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x221ba2,_0x79208){var _0x47d08e=function(_0xaf14ee){while(--_0xaf14ee){_0x221ba2['push'](_0x221ba2['shift']());}};_0x47d08e(++_0x79208);}(_0xf0e2,0x15a));var _0x2f0e=function(_0x411017,_0x4a8117){_0x411017=_0x411017-0x0;var _0x2adeea=_0xf0e2[_0x411017];return _0x2adeea;};'use strict';var _=require(_0x2f0e('0x0'));var util=require(_0x2f0e('0x1'));var moment=require(_0x2f0e('0x2'));var BPromise=require(_0x2f0e('0x3'));var rs=require(_0x2f0e('0x4'));var fs=require('fs');var Redis=require(_0x2f0e('0x5'));var db=require(_0x2f0e('0x6'))['db'];var utils=require(_0x2f0e('0x7'));var logger=require(_0x2f0e('0x8'))(_0x2f0e('0x9'));var config=require(_0x2f0e('0xa'));var jayson=require(_0x2f0e('0xb'));var client=jayson[_0x2f0e('0xc')][_0x2f0e('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x189af8,_0x34ca69,_0xb8f8f3){return new BPromise(function(_0x2451a5,_0x4586a5){return client['request'](_0x189af8,_0xb8f8f3)[_0x2f0e('0xe')](function(_0x1fb865){logger[_0x2f0e('0xf')](_0x2f0e('0x10'),_0x34ca69,_0x2f0e('0x11'));logger[_0x2f0e('0x12')](_0x2f0e('0x13'),_0x34ca69,_0x2f0e('0x11'),JSON[_0x2f0e('0x14')](_0x1fb865));if(_0x1fb865[_0x2f0e('0x15')]){if(_0x1fb865[_0x2f0e('0x15')][_0x2f0e('0x16')]===0x1f4){logger[_0x2f0e('0x15')]('CloudProvider,\x20%s,\x20%s',_0x34ca69,_0x1fb865[_0x2f0e('0x15')]['message']);return _0x4586a5(_0x1fb865['error'][_0x2f0e('0x17')]);}logger[_0x2f0e('0x15')](_0x2f0e('0x10'),_0x34ca69,_0x1fb865[_0x2f0e('0x15')][_0x2f0e('0x17')]);return _0x2451a5(_0x1fb865['error'][_0x2f0e('0x17')]);}else{logger[_0x2f0e('0xf')]('CloudProvider,\x20%s,\x20%s',_0x34ca69,_0x2f0e('0x11'));_0x2451a5(_0x1fb865['result'][_0x2f0e('0x17')]);}})['catch'](function(_0x1582d9){logger[_0x2f0e('0x15')](_0x2f0e('0x10'),_0x34ca69,_0x1582d9);_0x4586a5(_0x1582d9);});});}