faf846ce62d1c205fa51d0f3d8fbef4535100412
[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 _0x67c3=['../../config/environment','jayson/promise','client','http','defaults','redis','socket.io-emitter','./chatInternalMessage.socket','register','request','then','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','rpc'];(function(_0x338f1f,_0x4cfd8d){var _0x140699=function(_0x360e40){while(--_0x360e40){_0x338f1f['push'](_0x338f1f['shift']());}};_0x140699(++_0x4cfd8d);}(_0x67c3,0x174));var _0x367c=function(_0x43f084,_0xb48804){_0x43f084=_0x43f084-0x0;var _0x2a6dde=_0x67c3[_0x43f084];return _0x2a6dde;};'use strict';var _=require(_0x367c('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x367c('0x1'));var rs=require(_0x367c('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x367c('0x3'))['db'];var utils=require(_0x367c('0x4'));var logger=require('../../config/logger')(_0x367c('0x5'));var config=require(_0x367c('0x6'));var jayson=require(_0x367c('0x7'));var client=jayson[_0x367c('0x8')][_0x367c('0x9')]({'port':0x232a});config['redis']=_[_0x367c('0xa')](config[_0x367c('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x367c('0xc'))(new Redis(config[_0x367c('0xb')]));require(_0x367c('0xd'))[_0x367c('0xe')](socket);function respondWithRpcPromise(_0x2c75b0,_0x551bd0,_0x55a418){return new BPromise(function(_0x25bcaa,_0x17f2ff){return client[_0x367c('0xf')](_0x2c75b0,_0x55a418)[_0x367c('0x10')](function(_0x3e0cd3){logger['info'](_0x367c('0x11'),_0x551bd0,_0x367c('0x12'));logger['debug'](_0x367c('0x13'),_0x551bd0,_0x367c('0x12'),JSON[_0x367c('0x14')](_0x3e0cd3));if(_0x3e0cd3[_0x367c('0x15')]){if(_0x3e0cd3[_0x367c('0x15')][_0x367c('0x16')]===0x1f4){logger[_0x367c('0x15')](_0x367c('0x11'),_0x551bd0,_0x3e0cd3[_0x367c('0x15')][_0x367c('0x17')]);return _0x17f2ff(_0x3e0cd3[_0x367c('0x15')][_0x367c('0x17')]);}logger[_0x367c('0x15')]('ChatInternalMessage,\x20%s,\x20%s',_0x551bd0,_0x3e0cd3[_0x367c('0x15')][_0x367c('0x17')]);return _0x25bcaa(_0x3e0cd3[_0x367c('0x15')]['message']);}else{logger[_0x367c('0x18')](_0x367c('0x11'),_0x551bd0,_0x367c('0x12'));_0x25bcaa(_0x3e0cd3[_0x367c('0x19')][_0x367c('0x17')]);}})[_0x367c('0x1a')](function(_0x48c824){logger[_0x367c('0x15')](_0x367c('0x11'),_0x551bd0,_0x48c824);_0x17f2ff(_0x48c824);});});}