Built motion from commit (unavailable).|2.5.6
[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 _0xfb6a=['../../config/environment','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','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x4be8f2,_0x5c4e32){var _0x2fdd10=function(_0x5e0f4b){while(--_0x5e0f4b){_0x4be8f2['push'](_0x4be8f2['shift']());}};_0x2fdd10(++_0x5c4e32);}(_0xfb6a,0x14a));var _0xafb6=function(_0x4864ea,_0x7764ed){_0x4864ea=_0x4864ea-0x0;var _0x12e74f=_0xfb6a[_0x4864ea];return _0x12e74f;};'use strict';var _=require('lodash');var util=require(_0xafb6('0x0'));var moment=require(_0xafb6('0x1'));var BPromise=require(_0xafb6('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xafb6('0x3'));var db=require(_0xafb6('0x4'))['db'];var utils=require(_0xafb6('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xafb6('0x6'));var jayson=require(_0xafb6('0x7'));var client=jayson[_0xafb6('0x8')][_0xafb6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x20ddf9,_0x336419,_0x2de8a0){return new BPromise(function(_0x59d7b2,_0xdb751e){return client['request'](_0x20ddf9,_0x2de8a0)[_0xafb6('0xa')](function(_0x25c516){logger[_0xafb6('0xb')](_0xafb6('0xc'),_0x336419,_0xafb6('0xd'));logger[_0xafb6('0xe')](_0xafb6('0xf'),_0x336419,'request\x20sent',JSON[_0xafb6('0x10')](_0x25c516));if(_0x25c516['error']){if(_0x25c516[_0xafb6('0x11')][_0xafb6('0x12')]===0x1f4){logger['error']('CloudProvider,\x20%s,\x20%s',_0x336419,_0x25c516[_0xafb6('0x11')][_0xafb6('0x13')]);return _0xdb751e(_0x25c516['error'][_0xafb6('0x13')]);}logger[_0xafb6('0x11')](_0xafb6('0xc'),_0x336419,_0x25c516[_0xafb6('0x11')][_0xafb6('0x13')]);return _0x59d7b2(_0x25c516[_0xafb6('0x11')][_0xafb6('0x13')]);}else{logger[_0xafb6('0xb')](_0xafb6('0xc'),_0x336419,_0xafb6('0xd'));_0x59d7b2(_0x25c516[_0xafb6('0x14')][_0xafb6('0x13')]);}})['catch'](function(_0x43020e){logger[_0xafb6('0x11')](_0xafb6('0xc'),_0x336419,_0x43020e);_0xdb751e(_0x43020e);});});}