166c91f476fae9c0967177b471a3ff95602b7803
[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 _0x9b58=['error','code','message','result','catch','util','bluebird','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x434a1f,_0x44434d){var _0x10333a=function(_0x762cc6){while(--_0x762cc6){_0x434a1f['push'](_0x434a1f['shift']());}};_0x10333a(++_0x44434d);}(_0x9b58,0x1e5));var _0x89b5=function(_0x844353,_0x560724){_0x844353=_0x844353-0x0;var _0x2d6e1c=_0x9b58[_0x844353];return _0x2d6e1c;};'use strict';var _=require('lodash');var util=require(_0x89b5('0x0'));var moment=require('moment');var BPromise=require(_0x89b5('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x89b5('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x89b5('0x3'));var logger=require('../../config/logger')('rpc');var config=require(_0x89b5('0x4'));var jayson=require(_0x89b5('0x5'));var client=jayson[_0x89b5('0x6')][_0x89b5('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x193765,_0x5843f7,_0x5b295e){return new BPromise(function(_0xeee9ba,_0x423a06){return client['request'](_0x193765,_0x5b295e)[_0x89b5('0x8')](function(_0x40723a){logger[_0x89b5('0x9')](_0x89b5('0xa'),_0x5843f7,_0x89b5('0xb'));logger[_0x89b5('0xc')](_0x89b5('0xd'),_0x5843f7,_0x89b5('0xb'),JSON[_0x89b5('0xe')](_0x40723a));if(_0x40723a[_0x89b5('0xf')]){if(_0x40723a[_0x89b5('0xf')][_0x89b5('0x10')]===0x1f4){logger[_0x89b5('0xf')]('CloudProvider,\x20%s,\x20%s',_0x5843f7,_0x40723a[_0x89b5('0xf')][_0x89b5('0x11')]);return _0x423a06(_0x40723a[_0x89b5('0xf')][_0x89b5('0x11')]);}logger[_0x89b5('0xf')]('CloudProvider,\x20%s,\x20%s',_0x5843f7,_0x40723a[_0x89b5('0xf')][_0x89b5('0x11')]);return _0xeee9ba(_0x40723a[_0x89b5('0xf')]['message']);}else{logger[_0x89b5('0x9')]('CloudProvider,\x20%s,\x20%s',_0x5843f7,_0x89b5('0xb'));_0xeee9ba(_0x40723a[_0x89b5('0x12')][_0x89b5('0x11')]);}})[_0x89b5('0x13')](function(_0x51b192){logger[_0x89b5('0xf')](_0x89b5('0xa'),_0x5843f7,_0x51b192);_0x423a06(_0x51b192);});});}