Built motion from commit (unavailable).|2.5.8
[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 _0x2433=['result','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','socket.io-emitter','redis','./team.socket','info','Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x2963ba,_0x2b6c1d){var _0x18eb91=function(_0x42c388){while(--_0x42c388){_0x2963ba['push'](_0x2963ba['shift']());}};_0x18eb91(++_0x2b6c1d);}(_0x2433,0x16d));var _0x3243=function(_0x3c40ed,_0x48f9c8){_0x3c40ed=_0x3c40ed-0x0;var _0x5aaa71=_0x2433[_0x3c40ed];return _0x5aaa71;};'use strict';var _=require('lodash');var util=require(_0x3243('0x0'));var moment=require(_0x3243('0x1'));var BPromise=require('bluebird');var rs=require(_0x3243('0x2'));var fs=require('fs');var Redis=require(_0x3243('0x3'));var db=require(_0x3243('0x4'))['db'];var utils=require(_0x3243('0x5'));var logger=require(_0x3243('0x6'))(_0x3243('0x7'));var config=require(_0x3243('0x8'));var jayson=require(_0x3243('0x9'));var client=jayson[_0x3243('0xa')][_0x3243('0xb')]({'port':0x232a});config['redis']=_[_0x3243('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x3243('0xd'))(new Redis(config[_0x3243('0xe')]));require(_0x3243('0xf'))['register'](socket);function respondWithRpcPromise(_0x381a67,_0x530974,_0xb6cbf4){return new BPromise(function(_0x3f8f8d,_0x456516){return client['request'](_0x381a67,_0xb6cbf4)['then'](function(_0x724ff9){logger[_0x3243('0x10')](_0x3243('0x11'),_0x530974,_0x3243('0x12'));logger[_0x3243('0x13')](_0x3243('0x14'),_0x530974,_0x3243('0x12'),JSON[_0x3243('0x15')](_0x724ff9));if(_0x724ff9['error']){if(_0x724ff9[_0x3243('0x16')][_0x3243('0x17')]===0x1f4){logger['error']('Team,\x20%s,\x20%s',_0x530974,_0x724ff9[_0x3243('0x16')][_0x3243('0x18')]);return _0x456516(_0x724ff9[_0x3243('0x16')]['message']);}logger[_0x3243('0x16')](_0x3243('0x11'),_0x530974,_0x724ff9[_0x3243('0x16')][_0x3243('0x18')]);return _0x3f8f8d(_0x724ff9[_0x3243('0x16')][_0x3243('0x18')]);}else{logger[_0x3243('0x10')]('Team,\x20%s,\x20%s',_0x530974,_0x3243('0x12'));_0x3f8f8d(_0x724ff9[_0x3243('0x19')][_0x3243('0x18')]);}})['catch'](function(_0x2d7046){logger[_0x3243('0x16')]('Team,\x20%s,\x20%s',_0x530974,_0x2d7046);_0x456516(_0x2d7046);});});}