Built motion from commit (unavailable).|2.4.4
[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 _0x9e61=['localhost','socket.io-emitter','./team.socket','register','request','then','info','Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis'];(function(_0x562561,_0x5067bf){var _0x4df856=function(_0x389d28){while(--_0x389d28){_0x562561['push'](_0x562561['shift']());}};_0x4df856(++_0x5067bf);}(_0x9e61,0xbe));var _0x19e6=function(_0x476bf4,_0x2a3755){_0x476bf4=_0x476bf4-0x0;var _0x788ffe=_0x9e61[_0x476bf4];return _0x788ffe;};'use strict';var _=require(_0x19e6('0x0'));var util=require(_0x19e6('0x1'));var moment=require(_0x19e6('0x2'));var BPromise=require(_0x19e6('0x3'));var rs=require(_0x19e6('0x4'));var fs=require('fs');var Redis=require(_0x19e6('0x5'));var db=require(_0x19e6('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x19e6('0x7'))(_0x19e6('0x8'));var config=require(_0x19e6('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x19e6('0xa')][_0x19e6('0xb')]({'port':0x232a});config[_0x19e6('0xc')]=_['defaults'](config[_0x19e6('0xc')],{'host':_0x19e6('0xd'),'port':0x18eb});var socket=require(_0x19e6('0xe'))(new Redis(config[_0x19e6('0xc')]));require(_0x19e6('0xf'))[_0x19e6('0x10')](socket);function respondWithRpcPromise(_0xfbc933,_0x5f358c,_0x502b83){return new BPromise(function(_0x17f902,_0x503ad6){return client[_0x19e6('0x11')](_0xfbc933,_0x502b83)[_0x19e6('0x12')](function(_0x4c6e45){logger[_0x19e6('0x13')](_0x19e6('0x14'),_0x5f358c,_0x19e6('0x15'));logger[_0x19e6('0x16')](_0x19e6('0x17'),_0x5f358c,'request\x20sent',JSON[_0x19e6('0x18')](_0x4c6e45));if(_0x4c6e45[_0x19e6('0x19')]){if(_0x4c6e45[_0x19e6('0x19')]['code']===0x1f4){logger['error'](_0x19e6('0x14'),_0x5f358c,_0x4c6e45['error'][_0x19e6('0x1a')]);return _0x503ad6(_0x4c6e45[_0x19e6('0x19')][_0x19e6('0x1a')]);}logger[_0x19e6('0x19')](_0x19e6('0x14'),_0x5f358c,_0x4c6e45[_0x19e6('0x19')][_0x19e6('0x1a')]);return _0x17f902(_0x4c6e45['error'][_0x19e6('0x1a')]);}else{logger['info'](_0x19e6('0x14'),_0x5f358c,_0x19e6('0x15'));_0x17f902(_0x4c6e45[_0x19e6('0x1b')][_0x19e6('0x1a')]);}})[_0x19e6('0x1c')](function(_0x48a085){logger[_0x19e6('0x19')]('Team,\x20%s,\x20%s',_0x5f358c,_0x48a085);_0x503ad6(_0x48a085);});});}