Built motion from commit c116dc8b.|2.6.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 _0x75dc=['debug','CloudProvider,\x20%s,\x20%s,\x20%s','error','code','CloudProvider,\x20%s,\x20%s','message','info','result','catch','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','request\x20sent'];(function(_0x23e7c1,_0x35110c){var _0x1add43=function(_0x238918){while(--_0x238918){_0x23e7c1['push'](_0x23e7c1['shift']());}};_0x1add43(++_0x35110c);}(_0x75dc,0x1d7));var _0xc75d=function(_0x4ef724,_0x2eaa8f){_0x4ef724=_0x4ef724-0x0;var _0x16b426=_0x75dc[_0x4ef724];return _0x16b426;};'use strict';var _=require(_0xc75d('0x0'));var util=require(_0xc75d('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc75d('0x2'));var db=require(_0xc75d('0x3'))['db'];var utils=require(_0xc75d('0x4'));var logger=require(_0xc75d('0x5'))(_0xc75d('0x6'));var config=require(_0xc75d('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xc75d('0x8')][_0xc75d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x928edc,_0x5d75a9,_0x1ed94f){return new BPromise(function(_0x182591,_0x645b48){return client[_0xc75d('0xa')](_0x928edc,_0x1ed94f)['then'](function(_0x264fcb){logger['info']('CloudProvider,\x20%s,\x20%s',_0x5d75a9,_0xc75d('0xb'));logger[_0xc75d('0xc')](_0xc75d('0xd'),_0x5d75a9,_0xc75d('0xb'),JSON['stringify'](_0x264fcb));if(_0x264fcb[_0xc75d('0xe')]){if(_0x264fcb[_0xc75d('0xe')][_0xc75d('0xf')]===0x1f4){logger[_0xc75d('0xe')](_0xc75d('0x10'),_0x5d75a9,_0x264fcb[_0xc75d('0xe')][_0xc75d('0x11')]);return _0x645b48(_0x264fcb['error'][_0xc75d('0x11')]);}logger[_0xc75d('0xe')](_0xc75d('0x10'),_0x5d75a9,_0x264fcb[_0xc75d('0xe')]['message']);return _0x182591(_0x264fcb['error'][_0xc75d('0x11')]);}else{logger[_0xc75d('0x12')](_0xc75d('0x10'),_0x5d75a9,_0xc75d('0xb'));_0x182591(_0x264fcb[_0xc75d('0x13')][_0xc75d('0x11')]);}})[_0xc75d('0x14')](function(_0x4b8552){logger[_0xc75d('0xe')](_0xc75d('0x10'),_0x5d75a9,_0x4b8552);_0x645b48(_0x4b8552);});});}