Built motion from commit dbf3a7e2.|2.6.30
[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 _0x06ff=['http','redis','defaults','localhost','socket.io-emitter','./team.socket','register','request','info','Team,\x20%s,\x20%s','request\x20sent','Team,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client'];(function(_0x4f34d8,_0x40f022){var _0xc97536=function(_0xef9dfc){while(--_0xef9dfc){_0x4f34d8['push'](_0x4f34d8['shift']());}};_0xc97536(++_0x40f022);}(_0x06ff,0xb2));var _0xf06f=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x06ff[_0x46698a];return _0x356db0;};'use strict';var _=require(_0xf06f('0x0'));var util=require(_0xf06f('0x1'));var moment=require(_0xf06f('0x2'));var BPromise=require(_0xf06f('0x3'));var rs=require(_0xf06f('0x4'));var fs=require('fs');var Redis=require(_0xf06f('0x5'));var db=require(_0xf06f('0x6'))['db'];var utils=require(_0xf06f('0x7'));var logger=require('../../config/logger')(_0xf06f('0x8'));var config=require('../../config/environment');var jayson=require(_0xf06f('0x9'));var client=jayson[_0xf06f('0xa')][_0xf06f('0xb')]({'port':0x232a});config[_0xf06f('0xc')]=_[_0xf06f('0xd')](config['redis'],{'host':_0xf06f('0xe'),'port':0x18eb});var socket=require(_0xf06f('0xf'))(new Redis(config[_0xf06f('0xc')]));require(_0xf06f('0x10'))[_0xf06f('0x11')](socket);function respondWithRpcPromise(_0x50c9e1,_0x41f922,_0x34b256){return new BPromise(function(_0x15a29d,_0x2c9b27){return client[_0xf06f('0x12')](_0x50c9e1,_0x34b256)['then'](function(_0x752c27){logger[_0xf06f('0x13')](_0xf06f('0x14'),_0x41f922,_0xf06f('0x15'));logger['debug'](_0xf06f('0x16'),_0x41f922,_0xf06f('0x15'),JSON[_0xf06f('0x17')](_0x752c27));if(_0x752c27[_0xf06f('0x18')]){if(_0x752c27[_0xf06f('0x18')][_0xf06f('0x19')]===0x1f4){logger[_0xf06f('0x18')](_0xf06f('0x14'),_0x41f922,_0x752c27[_0xf06f('0x18')]['message']);return _0x2c9b27(_0x752c27[_0xf06f('0x18')]['message']);}logger[_0xf06f('0x18')](_0xf06f('0x14'),_0x41f922,_0x752c27[_0xf06f('0x18')][_0xf06f('0x1a')]);return _0x15a29d(_0x752c27['error']['message']);}else{logger[_0xf06f('0x13')]('Team,\x20%s,\x20%s',_0x41f922,_0xf06f('0x15'));_0x15a29d(_0x752c27['result']['message']);}})['catch'](function(_0x4c5752){logger[_0xf06f('0x18')](_0xf06f('0x14'),_0x41f922,_0x4c5752);_0x2c9b27(_0x4c5752);});});}