Built motion from commit 55091a5c.|2.6.30
[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 _0xaf60=['ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','debug','request\x20sent','error','code','message','info','CloudProvider,\x20%s,\x20%s','lodash','util','moment'];(function(_0x2565e0,_0x45bba1){var _0x5b7c07=function(_0x3d5923){while(--_0x3d5923){_0x2565e0['push'](_0x2565e0['shift']());}};_0x5b7c07(++_0x45bba1);}(_0xaf60,0x82));var _0x0af6=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xaf60[_0x25bea7];return _0x175952;};'use strict';var _=require(_0x0af6('0x0'));var util=require(_0x0af6('0x1'));var moment=require(_0x0af6('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0af6('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0af6('0x4'))(_0x0af6('0x5'));var config=require(_0x0af6('0x6'));var jayson=require(_0x0af6('0x7'));var client=jayson[_0x0af6('0x8')][_0x0af6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2eb218,_0x52c997,_0x376979){return new BPromise(function(_0x28d620,_0x525bcc){return client[_0x0af6('0xa')](_0x2eb218,_0x376979)[_0x0af6('0xb')](function(_0xe9d01a){logger['info']('CloudProvider,\x20%s,\x20%s',_0x52c997,'request\x20sent');logger[_0x0af6('0xc')]('CloudProvider,\x20%s,\x20%s,\x20%s',_0x52c997,_0x0af6('0xd'),JSON['stringify'](_0xe9d01a));if(_0xe9d01a['error']){if(_0xe9d01a[_0x0af6('0xe')][_0x0af6('0xf')]===0x1f4){logger[_0x0af6('0xe')]('CloudProvider,\x20%s,\x20%s',_0x52c997,_0xe9d01a[_0x0af6('0xe')][_0x0af6('0x10')]);return _0x525bcc(_0xe9d01a[_0x0af6('0xe')]['message']);}logger[_0x0af6('0xe')]('CloudProvider,\x20%s,\x20%s',_0x52c997,_0xe9d01a[_0x0af6('0xe')]['message']);return _0x28d620(_0xe9d01a[_0x0af6('0xe')][_0x0af6('0x10')]);}else{logger[_0x0af6('0x11')](_0x0af6('0x12'),_0x52c997,'request\x20sent');_0x28d620(_0xe9d01a['result']['message']);}})['catch'](function(_0x4d5936){logger[_0x0af6('0xe')](_0x0af6('0x12'),_0x52c997,_0x4d5936);_0x525bcc(_0x4d5936);});});}