Built motion from commit (unavailable).|2.4.17
[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 _0x3bda=['info','Team,\x20%s,\x20%s,\x20%s','stringify','error','Team,\x20%s,\x20%s','message','request\x20sent','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','register','request','then'];(function(_0x4a3a09,_0x2b9475){var _0x626a2e=function(_0x130857){while(--_0x130857){_0x4a3a09['push'](_0x4a3a09['shift']());}};_0x626a2e(++_0x2b9475);}(_0x3bda,0x170));var _0xa3bd=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x3bda[_0x53ccf2];return _0x5a2964;};'use strict';var _=require(_0xa3bd('0x0'));var util=require(_0xa3bd('0x1'));var moment=require(_0xa3bd('0x2'));var BPromise=require(_0xa3bd('0x3'));var rs=require(_0xa3bd('0x4'));var fs=require('fs');var Redis=require(_0xa3bd('0x5'));var db=require(_0xa3bd('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xa3bd('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xa3bd('0x8')]['http']({'port':0x232a});config[_0xa3bd('0x9')]=_[_0xa3bd('0xa')](config['redis'],{'host':_0xa3bd('0xb'),'port':0x18eb});var socket=require(_0xa3bd('0xc'))(new Redis(config[_0xa3bd('0x9')]));require('./team.socket')[_0xa3bd('0xd')](socket);function respondWithRpcPromise(_0x1da20e,_0x392277,_0x1580e6){return new BPromise(function(_0x24d827,_0x235586){return client[_0xa3bd('0xe')](_0x1da20e,_0x1580e6)[_0xa3bd('0xf')](function(_0x45e6c9){logger[_0xa3bd('0x10')]('Team,\x20%s,\x20%s',_0x392277,'request\x20sent');logger['debug'](_0xa3bd('0x11'),_0x392277,'request\x20sent',JSON[_0xa3bd('0x12')](_0x45e6c9));if(_0x45e6c9[_0xa3bd('0x13')]){if(_0x45e6c9[_0xa3bd('0x13')]['code']===0x1f4){logger[_0xa3bd('0x13')](_0xa3bd('0x14'),_0x392277,_0x45e6c9[_0xa3bd('0x13')][_0xa3bd('0x15')]);return _0x235586(_0x45e6c9[_0xa3bd('0x13')]['message']);}logger[_0xa3bd('0x13')](_0xa3bd('0x14'),_0x392277,_0x45e6c9['error'][_0xa3bd('0x15')]);return _0x24d827(_0x45e6c9[_0xa3bd('0x13')][_0xa3bd('0x15')]);}else{logger[_0xa3bd('0x10')](_0xa3bd('0x14'),_0x392277,_0xa3bd('0x16'));_0x24d827(_0x45e6c9[_0xa3bd('0x17')]['message']);}})['catch'](function(_0x2983a6){logger[_0xa3bd('0x13')]('Team,\x20%s,\x20%s',_0x392277,_0x2983a6);_0x235586(_0x2983a6);});});}