Built motion from commit (unavailable).|2.5.31
[motion2.git] / server / api / team / team.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 _0xd093=['info','Team,\x20%s,\x20%s','request\x20sent','error','code','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./team.socket','register','request','then'];(function(_0x40eff5,_0x2a5a41){var _0x164588=function(_0x42732f){while(--_0x42732f){_0x40eff5['push'](_0x40eff5['shift']());}};_0x164588(++_0x2a5a41);}(_0xd093,0x89));var _0x3d09=function(_0x418eb9,_0x3228bb){_0x418eb9=_0x418eb9-0x0;var _0x4fa5bf=_0xd093[_0x418eb9];return _0x4fa5bf;};'use strict';var _=require(_0x3d09('0x0'));var util=require(_0x3d09('0x1'));var moment=require(_0x3d09('0x2'));var BPromise=require(_0x3d09('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3d09('0x4'));var db=require(_0x3d09('0x5'))['db'];var utils=require(_0x3d09('0x6'));var logger=require('../../config/logger')(_0x3d09('0x7'));var config=require(_0x3d09('0x8'));var jayson=require(_0x3d09('0x9'));var client=jayson[_0x3d09('0xa')][_0x3d09('0xb')]({'port':0x232a});config[_0x3d09('0xc')]=_[_0x3d09('0xd')](config[_0x3d09('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x3d09('0xe'))(new Redis(config['redis']));require(_0x3d09('0xf'))[_0x3d09('0x10')](socket);function respondWithRpcPromise(_0x68390f,_0x88a3df,_0x2a9804){return new BPromise(function(_0x2f4923,_0x1e3e34){return client[_0x3d09('0x11')](_0x68390f,_0x2a9804)[_0x3d09('0x12')](function(_0x1b9935){logger[_0x3d09('0x13')](_0x3d09('0x14'),_0x88a3df,_0x3d09('0x15'));logger['debug']('Team,\x20%s,\x20%s,\x20%s',_0x88a3df,_0x3d09('0x15'),JSON['stringify'](_0x1b9935));if(_0x1b9935['error']){if(_0x1b9935[_0x3d09('0x16')][_0x3d09('0x17')]===0x1f4){logger[_0x3d09('0x16')](_0x3d09('0x14'),_0x88a3df,_0x1b9935[_0x3d09('0x16')][_0x3d09('0x18')]);return _0x1e3e34(_0x1b9935['error'][_0x3d09('0x18')]);}logger[_0x3d09('0x16')](_0x3d09('0x14'),_0x88a3df,_0x1b9935[_0x3d09('0x16')][_0x3d09('0x18')]);return _0x2f4923(_0x1b9935[_0x3d09('0x16')][_0x3d09('0x18')]);}else{logger[_0x3d09('0x13')](_0x3d09('0x14'),_0x88a3df,_0x3d09('0x15'));_0x2f4923(_0x1b9935[_0x3d09('0x19')]['message']);}})['catch'](function(_0x50d1bf){logger[_0x3d09('0x16')]('Team,\x20%s,\x20%s',_0x88a3df,_0x50d1bf);_0x1e3e34(_0x50d1bf);});});}