Built motion from commit (unavailable).|2.5.21
[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 _0xd8b4=['defaults','redis','localhost','socket.io-emitter','./chatInternalMessage.socket','register','then','info','ChatInternalMessage,\x20%s,\x20%s','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','error','message','request\x20sent','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x52a3a6,_0x82f3aa){var _0x53d1a0=function(_0x3bc5ad){while(--_0x3bc5ad){_0x52a3a6['push'](_0x52a3a6['shift']());}};_0x53d1a0(++_0x82f3aa);}(_0xd8b4,0x1eb));var _0x4d8b=function(_0x23f404,_0x518573){_0x23f404=_0x23f404-0x0;var _0x12b16b=_0xd8b4[_0x23f404];return _0x12b16b;};'use strict';var _=require(_0x4d8b('0x0'));var util=require(_0x4d8b('0x1'));var moment=require(_0x4d8b('0x2'));var BPromise=require(_0x4d8b('0x3'));var rs=require(_0x4d8b('0x4'));var fs=require('fs');var Redis=require(_0x4d8b('0x5'));var db=require(_0x4d8b('0x6'))['db'];var utils=require(_0x4d8b('0x7'));var logger=require(_0x4d8b('0x8'))('rpc');var config=require(_0x4d8b('0x9'));var jayson=require(_0x4d8b('0xa'));var client=jayson[_0x4d8b('0xb')][_0x4d8b('0xc')]({'port':0x232a});config['redis']=_[_0x4d8b('0xd')](config[_0x4d8b('0xe')],{'host':_0x4d8b('0xf'),'port':0x18eb});var socket=require(_0x4d8b('0x10'))(new Redis(config[_0x4d8b('0xe')]));require(_0x4d8b('0x11'))[_0x4d8b('0x12')](socket);function respondWithRpcPromise(_0x10c9f3,_0x14e0f7,_0x23cec0){return new BPromise(function(_0x2c91e7,_0x1dc590){return client['request'](_0x10c9f3,_0x23cec0)[_0x4d8b('0x13')](function(_0x3be043){logger[_0x4d8b('0x14')](_0x4d8b('0x15'),_0x14e0f7,'request\x20sent');logger[_0x4d8b('0x16')](_0x4d8b('0x17'),_0x14e0f7,'request\x20sent',JSON['stringify'](_0x3be043));if(_0x3be043['error']){if(_0x3be043[_0x4d8b('0x18')]['code']===0x1f4){logger['error'](_0x4d8b('0x15'),_0x14e0f7,_0x3be043[_0x4d8b('0x18')][_0x4d8b('0x19')]);return _0x1dc590(_0x3be043[_0x4d8b('0x18')]['message']);}logger[_0x4d8b('0x18')](_0x4d8b('0x15'),_0x14e0f7,_0x3be043[_0x4d8b('0x18')]['message']);return _0x2c91e7(_0x3be043[_0x4d8b('0x18')][_0x4d8b('0x19')]);}else{logger[_0x4d8b('0x14')](_0x4d8b('0x15'),_0x14e0f7,_0x4d8b('0x1a'));_0x2c91e7(_0x3be043[_0x4d8b('0x1b')]['message']);}})['catch'](function(_0x191cc7){logger[_0x4d8b('0x18')]('ChatInternalMessage,\x20%s,\x20%s',_0x14e0f7,_0x191cc7);_0x1dc590(_0x191cc7);});});}