Built motion from commit 85328c08.|2.5.50
[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 _0x896e=['CloudProvider,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0x2bcdf4,_0x1a2f20){var _0x4a0f7a=function(_0x1e924f){while(--_0x1e924f){_0x2bcdf4['push'](_0x2bcdf4['shift']());}};_0x4a0f7a(++_0x1a2f20);}(_0x896e,0x1e9));var _0xe896=function(_0x122818,_0x4fab10){_0x122818=_0x122818-0x0;var _0x3d7e15=_0x896e[_0x122818];return _0x3d7e15;};'use strict';var _=require(_0xe896('0x0'));var util=require(_0xe896('0x1'));var moment=require(_0xe896('0x2'));var BPromise=require(_0xe896('0x3'));var rs=require(_0xe896('0x4'));var fs=require('fs');var Redis=require(_0xe896('0x5'));var db=require(_0xe896('0x6'))['db'];var utils=require(_0xe896('0x7'));var logger=require(_0xe896('0x8'))(_0xe896('0x9'));var config=require(_0xe896('0xa'));var jayson=require(_0xe896('0xb'));var client=jayson['client'][_0xe896('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x7a0721,_0x3b902c,_0x264eeb){return new BPromise(function(_0x43c619,_0x5a1909){return client[_0xe896('0xd')](_0x7a0721,_0x264eeb)[_0xe896('0xe')](function(_0x37a90d){logger['info'](_0xe896('0xf'),_0x3b902c,'request\x20sent');logger[_0xe896('0x10')]('CloudProvider,\x20%s,\x20%s,\x20%s',_0x3b902c,_0xe896('0x11'),JSON[_0xe896('0x12')](_0x37a90d));if(_0x37a90d[_0xe896('0x13')]){if(_0x37a90d['error'][_0xe896('0x14')]===0x1f4){logger[_0xe896('0x13')](_0xe896('0xf'),_0x3b902c,_0x37a90d['error'][_0xe896('0x15')]);return _0x5a1909(_0x37a90d[_0xe896('0x13')][_0xe896('0x15')]);}logger['error'](_0xe896('0xf'),_0x3b902c,_0x37a90d[_0xe896('0x13')][_0xe896('0x15')]);return _0x43c619(_0x37a90d['error']['message']);}else{logger[_0xe896('0x16')](_0xe896('0xf'),_0x3b902c,'request\x20sent');_0x43c619(_0x37a90d['result'][_0xe896('0x15')]);}})[_0xe896('0x17')](function(_0x57f04b){logger[_0xe896('0x13')]('CloudProvider,\x20%s,\x20%s',_0x3b902c,_0x57f04b);_0x5a1909(_0x57f04b);});});}