b6b96fbba14568a67fa933247417329a01cac388
[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 _0xcd4d=['http','then','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x40ac5e,_0x2de228){var _0x2839d6=function(_0x123d47){while(--_0x123d47){_0x40ac5e['push'](_0x40ac5e['shift']());}};_0x2839d6(++_0x2de228);}(_0xcd4d,0xe4));var _0xdcd4=function(_0xa1b35b,_0x39fee5){_0xa1b35b=_0xa1b35b-0x0;var _0xd6942e=_0xcd4d[_0xa1b35b];return _0xd6942e;};'use strict';var _=require(_0xdcd4('0x0'));var util=require(_0xdcd4('0x1'));var moment=require('moment');var BPromise=require(_0xdcd4('0x2'));var rs=require(_0xdcd4('0x3'));var fs=require('fs');var Redis=require(_0xdcd4('0x4'));var db=require(_0xdcd4('0x5'))['db'];var utils=require(_0xdcd4('0x6'));var logger=require(_0xdcd4('0x7'))(_0xdcd4('0x8'));var config=require(_0xdcd4('0x9'));var jayson=require(_0xdcd4('0xa'));var client=jayson[_0xdcd4('0xb')][_0xdcd4('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x302b60,_0x5b57f6,_0x17f848){return new BPromise(function(_0x198d6c,_0xc0cf59){return client['request'](_0x302b60,_0x17f848)[_0xdcd4('0xd')](function(_0x3cae6d){logger['info'](_0xdcd4('0xe'),_0x5b57f6,_0xdcd4('0xf'));logger[_0xdcd4('0x10')](_0xdcd4('0x11'),_0x5b57f6,_0xdcd4('0xf'),JSON['stringify'](_0x3cae6d));if(_0x3cae6d[_0xdcd4('0x12')]){if(_0x3cae6d[_0xdcd4('0x12')][_0xdcd4('0x13')]===0x1f4){logger[_0xdcd4('0x12')](_0xdcd4('0xe'),_0x5b57f6,_0x3cae6d['error'][_0xdcd4('0x14')]);return _0xc0cf59(_0x3cae6d[_0xdcd4('0x12')]['message']);}logger[_0xdcd4('0x12')](_0xdcd4('0xe'),_0x5b57f6,_0x3cae6d['error']['message']);return _0x198d6c(_0x3cae6d[_0xdcd4('0x12')][_0xdcd4('0x14')]);}else{logger[_0xdcd4('0x15')](_0xdcd4('0xe'),_0x5b57f6,_0xdcd4('0xf'));_0x198d6c(_0x3cae6d[_0xdcd4('0x16')][_0xdcd4('0x14')]);}})[_0xdcd4('0x17')](function(_0xf57175){logger[_0xdcd4('0x12')](_0xdcd4('0xe'),_0x5b57f6,_0xf57175);_0xc0cf59(_0xf57175);});});}