Built motion from commit (unavailable).|2.5.23
[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 _0x9a17=['defaults','localhost','./team.socket','register','then','info','request\x20sent','debug','stringify','error','Team,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis'];(function(_0x50fb37,_0x2f0f72){var _0x1212ee=function(_0x4079b4){while(--_0x4079b4){_0x50fb37['push'](_0x50fb37['shift']());}};_0x1212ee(++_0x2f0f72);}(_0x9a17,0xbc));var _0x79a1=function(_0x2919e2,_0x2eeea2){_0x2919e2=_0x2919e2-0x0;var _0x459272=_0x9a17[_0x2919e2];return _0x459272;};'use strict';var _=require(_0x79a1('0x0'));var util=require(_0x79a1('0x1'));var moment=require(_0x79a1('0x2'));var BPromise=require(_0x79a1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x79a1('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x79a1('0x5'));var logger=require(_0x79a1('0x6'))(_0x79a1('0x7'));var config=require(_0x79a1('0x8'));var jayson=require(_0x79a1('0x9'));var client=jayson[_0x79a1('0xa')]['http']({'port':0x232a});config[_0x79a1('0xb')]=_[_0x79a1('0xc')](config[_0x79a1('0xb')],{'host':_0x79a1('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x79a1('0xb')]));require(_0x79a1('0xe'))[_0x79a1('0xf')](socket);function respondWithRpcPromise(_0x5f0ed8,_0x3c3341,_0x473abb){return new BPromise(function(_0x49a9ed,_0x5737f5){return client['request'](_0x5f0ed8,_0x473abb)[_0x79a1('0x10')](function(_0x2b9872){logger[_0x79a1('0x11')]('Team,\x20%s,\x20%s',_0x3c3341,_0x79a1('0x12'));logger[_0x79a1('0x13')]('Team,\x20%s,\x20%s,\x20%s',_0x3c3341,_0x79a1('0x12'),JSON[_0x79a1('0x14')](_0x2b9872));if(_0x2b9872[_0x79a1('0x15')]){if(_0x2b9872['error']['code']===0x1f4){logger['error'](_0x79a1('0x16'),_0x3c3341,_0x2b9872[_0x79a1('0x15')][_0x79a1('0x17')]);return _0x5737f5(_0x2b9872[_0x79a1('0x15')][_0x79a1('0x17')]);}logger[_0x79a1('0x15')](_0x79a1('0x16'),_0x3c3341,_0x2b9872[_0x79a1('0x15')][_0x79a1('0x17')]);return _0x49a9ed(_0x2b9872['error'][_0x79a1('0x17')]);}else{logger[_0x79a1('0x11')](_0x79a1('0x16'),_0x3c3341,_0x79a1('0x12'));_0x49a9ed(_0x2b9872[_0x79a1('0x18')][_0x79a1('0x17')]);}})['catch'](function(_0x591e9b){logger[_0x79a1('0x15')](_0x79a1('0x16'),_0x3c3341,_0x591e9b);_0x5737f5(_0x591e9b);});});}