Built motion from commit (unavailable).|2.5.14
[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 _0xfbb4=['request','then','info','request\x20sent','debug','stringify','error','Team,\x20%s,\x20%s','message','result','catch','lodash','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./team.socket','register'];(function(_0x671369,_0x433da5){var _0x33f2b4=function(_0x2e9db2){while(--_0x2e9db2){_0x671369['push'](_0x671369['shift']());}};_0x33f2b4(++_0x433da5);}(_0xfbb4,0xc1));var _0x4fbb=function(_0x4587bb,_0x14c42b){_0x4587bb=_0x4587bb-0x0;var _0x3ca16a=_0xfbb4[_0x4587bb];return _0x3ca16a;};'use strict';var _=require(_0x4fbb('0x0'));var util=require('util');var moment=require(_0x4fbb('0x1'));var BPromise=require('bluebird');var rs=require(_0x4fbb('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4fbb('0x3'));var logger=require(_0x4fbb('0x4'))(_0x4fbb('0x5'));var config=require(_0x4fbb('0x6'));var jayson=require(_0x4fbb('0x7'));var client=jayson[_0x4fbb('0x8')]['http']({'port':0x232a});config[_0x4fbb('0x9')]=_[_0x4fbb('0xa')](config['redis'],{'host':_0x4fbb('0xb'),'port':0x18eb});var socket=require(_0x4fbb('0xc'))(new Redis(config['redis']));require(_0x4fbb('0xd'))[_0x4fbb('0xe')](socket);function respondWithRpcPromise(_0x497316,_0x3b59cb,_0x29d586){return new BPromise(function(_0x2ba535,_0x13c3ff){return client[_0x4fbb('0xf')](_0x497316,_0x29d586)[_0x4fbb('0x10')](function(_0x4abf2a){logger[_0x4fbb('0x11')]('Team,\x20%s,\x20%s',_0x3b59cb,_0x4fbb('0x12'));logger[_0x4fbb('0x13')]('Team,\x20%s,\x20%s,\x20%s',_0x3b59cb,'request\x20sent',JSON[_0x4fbb('0x14')](_0x4abf2a));if(_0x4abf2a[_0x4fbb('0x15')]){if(_0x4abf2a[_0x4fbb('0x15')]['code']===0x1f4){logger[_0x4fbb('0x15')](_0x4fbb('0x16'),_0x3b59cb,_0x4abf2a[_0x4fbb('0x15')][_0x4fbb('0x17')]);return _0x13c3ff(_0x4abf2a['error'][_0x4fbb('0x17')]);}logger[_0x4fbb('0x15')](_0x4fbb('0x16'),_0x3b59cb,_0x4abf2a[_0x4fbb('0x15')][_0x4fbb('0x17')]);return _0x2ba535(_0x4abf2a[_0x4fbb('0x15')][_0x4fbb('0x17')]);}else{logger[_0x4fbb('0x11')](_0x4fbb('0x16'),_0x3b59cb,_0x4fbb('0x12'));_0x2ba535(_0x4abf2a[_0x4fbb('0x18')][_0x4fbb('0x17')]);}})[_0x4fbb('0x19')](function(_0x16e71f){logger['error'](_0x4fbb('0x16'),_0x3b59cb,_0x16e71f);_0x13c3ff(_0x16e71f);});});}