Built motion from commit 497d3d92.|2.5.43
[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 _0x1399=['message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','then','CloudProvider,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x422205,_0x56e415){var _0x2a7299=function(_0x1e781d){while(--_0x1e781d){_0x422205['push'](_0x422205['shift']());}};_0x2a7299(++_0x56e415);}(_0x1399,0x16c));var _0x9139=function(_0x15f8ad,_0x5275c3){_0x15f8ad=_0x15f8ad-0x0;var _0xc0238a=_0x1399[_0x15f8ad];return _0xc0238a;};'use strict';var _=require(_0x9139('0x0'));var util=require(_0x9139('0x1'));var moment=require('moment');var BPromise=require(_0x9139('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9139('0x3'));var db=require(_0x9139('0x4'))['db'];var utils=require(_0x9139('0x5'));var logger=require(_0x9139('0x6'))(_0x9139('0x7'));var config=require(_0x9139('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x9139('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x11d2ed,_0x4d5d1e,_0x51832d){return new BPromise(function(_0x11a03f,_0x59aec5){return client['request'](_0x11d2ed,_0x51832d)[_0x9139('0xa')](function(_0x385e2c){logger['info'](_0x9139('0xb'),_0x4d5d1e,_0x9139('0xc'));logger['debug']('CloudProvider,\x20%s,\x20%s,\x20%s',_0x4d5d1e,_0x9139('0xc'),JSON[_0x9139('0xd')](_0x385e2c));if(_0x385e2c[_0x9139('0xe')]){if(_0x385e2c[_0x9139('0xe')][_0x9139('0xf')]===0x1f4){logger['error']('CloudProvider,\x20%s,\x20%s',_0x4d5d1e,_0x385e2c['error'][_0x9139('0x10')]);return _0x59aec5(_0x385e2c['error'][_0x9139('0x10')]);}logger[_0x9139('0xe')](_0x9139('0xb'),_0x4d5d1e,_0x385e2c[_0x9139('0xe')]['message']);return _0x11a03f(_0x385e2c[_0x9139('0xe')]['message']);}else{logger['info']('CloudProvider,\x20%s,\x20%s',_0x4d5d1e,_0x9139('0xc'));_0x11a03f(_0x385e2c[_0x9139('0x11')][_0x9139('0x10')]);}})[_0x9139('0x12')](function(_0x18801b){logger[_0x9139('0xe')]('CloudProvider,\x20%s,\x20%s',_0x4d5d1e,_0x18801b);_0x59aec5(_0x18801b);});});}