Built motion from commit 85328c08.|2.5.50
[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 _0x1e4c=['error','code','message','lodash','util','randomstring','ioredis','../../config/logger','rpc','jayson/promise','http','defaults','localhost','./chatInternalMessage.socket','register','then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x3e7c60,_0x506a65){var _0x179e80=function(_0x51d655){while(--_0x51d655){_0x3e7c60['push'](_0x3e7c60['shift']());}};_0x179e80(++_0x506a65);}(_0x1e4c,0x1bb));var _0xc1e4=function(_0x1f5717,_0x3f9b8b){_0x1f5717=_0x1f5717-0x0;var _0x39162b=_0x1e4c[_0x1f5717];return _0x39162b;};'use strict';var _=require(_0xc1e4('0x0'));var util=require(_0xc1e4('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xc1e4('0x2'));var fs=require('fs');var Redis=require(_0xc1e4('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xc1e4('0x4'))(_0xc1e4('0x5'));var config=require('../../config/environment');var jayson=require(_0xc1e4('0x6'));var client=jayson['client'][_0xc1e4('0x7')]({'port':0x232a});config['redis']=_[_0xc1e4('0x8')](config['redis'],{'host':_0xc1e4('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xc1e4('0xa'))[_0xc1e4('0xb')](socket);function respondWithRpcPromise(_0x5545f9,_0x5f0bfc,_0x10f52c){return new BPromise(function(_0x2f331f,_0x3142ab){return client['request'](_0x5545f9,_0x10f52c)[_0xc1e4('0xc')](function(_0x1fd73d){logger[_0xc1e4('0xd')](_0xc1e4('0xe'),_0x5f0bfc,_0xc1e4('0xf'));logger[_0xc1e4('0x10')](_0xc1e4('0x11'),_0x5f0bfc,_0xc1e4('0xf'),JSON[_0xc1e4('0x12')](_0x1fd73d));if(_0x1fd73d[_0xc1e4('0x13')]){if(_0x1fd73d[_0xc1e4('0x13')][_0xc1e4('0x14')]===0x1f4){logger[_0xc1e4('0x13')](_0xc1e4('0xe'),_0x5f0bfc,_0x1fd73d[_0xc1e4('0x13')][_0xc1e4('0x15')]);return _0x3142ab(_0x1fd73d[_0xc1e4('0x13')]['message']);}logger['error'](_0xc1e4('0xe'),_0x5f0bfc,_0x1fd73d[_0xc1e4('0x13')][_0xc1e4('0x15')]);return _0x2f331f(_0x1fd73d[_0xc1e4('0x13')][_0xc1e4('0x15')]);}else{logger[_0xc1e4('0xd')]('ChatInternalMessage,\x20%s,\x20%s',_0x5f0bfc,_0xc1e4('0xf'));_0x2f331f(_0x1fd73d['result']['message']);}})['catch'](function(_0x1fa1b5){logger[_0xc1e4('0x13')]('ChatInternalMessage,\x20%s,\x20%s',_0x5f0bfc,_0x1fa1b5);_0x3142ab(_0x1fa1b5);});});}