Built motion from commit 449495f6.|2.6.27
[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 _0x97ce=['jayson/promise','client','http','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment'];(function(_0x928c11,_0xe40543){var _0x238a4c=function(_0x1ba59a){while(--_0x1ba59a){_0x928c11['push'](_0x928c11['shift']());}};_0x238a4c(++_0xe40543);}(_0x97ce,0x151));var _0xe97c=function(_0x24f31b,_0x44b8f3){_0x24f31b=_0x24f31b-0x0;var _0x488401=_0x97ce[_0x24f31b];return _0x488401;};'use strict';var _=require(_0xe97c('0x0'));var util=require(_0xe97c('0x1'));var moment=require(_0xe97c('0x2'));var BPromise=require(_0xe97c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe97c('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xe97c('0x5'));var logger=require('../../config/logger')(_0xe97c('0x6'));var config=require(_0xe97c('0x7'));var jayson=require(_0xe97c('0x8'));var client=jayson[_0xe97c('0x9')][_0xe97c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x6603e0,_0x522f0a,_0x3bf4ef){return new BPromise(function(_0x9c1b00,_0x9ce6d){return client['request'](_0x6603e0,_0x3bf4ef)[_0xe97c('0xb')](function(_0x5717fb){logger[_0xe97c('0xc')](_0xe97c('0xd'),_0x522f0a,_0xe97c('0xe'));logger[_0xe97c('0xf')](_0xe97c('0x10'),_0x522f0a,_0xe97c('0xe'),JSON[_0xe97c('0x11')](_0x5717fb));if(_0x5717fb['error']){if(_0x5717fb[_0xe97c('0x12')][_0xe97c('0x13')]===0x1f4){logger[_0xe97c('0x12')](_0xe97c('0xd'),_0x522f0a,_0x5717fb[_0xe97c('0x12')][_0xe97c('0x14')]);return _0x9ce6d(_0x5717fb[_0xe97c('0x12')][_0xe97c('0x14')]);}logger[_0xe97c('0x12')]('CloudProvider,\x20%s,\x20%s',_0x522f0a,_0x5717fb['error'][_0xe97c('0x14')]);return _0x9c1b00(_0x5717fb['error'][_0xe97c('0x14')]);}else{logger[_0xe97c('0xc')]('CloudProvider,\x20%s,\x20%s',_0x522f0a,'request\x20sent');_0x9c1b00(_0x5717fb[_0xe97c('0x15')][_0xe97c('0x14')]);}})[_0xe97c('0x16')](function(_0x2e026d){logger['error']('CloudProvider,\x20%s,\x20%s',_0x522f0a,_0x2e026d);_0x9ce6d(_0x2e026d);});});}