e45be4239306788903eeae571bf3abc7a627833d
[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 _0x6c4a=['debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent'];(function(_0x4b281a,_0x1733de){var _0x3149a7=function(_0x3a6b40){while(--_0x3a6b40){_0x4b281a['push'](_0x4b281a['shift']());}};_0x3149a7(++_0x1733de);}(_0x6c4a,0x13f));var _0xa6c4=function(_0x2792d6,_0x2f264e){_0x2792d6=_0x2792d6-0x0;var _0x4b5158=_0x6c4a[_0x2792d6];return _0x4b5158;};'use strict';var _=require(_0xa6c4('0x0'));var util=require(_0xa6c4('0x1'));var moment=require(_0xa6c4('0x2'));var BPromise=require(_0xa6c4('0x3'));var rs=require(_0xa6c4('0x4'));var fs=require('fs');var Redis=require(_0xa6c4('0x5'));var db=require(_0xa6c4('0x6'))['db'];var utils=require(_0xa6c4('0x7'));var logger=require(_0xa6c4('0x8'))(_0xa6c4('0x9'));var config=require(_0xa6c4('0xa'));var jayson=require(_0xa6c4('0xb'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1b53a7,_0x8a89c6,_0x1cc471){return new BPromise(function(_0x1068f7,_0x38aa2d){return client[_0xa6c4('0xc')](_0x1b53a7,_0x1cc471)[_0xa6c4('0xd')](function(_0x277a2b){logger[_0xa6c4('0xe')](_0xa6c4('0xf'),_0x8a89c6,_0xa6c4('0x10'));logger[_0xa6c4('0x11')](_0xa6c4('0x12'),_0x8a89c6,_0xa6c4('0x10'),JSON[_0xa6c4('0x13')](_0x277a2b));if(_0x277a2b[_0xa6c4('0x14')]){if(_0x277a2b['error'][_0xa6c4('0x15')]===0x1f4){logger[_0xa6c4('0x14')](_0xa6c4('0xf'),_0x8a89c6,_0x277a2b['error'][_0xa6c4('0x16')]);return _0x38aa2d(_0x277a2b[_0xa6c4('0x14')][_0xa6c4('0x16')]);}logger[_0xa6c4('0x14')]('CloudProvider,\x20%s,\x20%s',_0x8a89c6,_0x277a2b[_0xa6c4('0x14')][_0xa6c4('0x16')]);return _0x1068f7(_0x277a2b[_0xa6c4('0x14')][_0xa6c4('0x16')]);}else{logger[_0xa6c4('0xe')](_0xa6c4('0xf'),_0x8a89c6,_0xa6c4('0x10'));_0x1068f7(_0x277a2b['result'][_0xa6c4('0x16')]);}})[_0xa6c4('0x17')](function(_0x4f896a){logger[_0xa6c4('0x14')]('CloudProvider,\x20%s,\x20%s',_0x8a89c6,_0x4f896a);_0x38aa2d(_0x4f896a);});});}