Built motion from commit (unavailable).|2.5.24
[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 _0xf740=['info','CloudProvider,\x20%s,\x20%s','CloudProvider,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x4697fa,_0x21c841){var _0x390950=function(_0x3deb8a){while(--_0x3deb8a){_0x4697fa['push'](_0x4697fa['shift']());}};_0x390950(++_0x21c841);}(_0xf740,0x14a));var _0x0f74=function(_0x541ea6,_0x51cab6){_0x541ea6=_0x541ea6-0x0;var _0x3c3e84=_0xf740[_0x541ea6];return _0x3c3e84;};'use strict';var _=require(_0x0f74('0x0'));var util=require(_0x0f74('0x1'));var moment=require('moment');var BPromise=require(_0x0f74('0x2'));var rs=require(_0x0f74('0x3'));var fs=require('fs');var Redis=require(_0x0f74('0x4'));var db=require(_0x0f74('0x5'))['db'];var utils=require(_0x0f74('0x6'));var logger=require(_0x0f74('0x7'))(_0x0f74('0x8'));var config=require(_0x0f74('0x9'));var jayson=require(_0x0f74('0xa'));var client=jayson[_0x0f74('0xb')][_0x0f74('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3d17ca,_0x3570d7,_0xa9260f){return new BPromise(function(_0x103948,_0x2b859d){return client[_0x0f74('0xd')](_0x3d17ca,_0xa9260f)[_0x0f74('0xe')](function(_0x17f470){logger[_0x0f74('0xf')](_0x0f74('0x10'),_0x3570d7,'request\x20sent');logger['debug'](_0x0f74('0x11'),_0x3570d7,_0x0f74('0x12'),JSON[_0x0f74('0x13')](_0x17f470));if(_0x17f470['error']){if(_0x17f470[_0x0f74('0x14')][_0x0f74('0x15')]===0x1f4){logger[_0x0f74('0x14')](_0x0f74('0x10'),_0x3570d7,_0x17f470[_0x0f74('0x14')]['message']);return _0x2b859d(_0x17f470[_0x0f74('0x14')][_0x0f74('0x16')]);}logger[_0x0f74('0x14')](_0x0f74('0x10'),_0x3570d7,_0x17f470[_0x0f74('0x14')][_0x0f74('0x16')]);return _0x103948(_0x17f470[_0x0f74('0x14')][_0x0f74('0x16')]);}else{logger['info'](_0x0f74('0x10'),_0x3570d7,_0x0f74('0x12'));_0x103948(_0x17f470['result'][_0x0f74('0x16')]);}})['catch'](function(_0x6296eb){logger['error'](_0x0f74('0x10'),_0x3570d7,_0x6296eb);_0x2b859d(_0x6296eb);});});}