Built motion from commit e02f907f.|2.6.14
[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 _0x6705=['debug','Team,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','./team.socket','then','info','Team,\x20%s,\x20%s','request\x20sent'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6705,0xfb));var _0x5670=function(_0x5bdefd,_0x33384d){_0x5bdefd=_0x5bdefd-0x0;var _0x50802e=_0x6705[_0x5bdefd];return _0x50802e;};'use strict';var _=require(_0x5670('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x5670('0x1'));var rs=require(_0x5670('0x2'));var fs=require('fs');var Redis=require(_0x5670('0x3'));var db=require(_0x5670('0x4'))['db'];var utils=require(_0x5670('0x5'));var logger=require('../../config/logger')(_0x5670('0x6'));var config=require(_0x5670('0x7'));var jayson=require(_0x5670('0x8'));var client=jayson['client'][_0x5670('0x9')]({'port':0x232a});config['redis']=_[_0x5670('0xa')](config[_0x5670('0xb')],{'host':_0x5670('0xc'),'port':0x18eb});var socket=require(_0x5670('0xd'))(new Redis(config[_0x5670('0xb')]));require(_0x5670('0xe'))['register'](socket);function respondWithRpcPromise(_0x343199,_0x490057,_0x1c36f7){return new BPromise(function(_0x5ba6ee,_0x4b7a4d){return client['request'](_0x343199,_0x1c36f7)[_0x5670('0xf')](function(_0x3a1313){logger[_0x5670('0x10')](_0x5670('0x11'),_0x490057,_0x5670('0x12'));logger[_0x5670('0x13')](_0x5670('0x14'),_0x490057,'request\x20sent',JSON[_0x5670('0x15')](_0x3a1313));if(_0x3a1313[_0x5670('0x16')]){if(_0x3a1313[_0x5670('0x16')][_0x5670('0x17')]===0x1f4){logger[_0x5670('0x16')](_0x5670('0x11'),_0x490057,_0x3a1313[_0x5670('0x16')][_0x5670('0x18')]);return _0x4b7a4d(_0x3a1313[_0x5670('0x16')][_0x5670('0x18')]);}logger['error']('Team,\x20%s,\x20%s',_0x490057,_0x3a1313[_0x5670('0x16')][_0x5670('0x18')]);return _0x5ba6ee(_0x3a1313[_0x5670('0x16')][_0x5670('0x18')]);}else{logger[_0x5670('0x10')](_0x5670('0x11'),_0x490057,_0x5670('0x12'));_0x5ba6ee(_0x3a1313[_0x5670('0x19')][_0x5670('0x18')]);}})[_0x5670('0x1a')](function(_0x35c998){logger[_0x5670('0x16')](_0x5670('0x11'),_0x490057,_0x35c998);_0x4b7a4d(_0x35c998);});});}