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 _0x644f=['util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash'];(function(_0x2113da,_0x3579c3){var _0x505149=function(_0x1e9829){while(--_0x1e9829){_0x2113da['push'](_0x2113da['shift']());}};_0x505149(++_0x3579c3);}(_0x644f,0xce));var _0xf644=function(_0x2998db,_0x3424f1){_0x2998db=_0x2998db-0x0;var _0x115fea=_0x644f[_0x2998db];return _0x115fea;};'use strict';var _=require(_0xf644('0x0'));var util=require(_0xf644('0x1'));var moment=require(_0xf644('0x2'));var BPromise=require(_0xf644('0x3'));var rs=require(_0xf644('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xf644('0x5'));var logger=require(_0xf644('0x6'))(_0xf644('0x7'));var config=require(_0xf644('0x8'));var jayson=require(_0xf644('0x9'));var client=jayson[_0xf644('0xa')][_0xf644('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1d722d,_0x3ec341,_0x2e2700){return new BPromise(function(_0x292166,_0x2419bd){return client['request'](_0x1d722d,_0x2e2700)[_0xf644('0xc')](function(_0xde48f9){logger[_0xf644('0xd')](_0xf644('0xe'),_0x3ec341,_0xf644('0xf'));logger[_0xf644('0x10')](_0xf644('0x11'),_0x3ec341,_0xf644('0xf'),JSON[_0xf644('0x12')](_0xde48f9));if(_0xde48f9['error']){if(_0xde48f9[_0xf644('0x13')]['code']===0x1f4){logger[_0xf644('0x13')](_0xf644('0xe'),_0x3ec341,_0xde48f9['error'][_0xf644('0x14')]);return _0x2419bd(_0xde48f9[_0xf644('0x13')][_0xf644('0x14')]);}logger['error'](_0xf644('0xe'),_0x3ec341,_0xde48f9[_0xf644('0x13')][_0xf644('0x14')]);return _0x292166(_0xde48f9['error'][_0xf644('0x14')]);}else{logger['info']('CloudProvider,\x20%s,\x20%s',_0x3ec341,'request\x20sent');_0x292166(_0xde48f9[_0xf644('0x15')]['message']);}})[_0xf644('0x16')](function(_0x47cbc3){logger[_0xf644('0x13')]('CloudProvider,\x20%s,\x20%s',_0x3ec341,_0x47cbc3);_0x2419bd(_0x47cbc3);});});}