Built motion from commit 43538d75.|2.5.35
[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 _0x505d=['../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','request\x20sent','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','message','CloudProvider,\x20%s,\x20%s','catch','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x14686a,_0x540f0d){var _0xeafc86=function(_0x3be641){while(--_0x3be641){_0x14686a['push'](_0x14686a['shift']());}};_0xeafc86(++_0x540f0d);}(_0x505d,0x93));var _0xd505=function(_0x96f74c,_0xfc30a4){_0x96f74c=_0x96f74c-0x0;var _0x379222=_0x505d[_0x96f74c];return _0x379222;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd505('0x0'));var BPromise=require(_0xd505('0x1'));var rs=require(_0xd505('0x2'));var fs=require('fs');var Redis=require(_0xd505('0x3'));var db=require(_0xd505('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xd505('0x5'))(_0xd505('0x6'));var config=require(_0xd505('0x7'));var jayson=require(_0xd505('0x8'));var client=jayson['client'][_0xd505('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5d4f8d,_0x2bc4e7,_0x162ee2){return new BPromise(function(_0x543c42,_0x2abf26){return client[_0xd505('0xa')](_0x5d4f8d,_0x162ee2)['then'](function(_0x47b37a){logger[_0xd505('0xb')]('CloudProvider,\x20%s,\x20%s',_0x2bc4e7,_0xd505('0xc'));logger['debug'](_0xd505('0xd'),_0x2bc4e7,'request\x20sent',JSON[_0xd505('0xe')](_0x47b37a));if(_0x47b37a['error']){if(_0x47b37a['error']['code']===0x1f4){logger[_0xd505('0xf')]('CloudProvider,\x20%s,\x20%s',_0x2bc4e7,_0x47b37a[_0xd505('0xf')][_0xd505('0x10')]);return _0x2abf26(_0x47b37a['error']['message']);}logger[_0xd505('0xf')](_0xd505('0x11'),_0x2bc4e7,_0x47b37a[_0xd505('0xf')][_0xd505('0x10')]);return _0x543c42(_0x47b37a[_0xd505('0xf')][_0xd505('0x10')]);}else{logger[_0xd505('0xb')](_0xd505('0x11'),_0x2bc4e7,_0xd505('0xc'));_0x543c42(_0x47b37a['result'][_0xd505('0x10')]);}})[_0xd505('0x12')](function(_0x8013f2){logger['error'](_0xd505('0x11'),_0x2bc4e7,_0x8013f2);_0x2abf26(_0x8013f2);});});}