3ae02266b57e2e1a3061ad873a67422bd0a32b71
[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 _0xc1ab=['redis','defaults','localhost','./chatInternalMessage.socket','request','then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','moment','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x589f71,_0x212326){var _0x5763bd=function(_0x2cb8e1){while(--_0x2cb8e1){_0x589f71['push'](_0x589f71['shift']());}};_0x5763bd(++_0x212326);}(_0xc1ab,0x67));var _0xbc1a=function(_0x481748,_0x19cfc9){_0x481748=_0x481748-0x0;var _0x3c36ab=_0xc1ab[_0x481748];return _0x3c36ab;};'use strict';var _=require(_0xbc1a('0x0'));var util=require(_0xbc1a('0x1'));var moment=require(_0xbc1a('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xbc1a('0x3'));var logger=require(_0xbc1a('0x4'))(_0xbc1a('0x5'));var config=require(_0xbc1a('0x6'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0xbc1a('0x7')]=_[_0xbc1a('0x8')](config[_0xbc1a('0x7')],{'host':_0xbc1a('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xbc1a('0xa'))['register'](socket);function respondWithRpcPromise(_0x5d30b5,_0x42d8ab,_0x46a6f9){return new BPromise(function(_0x14ac9d,_0x39c830){return client[_0xbc1a('0xb')](_0x5d30b5,_0x46a6f9)[_0xbc1a('0xc')](function(_0x59acbd){logger[_0xbc1a('0xd')](_0xbc1a('0xe'),_0x42d8ab,_0xbc1a('0xf'));logger[_0xbc1a('0x10')](_0xbc1a('0x11'),_0x42d8ab,'request\x20sent',JSON['stringify'](_0x59acbd));if(_0x59acbd['error']){if(_0x59acbd[_0xbc1a('0x12')][_0xbc1a('0x13')]===0x1f4){logger[_0xbc1a('0x12')](_0xbc1a('0xe'),_0x42d8ab,_0x59acbd[_0xbc1a('0x12')]['message']);return _0x39c830(_0x59acbd['error']['message']);}logger[_0xbc1a('0x12')]('ChatInternalMessage,\x20%s,\x20%s',_0x42d8ab,_0x59acbd[_0xbc1a('0x12')][_0xbc1a('0x14')]);return _0x14ac9d(_0x59acbd['error'][_0xbc1a('0x14')]);}else{logger[_0xbc1a('0xd')]('ChatInternalMessage,\x20%s,\x20%s',_0x42d8ab,_0xbc1a('0xf'));_0x14ac9d(_0x59acbd['result'][_0xbc1a('0x14')]);}})[_0xbc1a('0x15')](function(_0x54dbe7){logger['error'](_0xbc1a('0xe'),_0x42d8ab,_0x54dbe7);_0x39c830(_0x54dbe7);});});}