0b3d77de185e63635af4e11d4598cdf837f99646
[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 _0x9f56=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','./chatInternalMessage.socket','register','then','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','lodash','util','moment','bluebird'];(function(_0x3ae74c,_0x4c8b20){var _0xc740c9=function(_0x4e233b){while(--_0x4e233b){_0x3ae74c['push'](_0x3ae74c['shift']());}};_0xc740c9(++_0x4c8b20);}(_0x9f56,0x134));var _0x69f5=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x9f56[_0x27af45];return _0x18df21;};'use strict';var _=require(_0x69f5('0x0'));var util=require(_0x69f5('0x1'));var moment=require(_0x69f5('0x2'));var BPromise=require(_0x69f5('0x3'));var rs=require(_0x69f5('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x69f5('0x5'))['db'];var utils=require(_0x69f5('0x6'));var logger=require(_0x69f5('0x7'))(_0x69f5('0x8'));var config=require(_0x69f5('0x9'));var jayson=require(_0x69f5('0xa'));var client=jayson[_0x69f5('0xb')]['http']({'port':0x232a});config[_0x69f5('0xc')]=_[_0x69f5('0xd')](config['redis'],{'host':_0x69f5('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x69f5('0xf'))[_0x69f5('0x10')](socket);function respondWithRpcPromise(_0x55a2fc,_0x445a79,_0x2af2cb){return new BPromise(function(_0xdb8bb1,_0x46664f){return client['request'](_0x55a2fc,_0x2af2cb)[_0x69f5('0x11')](function(_0x553518){logger['info'](_0x69f5('0x12'),_0x445a79,_0x69f5('0x13'));logger['debug'](_0x69f5('0x14'),_0x445a79,_0x69f5('0x13'),JSON[_0x69f5('0x15')](_0x553518));if(_0x553518[_0x69f5('0x16')]){if(_0x553518[_0x69f5('0x16')][_0x69f5('0x17')]===0x1f4){logger[_0x69f5('0x16')](_0x69f5('0x12'),_0x445a79,_0x553518[_0x69f5('0x16')][_0x69f5('0x18')]);return _0x46664f(_0x553518[_0x69f5('0x16')]['message']);}logger[_0x69f5('0x16')](_0x69f5('0x12'),_0x445a79,_0x553518[_0x69f5('0x16')][_0x69f5('0x18')]);return _0xdb8bb1(_0x553518[_0x69f5('0x16')]['message']);}else{logger[_0x69f5('0x19')](_0x69f5('0x12'),_0x445a79,_0x69f5('0x13'));_0xdb8bb1(_0x553518['result'][_0x69f5('0x18')]);}})['catch'](function(_0x1f4f19){logger[_0x69f5('0x16')]('ChatInternalMessage,\x20%s,\x20%s',_0x445a79,_0x1f4f19);_0x46664f(_0x1f4f19);});});}