5a2e72314da0767e68d53bcbdbf8e2f1b3a00d4b
[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 _0x077f=['http','localhost','redis','./team.socket','register','request','info','Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client'];(function(_0x262f2c,_0x3ea263){var _0x437433=function(_0x884037){while(--_0x884037){_0x262f2c['push'](_0x262f2c['shift']());}};_0x437433(++_0x3ea263);}(_0x077f,0x8c));var _0xf077=function(_0x30fe4b,_0x5742e5){_0x30fe4b=_0x30fe4b-0x0;var _0x89d370=_0x077f[_0x30fe4b];return _0x89d370;};'use strict';var _=require(_0xf077('0x0'));var util=require(_0xf077('0x1'));var moment=require(_0xf077('0x2'));var BPromise=require(_0xf077('0x3'));var rs=require(_0xf077('0x4'));var fs=require('fs');var Redis=require(_0xf077('0x5'));var db=require(_0xf077('0x6'))['db'];var utils=require(_0xf077('0x7'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xf077('0x8'));var client=jayson[_0xf077('0x9')][_0xf077('0xa')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0xf077('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf077('0xc')]));require(_0xf077('0xd'))[_0xf077('0xe')](socket);function respondWithRpcPromise(_0x5a6fa1,_0xf1cb1c,_0x5aed0c){return new BPromise(function(_0x5df14c,_0x10f4a3){return client[_0xf077('0xf')](_0x5a6fa1,_0x5aed0c)['then'](function(_0x2bfa29){logger[_0xf077('0x10')](_0xf077('0x11'),_0xf1cb1c,_0xf077('0x12'));logger[_0xf077('0x13')](_0xf077('0x14'),_0xf1cb1c,_0xf077('0x12'),JSON['stringify'](_0x2bfa29));if(_0x2bfa29[_0xf077('0x15')]){if(_0x2bfa29[_0xf077('0x15')]['code']===0x1f4){logger[_0xf077('0x15')](_0xf077('0x11'),_0xf1cb1c,_0x2bfa29[_0xf077('0x15')]['message']);return _0x10f4a3(_0x2bfa29['error'][_0xf077('0x16')]);}logger['error'](_0xf077('0x11'),_0xf1cb1c,_0x2bfa29[_0xf077('0x15')][_0xf077('0x16')]);return _0x5df14c(_0x2bfa29[_0xf077('0x15')][_0xf077('0x16')]);}else{logger[_0xf077('0x10')](_0xf077('0x11'),_0xf1cb1c,_0xf077('0x12'));_0x5df14c(_0x2bfa29[_0xf077('0x17')][_0xf077('0x16')]);}})[_0xf077('0x18')](function(_0x280e8e){logger[_0xf077('0x15')]('Team,\x20%s,\x20%s',_0xf1cb1c,_0x280e8e);_0x10f4a3(_0x280e8e);});});}