Built motion from commit (unavailable).|2.5.10
[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 _0x1524=['message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http','then','debug','request\x20sent','stringify','error','code','CloudProvider,\x20%s,\x20%s'];(function(_0x2c1e7a,_0x155f86){var _0xcacb4f=function(_0x2b2eb3){while(--_0x2b2eb3){_0x2c1e7a['push'](_0x2c1e7a['shift']());}};_0xcacb4f(++_0x155f86);}(_0x1524,0x16b));var _0x4152=function(_0xb61433,_0x31d758){_0xb61433=_0xb61433-0x0;var _0x123400=_0x1524[_0xb61433];return _0x123400;};'use strict';var _=require(_0x4152('0x0'));var util=require(_0x4152('0x1'));var moment=require('moment');var BPromise=require(_0x4152('0x2'));var rs=require(_0x4152('0x3'));var fs=require('fs');var Redis=require(_0x4152('0x4'));var db=require(_0x4152('0x5'))['db'];var utils=require(_0x4152('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x4152('0x7'));var client=jayson[_0x4152('0x8')][_0x4152('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2789c6,_0x322f87,_0x5065f6){return new BPromise(function(_0x3fabe3,_0x3733dc){return client['request'](_0x2789c6,_0x5065f6)[_0x4152('0xa')](function(_0x1e38d5){logger['info']('CloudProvider,\x20%s,\x20%s',_0x322f87,'request\x20sent');logger[_0x4152('0xb')]('CloudProvider,\x20%s,\x20%s,\x20%s',_0x322f87,_0x4152('0xc'),JSON[_0x4152('0xd')](_0x1e38d5));if(_0x1e38d5[_0x4152('0xe')]){if(_0x1e38d5['error'][_0x4152('0xf')]===0x1f4){logger[_0x4152('0xe')](_0x4152('0x10'),_0x322f87,_0x1e38d5[_0x4152('0xe')][_0x4152('0x11')]);return _0x3733dc(_0x1e38d5['error'][_0x4152('0x11')]);}logger[_0x4152('0xe')]('CloudProvider,\x20%s,\x20%s',_0x322f87,_0x1e38d5[_0x4152('0xe')][_0x4152('0x11')]);return _0x3fabe3(_0x1e38d5['error'][_0x4152('0x11')]);}else{logger['info'](_0x4152('0x10'),_0x322f87,'request\x20sent');_0x3fabe3(_0x1e38d5[_0x4152('0x12')]['message']);}})[_0x4152('0x13')](function(_0x111b29){logger['error']('CloudProvider,\x20%s,\x20%s',_0x322f87,_0x111b29);_0x3733dc(_0x111b29);});});}