d08f9af832feb2b3a3784d2c5eae617ce4736343
[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 _0xa1be=['CloudProvider,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0xa1be,0x158));var _0xea1b=function(_0x3d5976,_0x1e4c7c){_0x3d5976=_0x3d5976-0x0;var _0x29df50=_0xa1be[_0x3d5976];return _0x29df50;};'use strict';var _=require(_0xea1b('0x0'));var util=require(_0xea1b('0x1'));var moment=require(_0xea1b('0x2'));var BPromise=require(_0xea1b('0x3'));var rs=require(_0xea1b('0x4'));var fs=require('fs');var Redis=require(_0xea1b('0x5'));var db=require(_0xea1b('0x6'))['db'];var utils=require(_0xea1b('0x7'));var logger=require(_0xea1b('0x8'))(_0xea1b('0x9'));var config=require(_0xea1b('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xea1b('0xb')][_0xea1b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xc992ef,_0x1e2000,_0x2673ac){return new BPromise(function(_0x2f9ea1,_0x4590a8){return client[_0xea1b('0xd')](_0xc992ef,_0x2673ac)[_0xea1b('0xe')](function(_0x30fac8){logger[_0xea1b('0xf')](_0xea1b('0x10'),_0x1e2000,_0xea1b('0x11'));logger[_0xea1b('0x12')]('CloudProvider,\x20%s,\x20%s,\x20%s',_0x1e2000,_0xea1b('0x11'),JSON['stringify'](_0x30fac8));if(_0x30fac8[_0xea1b('0x13')]){if(_0x30fac8[_0xea1b('0x13')][_0xea1b('0x14')]===0x1f4){logger[_0xea1b('0x13')](_0xea1b('0x10'),_0x1e2000,_0x30fac8['error'][_0xea1b('0x15')]);return _0x4590a8(_0x30fac8[_0xea1b('0x13')][_0xea1b('0x15')]);}logger[_0xea1b('0x13')](_0xea1b('0x10'),_0x1e2000,_0x30fac8['error'][_0xea1b('0x15')]);return _0x2f9ea1(_0x30fac8[_0xea1b('0x13')][_0xea1b('0x15')]);}else{logger[_0xea1b('0xf')]('CloudProvider,\x20%s,\x20%s',_0x1e2000,_0xea1b('0x11'));_0x2f9ea1(_0x30fac8[_0xea1b('0x16')][_0xea1b('0x15')]);}})[_0xea1b('0x17')](function(_0x3f5dca){logger[_0xea1b('0x13')](_0xea1b('0x10'),_0x1e2000,_0x3f5dca);_0x4590a8(_0x3f5dca);});});}