Built motion from commit (unavailable).|2.5.30
[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 _0xa120=['../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','CloudProvider,\x20%s,\x20%s','debug','CloudProvider,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring'];(function(_0x46aff0,_0x122890){var _0x9d78cf=function(_0x3f14cb){while(--_0x3f14cb){_0x46aff0['push'](_0x46aff0['shift']());}};_0x9d78cf(++_0x122890);}(_0xa120,0x199));var _0x0a12=function(_0x5b8415,_0x163fb){_0x5b8415=_0x5b8415-0x0;var _0x535923=_0xa120[_0x5b8415];return _0x535923;};'use strict';var _=require(_0x0a12('0x0'));var util=require(_0x0a12('0x1'));var moment=require(_0x0a12('0x2'));var BPromise=require(_0x0a12('0x3'));var rs=require(_0x0a12('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0a12('0x5'))['db'];var utils=require(_0x0a12('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x0a12('0x7'));var jayson=require(_0x0a12('0x8'));var client=jayson[_0x0a12('0x9')][_0x0a12('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4689fe,_0x309350,_0x5ccdab){return new BPromise(function(_0x30cd4c,_0x439ca4){return client[_0x0a12('0xb')](_0x4689fe,_0x5ccdab)[_0x0a12('0xc')](function(_0x18fd33){logger[_0x0a12('0xd')](_0x0a12('0xe'),_0x309350,'request\x20sent');logger[_0x0a12('0xf')](_0x0a12('0x10'),_0x309350,_0x0a12('0x11'),JSON[_0x0a12('0x12')](_0x18fd33));if(_0x18fd33[_0x0a12('0x13')]){if(_0x18fd33[_0x0a12('0x13')][_0x0a12('0x14')]===0x1f4){logger[_0x0a12('0x13')](_0x0a12('0xe'),_0x309350,_0x18fd33['error'][_0x0a12('0x15')]);return _0x439ca4(_0x18fd33['error'][_0x0a12('0x15')]);}logger['error'](_0x0a12('0xe'),_0x309350,_0x18fd33[_0x0a12('0x13')][_0x0a12('0x15')]);return _0x30cd4c(_0x18fd33[_0x0a12('0x13')]['message']);}else{logger[_0x0a12('0xd')](_0x0a12('0xe'),_0x309350,_0x0a12('0x11'));_0x30cd4c(_0x18fd33[_0x0a12('0x16')][_0x0a12('0x15')]);}})['catch'](function(_0x1a6911){logger['error'](_0x0a12('0xe'),_0x309350,_0x1a6911);_0x439ca4(_0x1a6911);});});}