Built motion from commit 5b761a7b.|2.5.36
[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 _0x45ff=['redis','defaults','localhost','socket.io-emitter','./team.socket','info','Team,\x20%s,\x20%s','request\x20sent','Team,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x3f07f2,_0x242708){var _0x81b9ed=function(_0x54a051){while(--_0x54a051){_0x3f07f2['push'](_0x3f07f2['shift']());}};_0x81b9ed(++_0x242708);}(_0x45ff,0x16b));var _0xf45f=function(_0x592d48,_0x23f1ba){_0x592d48=_0x592d48-0x0;var _0x5d789e=_0x45ff[_0x592d48];return _0x5d789e;};'use strict';var _=require(_0xf45f('0x0'));var util=require(_0xf45f('0x1'));var moment=require(_0xf45f('0x2'));var BPromise=require(_0xf45f('0x3'));var rs=require(_0xf45f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf45f('0x5'))['db'];var utils=require(_0xf45f('0x6'));var logger=require(_0xf45f('0x7'))('rpc');var config=require(_0xf45f('0x8'));var jayson=require(_0xf45f('0x9'));var client=jayson[_0xf45f('0xa')][_0xf45f('0xb')]({'port':0x232a});config[_0xf45f('0xc')]=_[_0xf45f('0xd')](config[_0xf45f('0xc')],{'host':_0xf45f('0xe'),'port':0x18eb});var socket=require(_0xf45f('0xf'))(new Redis(config[_0xf45f('0xc')]));require(_0xf45f('0x10'))['register'](socket);function respondWithRpcPromise(_0x4d8561,_0x297f98,_0x19a6ca){return new BPromise(function(_0x4c42d2,_0x504372){return client['request'](_0x4d8561,_0x19a6ca)['then'](function(_0x1e1335){logger[_0xf45f('0x11')](_0xf45f('0x12'),_0x297f98,_0xf45f('0x13'));logger['debug'](_0xf45f('0x14'),_0x297f98,_0xf45f('0x13'),JSON[_0xf45f('0x15')](_0x1e1335));if(_0x1e1335['error']){if(_0x1e1335[_0xf45f('0x16')]['code']===0x1f4){logger[_0xf45f('0x16')](_0xf45f('0x12'),_0x297f98,_0x1e1335[_0xf45f('0x16')][_0xf45f('0x17')]);return _0x504372(_0x1e1335[_0xf45f('0x16')]['message']);}logger[_0xf45f('0x16')](_0xf45f('0x12'),_0x297f98,_0x1e1335[_0xf45f('0x16')][_0xf45f('0x17')]);return _0x4c42d2(_0x1e1335[_0xf45f('0x16')][_0xf45f('0x17')]);}else{logger[_0xf45f('0x11')]('Team,\x20%s,\x20%s',_0x297f98,_0xf45f('0x13'));_0x4c42d2(_0x1e1335[_0xf45f('0x18')][_0xf45f('0x17')]);}})['catch'](function(_0x59bbc9){logger['error']('Team,\x20%s,\x20%s',_0x297f98,_0x59bbc9);_0x504372(_0x59bbc9);});});}