Built motion from commit a61a4a20.|2.5.46
[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 _0xe72f=['jayson/promise','client','http','redis','localhost','./team.socket','register','request','then','info','Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x4e9310,_0x5296e4){var _0x346b79=function(_0x2b0d41){while(--_0x2b0d41){_0x4e9310['push'](_0x4e9310['shift']());}};_0x346b79(++_0x5296e4);}(_0xe72f,0xd0));var _0xfe72=function(_0x200d94,_0x2c97f4){_0x200d94=_0x200d94-0x0;var _0x509401=_0xe72f[_0x200d94];return _0x509401;};'use strict';var _=require(_0xfe72('0x0'));var util=require(_0xfe72('0x1'));var moment=require(_0xfe72('0x2'));var BPromise=require('bluebird');var rs=require(_0xfe72('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xfe72('0x4'));var logger=require(_0xfe72('0x5'))(_0xfe72('0x6'));var config=require(_0xfe72('0x7'));var jayson=require(_0xfe72('0x8'));var client=jayson[_0xfe72('0x9')][_0xfe72('0xa')]({'port':0x232a});config[_0xfe72('0xb')]=_['defaults'](config[_0xfe72('0xb')],{'host':_0xfe72('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xfe72('0xd'))[_0xfe72('0xe')](socket);function respondWithRpcPromise(_0x12e7c7,_0x3ba793,_0x1161d1){return new BPromise(function(_0xeaa88d,_0x551d72){return client[_0xfe72('0xf')](_0x12e7c7,_0x1161d1)[_0xfe72('0x10')](function(_0x4f626f){logger[_0xfe72('0x11')](_0xfe72('0x12'),_0x3ba793,_0xfe72('0x13'));logger[_0xfe72('0x14')](_0xfe72('0x15'),_0x3ba793,_0xfe72('0x13'),JSON[_0xfe72('0x16')](_0x4f626f));if(_0x4f626f[_0xfe72('0x17')]){if(_0x4f626f[_0xfe72('0x17')][_0xfe72('0x18')]===0x1f4){logger[_0xfe72('0x17')]('Team,\x20%s,\x20%s',_0x3ba793,_0x4f626f[_0xfe72('0x17')][_0xfe72('0x19')]);return _0x551d72(_0x4f626f[_0xfe72('0x17')][_0xfe72('0x19')]);}logger['error'](_0xfe72('0x12'),_0x3ba793,_0x4f626f[_0xfe72('0x17')][_0xfe72('0x19')]);return _0xeaa88d(_0x4f626f[_0xfe72('0x17')]['message']);}else{logger['info'](_0xfe72('0x12'),_0x3ba793,_0xfe72('0x13'));_0xeaa88d(_0x4f626f[_0xfe72('0x1a')]['message']);}})['catch'](function(_0x5b4107){logger['error'](_0xfe72('0x12'),_0x3ba793,_0x5b4107);_0x551d72(_0x5b4107);});});}