Built motion from commit (unavailable).|2.5.11
[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 _0x39ff=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','message','result','util'];(function(_0x22e76d,_0x588d78){var _0x2c631a=function(_0x2d51c2){while(--_0x2d51c2){_0x22e76d['push'](_0x22e76d['shift']());}};_0x2c631a(++_0x588d78);}(_0x39ff,0xe6));var _0xf39f=function(_0x45e1aa,_0x4e1ea5){_0x45e1aa=_0x45e1aa-0x0;var _0xc3a923=_0x39ff[_0x45e1aa];return _0xc3a923;};'use strict';var _=require('lodash');var util=require(_0xf39f('0x0'));var moment=require(_0xf39f('0x1'));var BPromise=require(_0xf39f('0x2'));var rs=require(_0xf39f('0x3'));var fs=require('fs');var Redis=require(_0xf39f('0x4'));var db=require(_0xf39f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xf39f('0x6'))('rpc');var config=require(_0xf39f('0x7'));var jayson=require(_0xf39f('0x8'));var client=jayson['client'][_0xf39f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x48960f,_0x21d3eb,_0x84b2ca){return new BPromise(function(_0x38a03e,_0x39412a){return client[_0xf39f('0xa')](_0x48960f,_0x84b2ca)[_0xf39f('0xb')](function(_0x1ca827){logger[_0xf39f('0xc')](_0xf39f('0xd'),_0x21d3eb,_0xf39f('0xe'));logger[_0xf39f('0xf')](_0xf39f('0x10'),_0x21d3eb,_0xf39f('0xe'),JSON[_0xf39f('0x11')](_0x1ca827));if(_0x1ca827['error']){if(_0x1ca827[_0xf39f('0x12')]['code']===0x1f4){logger[_0xf39f('0x12')](_0xf39f('0xd'),_0x21d3eb,_0x1ca827[_0xf39f('0x12')][_0xf39f('0x13')]);return _0x39412a(_0x1ca827[_0xf39f('0x12')][_0xf39f('0x13')]);}logger['error'](_0xf39f('0xd'),_0x21d3eb,_0x1ca827[_0xf39f('0x12')]['message']);return _0x38a03e(_0x1ca827['error'][_0xf39f('0x13')]);}else{logger['info'](_0xf39f('0xd'),_0x21d3eb,_0xf39f('0xe'));_0x38a03e(_0x1ca827[_0xf39f('0x14')][_0xf39f('0x13')]);}})['catch'](function(_0x5bb673){logger[_0xf39f('0x12')](_0xf39f('0xd'),_0x21d3eb,_0x5bb673);_0x39412a(_0x5bb673);});});}