782963cc952b0e3167abe7b49f7c16a96a473304
[motion2.git] / server / api / chatGroup / chatGroup.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 _0x5ef5=['stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','localhost','./chatGroup.socket','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x5ef5,0x1da));var _0x55ef=function(_0x43d277,_0x2c56dd){_0x43d277=_0x43d277-0x0;var _0x599cd8=_0x5ef5[_0x43d277];return _0x599cd8;};'use strict';var _=require('lodash');var util=require(_0x55ef('0x0'));var moment=require(_0x55ef('0x1'));var BPromise=require(_0x55ef('0x2'));var rs=require(_0x55ef('0x3'));var fs=require('fs');var Redis=require(_0x55ef('0x4'));var db=require(_0x55ef('0x5'))['db'];var utils=require(_0x55ef('0x6'));var logger=require('../../config/logger')(_0x55ef('0x7'));var config=require(_0x55ef('0x8'));var jayson=require(_0x55ef('0x9'));var client=jayson[_0x55ef('0xa')]['http']({'port':0x232a});config[_0x55ef('0xb')]=_['defaults'](config[_0x55ef('0xb')],{'host':_0x55ef('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x55ef('0xb')]));require(_0x55ef('0xd'))['register'](socket);function respondWithRpcPromise(_0x475c3b,_0x3d1d06,_0x2f1a71){return new BPromise(function(_0x33ecee,_0x3ac818){return client['request'](_0x475c3b,_0x2f1a71)[_0x55ef('0xe')](function(_0x2abfdb){logger[_0x55ef('0xf')](_0x55ef('0x10'),_0x3d1d06,_0x55ef('0x11'));logger[_0x55ef('0x12')](_0x55ef('0x13'),_0x3d1d06,'request\x20sent',JSON[_0x55ef('0x14')](_0x2abfdb));if(_0x2abfdb[_0x55ef('0x15')]){if(_0x2abfdb[_0x55ef('0x15')][_0x55ef('0x16')]===0x1f4){logger[_0x55ef('0x15')](_0x55ef('0x10'),_0x3d1d06,_0x2abfdb[_0x55ef('0x15')][_0x55ef('0x17')]);return _0x3ac818(_0x2abfdb['error']['message']);}logger['error'](_0x55ef('0x10'),_0x3d1d06,_0x2abfdb[_0x55ef('0x15')]['message']);return _0x33ecee(_0x2abfdb[_0x55ef('0x15')][_0x55ef('0x17')]);}else{logger[_0x55ef('0xf')](_0x55ef('0x10'),_0x3d1d06,_0x55ef('0x11'));_0x33ecee(_0x2abfdb[_0x55ef('0x18')][_0x55ef('0x17')]);}})[_0x55ef('0x19')](function(_0x206b9f){logger[_0x55ef('0x15')](_0x55ef('0x10'),_0x3d1d06,_0x206b9f);_0x3ac818(_0x206b9f);});});}