Built motion from commit (unavailable).|2.5.4
[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 _0xcbdf=['then','info','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','error','CloudProvider,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','http'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0xcbdf,0xd2));var _0xfcbd=function(_0x42e7af,_0xfca406){_0x42e7af=_0x42e7af-0x0;var _0x57abbe=_0xcbdf[_0x42e7af];return _0x57abbe;};'use strict';var _=require(_0xfcbd('0x0'));var util=require(_0xfcbd('0x1'));var moment=require(_0xfcbd('0x2'));var BPromise=require(_0xfcbd('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfcbd('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xfcbd('0x5'));var logger=require(_0xfcbd('0x6'))(_0xfcbd('0x7'));var config=require(_0xfcbd('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xfcbd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x37f982,_0x410ab8,_0xaece8c){return new BPromise(function(_0x55757e,_0xc80c5){return client['request'](_0x37f982,_0xaece8c)[_0xfcbd('0xa')](function(_0xc22dea){logger[_0xfcbd('0xb')]('CloudProvider,\x20%s,\x20%s',_0x410ab8,_0xfcbd('0xc'));logger[_0xfcbd('0xd')](_0xfcbd('0xe'),_0x410ab8,_0xfcbd('0xc'),JSON['stringify'](_0xc22dea));if(_0xc22dea[_0xfcbd('0xf')]){if(_0xc22dea[_0xfcbd('0xf')]['code']===0x1f4){logger['error'](_0xfcbd('0x10'),_0x410ab8,_0xc22dea['error']['message']);return _0xc80c5(_0xc22dea[_0xfcbd('0xf')]['message']);}logger['error'](_0xfcbd('0x10'),_0x410ab8,_0xc22dea[_0xfcbd('0xf')][_0xfcbd('0x11')]);return _0x55757e(_0xc22dea[_0xfcbd('0xf')][_0xfcbd('0x11')]);}else{logger['info'](_0xfcbd('0x10'),_0x410ab8,_0xfcbd('0xc'));_0x55757e(_0xc22dea[_0xfcbd('0x12')][_0xfcbd('0x11')]);}})[_0xfcbd('0x13')](function(_0x493454){logger[_0xfcbd('0xf')](_0xfcbd('0x10'),_0x410ab8,_0x493454);_0xc80c5(_0x493454);});});}