Built motion from commit (unavailable).|2.5.4
[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 _0xe596=['util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','socket.io-emitter','./chatInternalMessage.socket','register','request','then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe596,0x152));var _0x6e59=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0xe596[_0x46e363];return _0x3fb059;};'use strict';var _=require('lodash');var util=require(_0x6e59('0x0'));var moment=require(_0x6e59('0x1'));var BPromise=require('bluebird');var rs=require(_0x6e59('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6e59('0x3'))['db'];var utils=require(_0x6e59('0x4'));var logger=require(_0x6e59('0x5'))(_0x6e59('0x6'));var config=require('../../config/environment');var jayson=require(_0x6e59('0x7'));var client=jayson[_0x6e59('0x8')][_0x6e59('0x9')]({'port':0x232a});config['redis']=_[_0x6e59('0xa')](config[_0x6e59('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x6e59('0xc'))(new Redis(config[_0x6e59('0xb')]));require(_0x6e59('0xd'))[_0x6e59('0xe')](socket);function respondWithRpcPromise(_0x3a6e6c,_0x5989e5,_0x4e0570){return new BPromise(function(_0x41125c,_0x4a1720){return client[_0x6e59('0xf')](_0x3a6e6c,_0x4e0570)[_0x6e59('0x10')](function(_0x1cd72d){logger[_0x6e59('0x11')](_0x6e59('0x12'),_0x5989e5,_0x6e59('0x13'));logger[_0x6e59('0x14')](_0x6e59('0x15'),_0x5989e5,'request\x20sent',JSON[_0x6e59('0x16')](_0x1cd72d));if(_0x1cd72d[_0x6e59('0x17')]){if(_0x1cd72d[_0x6e59('0x17')][_0x6e59('0x18')]===0x1f4){logger[_0x6e59('0x17')](_0x6e59('0x12'),_0x5989e5,_0x1cd72d['error'][_0x6e59('0x19')]);return _0x4a1720(_0x1cd72d[_0x6e59('0x17')][_0x6e59('0x19')]);}logger[_0x6e59('0x17')](_0x6e59('0x12'),_0x5989e5,_0x1cd72d['error']['message']);return _0x41125c(_0x1cd72d[_0x6e59('0x17')][_0x6e59('0x19')]);}else{logger['info'](_0x6e59('0x12'),_0x5989e5,_0x6e59('0x13'));_0x41125c(_0x1cd72d['result']['message']);}})['catch'](function(_0x37dcd8){logger['error'](_0x6e59('0x12'),_0x5989e5,_0x37dcd8);_0x4a1720(_0x37dcd8);});});}