Built motion from commit da24aabd.|2.6.20
[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 _0x781b=['defaults','localhost','socket.io-emitter','./team.socket','then','info','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','stringify','error','code','Team,\x20%s,\x20%s','message','result','lodash','moment','bluebird','../../config/utils','../../config/logger','client','http','redis'];(function(_0x356270,_0x5e94a1){var _0x31a942=function(_0x4c804b){while(--_0x4c804b){_0x356270['push'](_0x356270['shift']());}};_0x31a942(++_0x5e94a1);}(_0x781b,0xf5));var _0xb781=function(_0x5b89a0,_0x315a2a){_0x5b89a0=_0x5b89a0-0x0;var _0x44d81a=_0x781b[_0x5b89a0];return _0x44d81a;};'use strict';var _=require(_0xb781('0x0'));var util=require('util');var moment=require(_0xb781('0x1'));var BPromise=require(_0xb781('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xb781('0x3'));var logger=require(_0xb781('0x4'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb781('0x5')][_0xb781('0x6')]({'port':0x232a});config[_0xb781('0x7')]=_[_0xb781('0x8')](config[_0xb781('0x7')],{'host':_0xb781('0x9'),'port':0x18eb});var socket=require(_0xb781('0xa'))(new Redis(config[_0xb781('0x7')]));require(_0xb781('0xb'))['register'](socket);function respondWithRpcPromise(_0x542205,_0x43066b,_0x4b503a){return new BPromise(function(_0x18119f,_0x4b187c){return client['request'](_0x542205,_0x4b503a)[_0xb781('0xc')](function(_0x329b12){logger[_0xb781('0xd')]('Team,\x20%s,\x20%s',_0x43066b,_0xb781('0xe'));logger[_0xb781('0xf')](_0xb781('0x10'),_0x43066b,'request\x20sent',JSON[_0xb781('0x11')](_0x329b12));if(_0x329b12[_0xb781('0x12')]){if(_0x329b12['error'][_0xb781('0x13')]===0x1f4){logger[_0xb781('0x12')](_0xb781('0x14'),_0x43066b,_0x329b12['error'][_0xb781('0x15')]);return _0x4b187c(_0x329b12[_0xb781('0x12')][_0xb781('0x15')]);}logger[_0xb781('0x12')](_0xb781('0x14'),_0x43066b,_0x329b12[_0xb781('0x12')][_0xb781('0x15')]);return _0x18119f(_0x329b12[_0xb781('0x12')]['message']);}else{logger[_0xb781('0xd')](_0xb781('0x14'),_0x43066b,'request\x20sent');_0x18119f(_0x329b12[_0xb781('0x16')][_0xb781('0x15')]);}})['catch'](function(_0x4023cf){logger[_0xb781('0x12')](_0xb781('0x14'),_0x43066b,_0x4023cf);_0x4b187c(_0x4023cf);});});}