090e8560ea718768276f8dbf4fc02f5fa8ce2106
[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 _0x9c9b=['code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','client','http','request','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x27057e,_0x3e150f){var _0x1bfcb4=function(_0x4f183f){while(--_0x4f183f){_0x27057e['push'](_0x27057e['shift']());}};_0x1bfcb4(++_0x3e150f);}(_0x9c9b,0x194));var _0xb9c9=function(_0x424d1b,_0x5eb9e2){_0x424d1b=_0x424d1b-0x0;var _0x4f95cc=_0x9c9b[_0x424d1b];return _0x4f95cc;};'use strict';var _=require('lodash');var util=require(_0xb9c9('0x0'));var moment=require(_0xb9c9('0x1'));var BPromise=require(_0xb9c9('0x2'));var rs=require(_0xb9c9('0x3'));var fs=require('fs');var Redis=require(_0xb9c9('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb9c9('0x5'));var logger=require(_0xb9c9('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb9c9('0x7')][_0xb9c9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x726f01,_0x3ccb91,_0x16158b){return new BPromise(function(_0x9dc3da,_0x32ff81){return client[_0xb9c9('0x9')](_0x726f01,_0x16158b)[_0xb9c9('0xa')](function(_0x131b42){logger[_0xb9c9('0xb')](_0xb9c9('0xc'),_0x3ccb91,_0xb9c9('0xd'));logger['debug']('CloudProvider,\x20%s,\x20%s,\x20%s',_0x3ccb91,_0xb9c9('0xd'),JSON[_0xb9c9('0xe')](_0x131b42));if(_0x131b42[_0xb9c9('0xf')]){if(_0x131b42[_0xb9c9('0xf')][_0xb9c9('0x10')]===0x1f4){logger['error']('CloudProvider,\x20%s,\x20%s',_0x3ccb91,_0x131b42['error'][_0xb9c9('0x11')]);return _0x32ff81(_0x131b42['error'][_0xb9c9('0x11')]);}logger[_0xb9c9('0xf')]('CloudProvider,\x20%s,\x20%s',_0x3ccb91,_0x131b42['error'][_0xb9c9('0x11')]);return _0x9dc3da(_0x131b42[_0xb9c9('0xf')][_0xb9c9('0x11')]);}else{logger['info'](_0xb9c9('0xc'),_0x3ccb91,_0xb9c9('0xd'));_0x9dc3da(_0x131b42[_0xb9c9('0x12')][_0xb9c9('0x11')]);}})[_0xb9c9('0x13')](function(_0x49f17c){logger[_0xb9c9('0xf')](_0xb9c9('0xc'),_0x3ccb91,_0x49f17c);_0x32ff81(_0x49f17c);});});}