Built motion from commit 753c950e.|2.5.42
[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 _0x35d5=['jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./team.socket','register','request','info','request\x20sent','error','code','Team,\x20%s,\x20%s','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x512973,_0x564e8b){var _0x32f2e1=function(_0x5d5d3b){while(--_0x5d5d3b){_0x512973['push'](_0x512973['shift']());}};_0x32f2e1(++_0x564e8b);}(_0x35d5,0x1cb));var _0x535d=function(_0x351e3a,_0xbc0b52){_0x351e3a=_0x351e3a-0x0;var _0x385527=_0x35d5[_0x351e3a];return _0x385527;};'use strict';var _=require(_0x535d('0x0'));var util=require(_0x535d('0x1'));var moment=require('moment');var BPromise=require(_0x535d('0x2'));var rs=require(_0x535d('0x3'));var fs=require('fs');var Redis=require(_0x535d('0x4'));var db=require(_0x535d('0x5'))['db'];var utils=require(_0x535d('0x6'));var logger=require(_0x535d('0x7'))('rpc');var config=require(_0x535d('0x8'));var jayson=require(_0x535d('0x9'));var client=jayson[_0x535d('0xa')][_0x535d('0xb')]({'port':0x232a});config[_0x535d('0xc')]=_[_0x535d('0xd')](config[_0x535d('0xc')],{'host':_0x535d('0xe'),'port':0x18eb});var socket=require(_0x535d('0xf'))(new Redis(config[_0x535d('0xc')]));require(_0x535d('0x10'))[_0x535d('0x11')](socket);function respondWithRpcPromise(_0x56cd20,_0x3b1de3,_0x483296){return new BPromise(function(_0x1f47fe,_0x25c15f){return client[_0x535d('0x12')](_0x56cd20,_0x483296)['then'](function(_0x2d24ce){logger[_0x535d('0x13')]('Team,\x20%s,\x20%s',_0x3b1de3,_0x535d('0x14'));logger['debug']('Team,\x20%s,\x20%s,\x20%s',_0x3b1de3,'request\x20sent',JSON['stringify'](_0x2d24ce));if(_0x2d24ce[_0x535d('0x15')]){if(_0x2d24ce[_0x535d('0x15')][_0x535d('0x16')]===0x1f4){logger[_0x535d('0x15')](_0x535d('0x17'),_0x3b1de3,_0x2d24ce[_0x535d('0x15')][_0x535d('0x18')]);return _0x25c15f(_0x2d24ce[_0x535d('0x15')]['message']);}logger[_0x535d('0x15')](_0x535d('0x17'),_0x3b1de3,_0x2d24ce[_0x535d('0x15')]['message']);return _0x1f47fe(_0x2d24ce[_0x535d('0x15')]['message']);}else{logger[_0x535d('0x13')](_0x535d('0x17'),_0x3b1de3,'request\x20sent');_0x1f47fe(_0x2d24ce['result'][_0x535d('0x18')]);}})[_0x535d('0x19')](function(_0x20bcf1){logger[_0x535d('0x15')]('Team,\x20%s,\x20%s',_0x3b1de3,_0x20bcf1);_0x25c15f(_0x20bcf1);});});}