Built motion from commit (unavailable).|2.5.11
[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 _0x01d7=['register','request','then','info','Team,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','http','redis','socket.io-emitter','./team.socket'];(function(_0x5bd98b,_0x22bf1c){var _0x49efe7=function(_0x2223e8){while(--_0x2223e8){_0x5bd98b['push'](_0x5bd98b['shift']());}};_0x49efe7(++_0x22bf1c);}(_0x01d7,0x114));var _0x701d=function(_0x529214,_0x421e97){_0x529214=_0x529214-0x0;var _0x5e9e40=_0x01d7[_0x529214];return _0x5e9e40;};'use strict';var _=require(_0x701d('0x0'));var util=require(_0x701d('0x1'));var moment=require(_0x701d('0x2'));var BPromise=require(_0x701d('0x3'));var rs=require(_0x701d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x701d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x701d('0x6'))('rpc');var config=require(_0x701d('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x701d('0x8')]({'port':0x232a});config[_0x701d('0x9')]=_['defaults'](config[_0x701d('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x701d('0xa'))(new Redis(config['redis']));require(_0x701d('0xb'))[_0x701d('0xc')](socket);function respondWithRpcPromise(_0x358d53,_0x16f23c,_0x1b053f){return new BPromise(function(_0x35c485,_0x5e133b){return client[_0x701d('0xd')](_0x358d53,_0x1b053f)[_0x701d('0xe')](function(_0xf83dce){logger[_0x701d('0xf')](_0x701d('0x10'),_0x16f23c,_0x701d('0x11'));logger[_0x701d('0x12')]('Team,\x20%s,\x20%s,\x20%s',_0x16f23c,_0x701d('0x11'),JSON[_0x701d('0x13')](_0xf83dce));if(_0xf83dce[_0x701d('0x14')]){if(_0xf83dce[_0x701d('0x14')][_0x701d('0x15')]===0x1f4){logger[_0x701d('0x14')](_0x701d('0x10'),_0x16f23c,_0xf83dce[_0x701d('0x14')][_0x701d('0x16')]);return _0x5e133b(_0xf83dce[_0x701d('0x14')][_0x701d('0x16')]);}logger[_0x701d('0x14')](_0x701d('0x10'),_0x16f23c,_0xf83dce[_0x701d('0x14')][_0x701d('0x16')]);return _0x35c485(_0xf83dce['error'][_0x701d('0x16')]);}else{logger[_0x701d('0xf')]('Team,\x20%s,\x20%s',_0x16f23c,'request\x20sent');_0x35c485(_0xf83dce[_0x701d('0x17')][_0x701d('0x16')]);}})['catch'](function(_0x56a7d9){logger[_0x701d('0x14')](_0x701d('0x10'),_0x16f23c,_0x56a7d9);_0x5e133b(_0x56a7d9);});});}