Built motion from commit (unavailable).|2.5.28
[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 _0x5dbc=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','info','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x5dbc,0x1b6));var _0xc5db=function(_0x11485d,_0x40fbd6){_0x11485d=_0x11485d-0x0;var _0x329f76=_0x5dbc[_0x11485d];return _0x329f76;};'use strict';var _=require(_0xc5db('0x0'));var util=require(_0xc5db('0x1'));var moment=require('moment');var BPromise=require(_0xc5db('0x2'));var rs=require(_0xc5db('0x3'));var fs=require('fs');var Redis=require(_0xc5db('0x4'));var db=require(_0xc5db('0x5'))['db'];var utils=require(_0xc5db('0x6'));var logger=require(_0xc5db('0x7'))('rpc');var config=require(_0xc5db('0x8'));var jayson=require(_0xc5db('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5613db,_0x5a39c9,_0x1b9372){return new BPromise(function(_0x24a25d,_0x34c172){return client[_0xc5db('0xa')](_0x5613db,_0x1b9372)['then'](function(_0x2ffcdc){logger[_0xc5db('0xb')](_0xc5db('0xc'),_0x5a39c9,_0xc5db('0xd'));logger[_0xc5db('0xe')](_0xc5db('0xf'),_0x5a39c9,_0xc5db('0xd'),JSON[_0xc5db('0x10')](_0x2ffcdc));if(_0x2ffcdc[_0xc5db('0x11')]){if(_0x2ffcdc[_0xc5db('0x11')][_0xc5db('0x12')]===0x1f4){logger[_0xc5db('0x11')](_0xc5db('0xc'),_0x5a39c9,_0x2ffcdc['error']['message']);return _0x34c172(_0x2ffcdc[_0xc5db('0x11')][_0xc5db('0x13')]);}logger[_0xc5db('0x11')]('CloudProvider,\x20%s,\x20%s',_0x5a39c9,_0x2ffcdc[_0xc5db('0x11')][_0xc5db('0x13')]);return _0x24a25d(_0x2ffcdc[_0xc5db('0x11')]['message']);}else{logger[_0xc5db('0xb')]('CloudProvider,\x20%s,\x20%s',_0x5a39c9,_0xc5db('0xd'));_0x24a25d(_0x2ffcdc['result'][_0xc5db('0x13')]);}})['catch'](function(_0x41dc13){logger['error'](_0xc5db('0xc'),_0x5a39c9,_0x41dc13);_0x34c172(_0x41dc13);});});}