Built motion from commit f7863d46.|2.5.41
[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 _0x49c9=['../../mysqldb','../../config/utils','../../config/logger','rpc','http','redis','defaults','socket.io-emitter','./team.socket','then','info','Team,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','moment','randomstring','ioredis'];(function(_0x289a1e,_0x3d3640){var _0x330b75=function(_0x10bade){while(--_0x10bade){_0x289a1e['push'](_0x289a1e['shift']());}};_0x330b75(++_0x3d3640);}(_0x49c9,0x9d));var _0x949c=function(_0x187c3b,_0x735efa){_0x187c3b=_0x187c3b-0x0;var _0x326167=_0x49c9[_0x187c3b];return _0x326167;};'use strict';var _=require(_0x949c('0x0'));var util=require('util');var moment=require(_0x949c('0x1'));var BPromise=require('bluebird');var rs=require(_0x949c('0x2'));var fs=require('fs');var Redis=require(_0x949c('0x3'));var db=require(_0x949c('0x4'))['db'];var utils=require(_0x949c('0x5'));var logger=require(_0x949c('0x6'))(_0x949c('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x949c('0x8')]({'port':0x232a});config[_0x949c('0x9')]=_[_0x949c('0xa')](config[_0x949c('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x949c('0xb'))(new Redis(config[_0x949c('0x9')]));require(_0x949c('0xc'))['register'](socket);function respondWithRpcPromise(_0x5c3aa9,_0x366594,_0x16a2c3){return new BPromise(function(_0x29a4bc,_0x5229a8){return client['request'](_0x5c3aa9,_0x16a2c3)[_0x949c('0xd')](function(_0x30ffc2){logger[_0x949c('0xe')](_0x949c('0xf'),_0x366594,_0x949c('0x10'));logger[_0x949c('0x11')]('Team,\x20%s,\x20%s,\x20%s',_0x366594,'request\x20sent',JSON[_0x949c('0x12')](_0x30ffc2));if(_0x30ffc2[_0x949c('0x13')]){if(_0x30ffc2[_0x949c('0x13')][_0x949c('0x14')]===0x1f4){logger['error'](_0x949c('0xf'),_0x366594,_0x30ffc2['error'][_0x949c('0x15')]);return _0x5229a8(_0x30ffc2[_0x949c('0x13')][_0x949c('0x15')]);}logger[_0x949c('0x13')](_0x949c('0xf'),_0x366594,_0x30ffc2['error'][_0x949c('0x15')]);return _0x29a4bc(_0x30ffc2['error']['message']);}else{logger[_0x949c('0xe')](_0x949c('0xf'),_0x366594,_0x949c('0x10'));_0x29a4bc(_0x30ffc2[_0x949c('0x16')][_0x949c('0x15')]);}})['catch'](function(_0x3f2589){logger[_0x949c('0x13')](_0x949c('0xf'),_0x366594,_0x3f2589);_0x5229a8(_0x3f2589);});});}