Built motion from commit (unavailable).|2.5.20
[motion2.git] / server / api / chatInternalMessage / chatInternalMessage.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 _0x28f4=['info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./chatInternalMessage.socket','then'];(function(_0xc5caf7,_0xc6d31b){var _0x509351=function(_0x531902){while(--_0x531902){_0xc5caf7['push'](_0xc5caf7['shift']());}};_0x509351(++_0xc6d31b);}(_0x28f4,0x169));var _0x428f=function(_0x2205c8,_0x5db6e9){_0x2205c8=_0x2205c8-0x0;var _0x165906=_0x28f4[_0x2205c8];return _0x165906;};'use strict';var _=require(_0x428f('0x0'));var util=require(_0x428f('0x1'));var moment=require(_0x428f('0x2'));var BPromise=require(_0x428f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x428f('0x4'));var db=require(_0x428f('0x5'))['db'];var utils=require(_0x428f('0x6'));var logger=require(_0x428f('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x428f('0x8'));var client=jayson[_0x428f('0x9')][_0x428f('0xa')]({'port':0x232a});config['redis']=_[_0x428f('0xb')](config[_0x428f('0xc')],{'host':_0x428f('0xd'),'port':0x18eb});var socket=require(_0x428f('0xe'))(new Redis(config['redis']));require(_0x428f('0xf'))['register'](socket);function respondWithRpcPromise(_0x237273,_0x224202,_0x342d46){return new BPromise(function(_0x3800b6,_0x2f4d87){return client['request'](_0x237273,_0x342d46)[_0x428f('0x10')](function(_0x4b410b){logger[_0x428f('0x11')](_0x428f('0x12'),_0x224202,_0x428f('0x13'));logger[_0x428f('0x14')]('ChatInternalMessage,\x20%s,\x20%s,\x20%s',_0x224202,_0x428f('0x13'),JSON[_0x428f('0x15')](_0x4b410b));if(_0x4b410b[_0x428f('0x16')]){if(_0x4b410b[_0x428f('0x16')][_0x428f('0x17')]===0x1f4){logger[_0x428f('0x16')](_0x428f('0x12'),_0x224202,_0x4b410b[_0x428f('0x16')][_0x428f('0x18')]);return _0x2f4d87(_0x4b410b[_0x428f('0x16')][_0x428f('0x18')]);}logger[_0x428f('0x16')](_0x428f('0x12'),_0x224202,_0x4b410b['error'][_0x428f('0x18')]);return _0x3800b6(_0x4b410b[_0x428f('0x16')][_0x428f('0x18')]);}else{logger[_0x428f('0x11')](_0x428f('0x12'),_0x224202,'request\x20sent');_0x3800b6(_0x4b410b[_0x428f('0x19')]['message']);}})[_0x428f('0x1a')](function(_0x154b7d){logger[_0x428f('0x16')](_0x428f('0x12'),_0x224202,_0x154b7d);_0x2f4d87(_0x154b7d);});});}