9cdb1de729d33149532b6df21ca9b3c2ac100533
[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 _0x1d25=['Team,\x20%s,\x20%s','request\x20sent','Team,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','http','redis','defaults','register','request'];(function(_0x34da94,_0x178b79){var _0x7ae05e=function(_0xa083ee){while(--_0xa083ee){_0x34da94['push'](_0x34da94['shift']());}};_0x7ae05e(++_0x178b79);}(_0x1d25,0x171));var _0x51d2=function(_0x2070da,_0x45e586){_0x2070da=_0x2070da-0x0;var _0x4f9fe1=_0x1d25[_0x2070da];return _0x4f9fe1;};'use strict';var _=require(_0x51d2('0x0'));var util=require(_0x51d2('0x1'));var moment=require(_0x51d2('0x2'));var BPromise=require(_0x51d2('0x3'));var rs=require(_0x51d2('0x4'));var fs=require('fs');var Redis=require(_0x51d2('0x5'));var db=require(_0x51d2('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x51d2('0x7'))('rpc');var config=require(_0x51d2('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x51d2('0x9')][_0x51d2('0xa')]({'port':0x232a});config[_0x51d2('0xb')]=_[_0x51d2('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x51d2('0xb')]));require('./team.socket')[_0x51d2('0xd')](socket);function respondWithRpcPromise(_0x3f7949,_0x20ed65,_0x3ddb26){return new BPromise(function(_0x7a21a4,_0xb598f9){return client[_0x51d2('0xe')](_0x3f7949,_0x3ddb26)['then'](function(_0x525d58){logger['info'](_0x51d2('0xf'),_0x20ed65,_0x51d2('0x10'));logger['debug'](_0x51d2('0x11'),_0x20ed65,_0x51d2('0x10'),JSON[_0x51d2('0x12')](_0x525d58));if(_0x525d58[_0x51d2('0x13')]){if(_0x525d58[_0x51d2('0x13')][_0x51d2('0x14')]===0x1f4){logger[_0x51d2('0x13')](_0x51d2('0xf'),_0x20ed65,_0x525d58[_0x51d2('0x13')][_0x51d2('0x15')]);return _0xb598f9(_0x525d58[_0x51d2('0x13')][_0x51d2('0x15')]);}logger[_0x51d2('0x13')](_0x51d2('0xf'),_0x20ed65,_0x525d58[_0x51d2('0x13')][_0x51d2('0x15')]);return _0x7a21a4(_0x525d58[_0x51d2('0x13')][_0x51d2('0x15')]);}else{logger['info'](_0x51d2('0xf'),_0x20ed65,_0x51d2('0x10'));_0x7a21a4(_0x525d58[_0x51d2('0x16')]['message']);}})[_0x51d2('0x17')](function(_0x3b9b8c){logger['error'](_0x51d2('0xf'),_0x20ed65,_0x3b9b8c);_0xb598f9(_0x3b9b8c);});});}