Built motion from commit 753c950e.|2.5.42
[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 _0x707d=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','CloudProvider,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x15cdbc,_0xbe9c25){var _0x4cf80e=function(_0x5ad816){while(--_0x5ad816){_0x15cdbc['push'](_0x15cdbc['shift']());}};_0x4cf80e(++_0xbe9c25);}(_0x707d,0x18b));var _0xd707=function(_0x299b7e,_0xb5eb98){_0x299b7e=_0x299b7e-0x0;var _0x287283=_0x707d[_0x299b7e];return _0x287283;};'use strict';var _=require(_0xd707('0x0'));var util=require(_0xd707('0x1'));var moment=require(_0xd707('0x2'));var BPromise=require(_0xd707('0x3'));var rs=require(_0xd707('0x4'));var fs=require('fs');var Redis=require(_0xd707('0x5'));var db=require(_0xd707('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xd707('0x7'))(_0xd707('0x8'));var config=require(_0xd707('0x9'));var jayson=require(_0xd707('0xa'));var client=jayson['client'][_0xd707('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3de790,_0x5661e6,_0x4af63f){return new BPromise(function(_0xf596b4,_0x11edc8){return client['request'](_0x3de790,_0x4af63f)[_0xd707('0xc')](function(_0x249b0d){logger['info'](_0xd707('0xd'),_0x5661e6,_0xd707('0xe'));logger['debug']('CloudProvider,\x20%s,\x20%s,\x20%s',_0x5661e6,_0xd707('0xe'),JSON[_0xd707('0xf')](_0x249b0d));if(_0x249b0d[_0xd707('0x10')]){if(_0x249b0d['error'][_0xd707('0x11')]===0x1f4){logger[_0xd707('0x10')](_0xd707('0xd'),_0x5661e6,_0x249b0d['error']['message']);return _0x11edc8(_0x249b0d[_0xd707('0x10')][_0xd707('0x12')]);}logger['error'](_0xd707('0xd'),_0x5661e6,_0x249b0d[_0xd707('0x10')]['message']);return _0xf596b4(_0x249b0d[_0xd707('0x10')][_0xd707('0x12')]);}else{logger['info']('CloudProvider,\x20%s,\x20%s',_0x5661e6,_0xd707('0xe'));_0xf596b4(_0x249b0d['result'][_0xd707('0x12')]);}})[_0xd707('0x13')](function(_0x479aea){logger[_0xd707('0x10')](_0xd707('0xd'),_0x5661e6,_0x479aea);_0x11edc8(_0x479aea);});});}